Exemplo n.º 1
0
 /** 服务分发. */
 @Override
 protected void service(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
   // 将当前请求和输出放到线程中
   String uri = req.getServletPath();
   WebContext.setResponse(resp);
   WebContext.setResquest(req);
   // 获取当前请求的映射视图(包括参数注入)
   ViewMapper viewMapper = ViewMapperFactory.getView();
   if (viewMapper == null) {
     throw new WqMvcException("There is no mapper view with the request of '" + uri + "'...");
   }
   // 获得请求执行器
   Executor executor = new Executor(viewMapper);
   Object returnObj = executor.execute();
   // 执行请求
   if (returnObj != null) {
     // 获得渲染器
     Render render = RenderFactory.getRender(viewMapper);
     // 执行渲染
     render.render(returnObj, req, resp);
   }
 }
Exemplo n.º 2
0
 protected View(WebContext ctx, Resource resource, String name) {
   super(ctx, resource, null);
   mediaType = ctx.getHttpHeaders().getMediaType();
   this.name = name;
 }
Exemplo n.º 3
0
 /**
  * File paths come in as /dcf/index.html but really they are in -
  *
  * <p>Domain Path Map: "/dcf/index.html"
  *
  * <p>Domain Private Phantom Files: (draft/preview mode files) ./private/dcw/[domain
  * id]/www-preview/dcf/index.html
  *
  * <p>Domain Private Override Files: ./private/dcw/[domain id]/www/dcf/index.html
  *
  * <p>Domain Phantom Files: (draft/preview mode files) ./public/dcw/[domain
  * id]/www-preview/dcf/index.html
  *
  * <p>Domain Override Files: ./public/dcw/[domain id]/www/dcf/index.html
  *
  * <p>Package Files: ./packages/[package id]/www/dcf/index.html
  *
  * <p>Example: - ./private/dcw/filetransferconsulting/www-preview/dcf/index.html -
  * ./private/dcw/filetransferconsulting/www/dcf/index.html -
  * ./public/dcw/filetransferconsulting/www-preview/dcf/index.html -
  * ./public/dcw/filetransferconsulting/www/dcf/index.html -
  * ./packages/zCustomPublic/www/dcf/index.html - ./packages/dc/dcFilePublic/www/dcf/index.html -
  * ./packages/dcWeb/www/dcf/index.html
  *
  * @param ctx
  * @return an adapter that can execute to generate web response
  */
 public IOutputAdapter findFile(WebContext ctx) {
   return this.findFile(ctx.getRequest().getPath(), ctx.isPreview());
 }