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);
 }
 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);
   }
 }
Beispiel #3
0
 private void tryMovePermanentlyTo(RequestInfo requestInfo, String newUri) {
   router.parse(newUri, HttpMethod.of(requestInfo.getRequest()), requestInfo.getRequest());
   result.permanentlyRedirectTo(newUri);
 }
 @Override
 public String get() {
   return env.getHostAndContext() + router.urlFor(controllerType, method, args);
 }