コード例 #1
0
 @Override
 public void respond(final Object entity, final RouteContext routeContext) throws Exception {
   final String viewPath = getViewResolver().resolveViewPathFor(routeContext.getRoute());
   final View view = new View(viewPath, entity);
   if (view.hasModelData()) {
     routeContext.getRequest().setAttribute(view.getModelName(), view.getModel());
   }
   routeContext
       .getRequest()
       .getRequestDispatcher(view.getViewPath())
       .forward(routeContext.getRequest(), routeContext.getResponse());
 }
コード例 #2
0
 @Override
 public void writeResponse(Object entity, RouteContext routeContext) throws Exception {
   if (responseHeaders != null && responseHeaders.getHeaders() != null) {
     Set<Map.Entry<String, String>> entrySet = responseHeaders.getHeaders().entrySet();
     for (Map.Entry<String, String> entry : entrySet) {
       routeContext.getResponse().setHeader(entry.getKey(), entry.getValue());
     }
   }
   super.writeResponse(entity, routeContext);
 }