Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Intercepts
- @Lazy
- public class DisplayTagInterceptor implements Interceptor {
- private MutableRequest request;
- public DisplayTagInterceptor(MutableRequest request) {
- this.request = request;
- }
- public boolean accepts(ResourceMethod method) {
- return method.containsAnnotation(DisplayTag.java);
- }
- public void intercept(InterceptorStack stack, ResourceMethod method, Object instance)
- throws InterceptionException {
- String tableId = method.getMethod().getAnnotation(DisplayTag.class).value();
- String sortParam = new ParamEncoder(tableId).encodeParameterName(TableTagParameters.PARAMETER_SORT));
- String orderParam = new ParamEncoder(tableId).encodeParameterName(TableTagParameters.PARAMETER_ORDER));
- String pageParam = new ParamEncoder(tableId).encodeParameterName(TableTagParameters.PARAMETER_PAGE));
- request.setParameter("sort", request.getParameter(sortParam));
- request.setParameter("order", request.getParameter(orderParam));
- request.setParameter("page", request.getParameter(pageParam));
- stack.next(method, instance);
- }
- }
Add Comment
Please, Sign In to add comment