gpt4 book ai didi

httl.web.WebEngine.setRequestAndResponse()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-23 23:45:05 27 4
gpt4 key购买 nike

本文整理了Java中httl.web.WebEngine.setRequestAndResponse()方法的一些代码示例,展示了WebEngine.setRequestAndResponse()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebEngine.setRequestAndResponse()方法的具体详情如下:
包路径:httl.web.WebEngine
类名称:WebEngine
方法名:setRequestAndResponse

WebEngine.setRequestAndResponse介绍

暂无

代码示例

代码示例来源:origin: httl/httl

public void doFilter(HttpServletRequest request, HttpServletResponse response,
    FilterChain chain) throws IOException, ServletException {
  chain.doFilter(request, response);
  try {
    WebEngine.setRequestAndResponse(request, response);
    WebEngine.getEngine().getTemplate(getTemplatePath(request), request.getLocale()).render(response);
  } catch (ParseException e) {
    throw new ServletException(e.getMessage(), e);
  }
}

代码示例来源:origin: httl/httl

public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
  try {
    WebEngine.setRequestAndResponse(request, response);
    WebEngine.getEngine().getTemplate(getTemplatePath(request), request.getLocale()).render(response);
  } catch (ParseException e) {
    throw new ServletException(e.getMessage(), e);
  }
}

代码示例来源:origin: httl/httl

@Override
public void render() {
  try {
    WebEngine.setRequestAndResponse(request, response);
    WebEngine.getEngine().getTemplate(this.view, request.getLocale()).render(response);
  } catch (Exception e) {
    throw new RenderException(e.getMessage(), e);
  }
}

代码示例来源:origin: httl/httl

@Override
protected void renderMergedTemplateModel(Map<String, Object> model,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {
  WebEngine.setRequestAndResponse(request, response);
  WebEngine.getEngine().getTemplate(getUrl(), request.getLocale(), model).render(model, response);
}

代码示例来源:origin: httl/httl

public void render(HttpServletRequest req, HttpServletResponse resp, Object obj) throws Throwable {
  String path = getTemplatePath(evalPath(req, obj), req);
  WebEngine.setRequestAndResponse(req, resp);
  WebEngine.getEngine().getTemplate(path, req.getLocale(), obj).render(obj, resp);
}

代码示例来源:origin: httl/httl

@Override
protected void doExecute(String location, ActionInvocation invocation)
    throws Exception {
  ValueStack stack = ActionContext.getContext().getValueStack();
  ValueStackMap map = new ValueStackMap(stack);
  HttpServletRequest request = ServletActionContext.getRequest();
  HttpServletResponse response = ServletActionContext.getResponse();
  WebEngine.setRequestAndResponse(request, response);
  WebEngine.getEngine().getTemplate(location, request.getLocale(), map).render(map, response);
}

代码示例来源:origin: httl/httl

private void doWriteTo(String templateName, TemplateContext templateContext, Object out) throws TemplateException, IOException {
  try {
    String path = getTemplatePath(templateName);
    ContextMap map = new ContextMap(templateContext);
    TurbineRunData rundata = (TurbineRunData) templateContext.get("rundata");
    if (rundata != null) {
      HttpServletRequest request = rundata.getRequest();
      HttpServletResponse response = rundata.getResponse();
      if (rundata.getRequest() != null && rundata.getResponse() != null) {
        WebEngine.setRequestAndResponse(request, response);
        WebEngine.getEngine().getTemplate(path, request.getLocale(), templateEncoding, map).render(map, out);
        return;
      }
    }
    WebEngine.getEngine().getTemplate(path, templateEncoding).render(map, out);
  } catch (ParseException e) {
    throw new TemplateException(e.getMessage(), e);
  }
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com