Ejemplo n.º 1
0
 public void handle(Class<?> annotatedType) {
   logger.debug("Found resource: " + annotatedType);
   List<Route> routes = parser.rulesFor(new DefaultResourceClass(annotatedType));
   for (Route route : routes) {
     router.add(route);
   }
   context.setAttribute(annotatedType.getSimpleName(), annotatedType);
 }
Ejemplo n.º 2
0
 public void redirect() throws IllegalStateException {
   String referer = getReferer();
   try {
     ResourceMethod method = router.parse(referer, HttpMethod.GET, request);
     executeMethod(method, result.use(logic()).redirectTo(method.getResource().getType()));
   } catch (ResourceNotFoundException e) {
     result.use(page()).redirect(referer);
   } catch (MethodNotAllowedException e) {
     result.use(page()).redirect(referer);
   }
 }
Ejemplo n.º 3
0
 private void tryMovePermanentlyTo(RequestInfo requestInfo, String newUri) {
   router.parse(newUri, HttpMethod.of(requestInfo.getRequest()), requestInfo.getRequest());
   result.permanentlyRedirectTo(newUri);
 }
Ejemplo n.º 4
0
 @Override
 public String get() {
   return env.getHostAndContext() + router.urlFor(controllerType, method, args);
 }