org.apache.tiles.request.Request.getWriter()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(500)

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

Request.getWriter介绍

[英]Returns a writer to be used to write directly in the response.
[中]返回用于直接在响应中写入的写入程序。

代码示例

代码示例来源:origin: org.apache.tiles/tiles-request-api

/** {@inheritDoc} */
public Writer getWriter() throws IOException {
  return context.getWriter();
}

代码示例来源:origin: org.apache.tiles/tiles-test-common

/** {@inheritDoc} */
@Override
public void render(String value, Request request) throws IOException {
  char[] array = value.toCharArray();
  char[] newArray = new char[array.length];
  for (int i = 0; i < array.length; i++) {
    newArray[array.length - i - 1] = array[i];
  }
  request.getWriter().write(String.valueOf(newArray));
}

代码示例来源:origin: org.apache.tiles/tiles-request-api

/** {@inheritDoc} */
@Override
public void render(String value, Request request) throws IOException {
  if (value == null) {
    throw new CannotRenderException("Cannot render a null string");
  }
  request.getWriter().write(value);
}

代码示例来源:origin: org.apache.tiles/tiles-request-mustache

@Override
public void render(String path, Request request) throws IOException {
  if (path == null) {
    throw new CannotRenderException("Cannot dispatch a null path");
  }
  try {
    REQUEST_HOLDER.set(request);
    factory
        .compile(path)
        .execute(request.getWriter(), buildScope(request));
    REQUEST_HOLDER.remove();
  } catch(MustacheException ex) {
    throw new IOException("failed to MustacheRenderer.render(" + path + ",request)", ex);
  }
}

代码示例来源:origin: org.apache.tiles/tiles-template

request.getWriter().flush();

代码示例来源:origin: org.apache.tiles/tiles-template

Writer writer = request.getWriter();
if (attribute != null) {
  attribute = (Attribute) composeStack.pop();

代码示例来源:origin: org.apache.struts/struts2-tiles-plugin

@Override
public void render(String path, Request request) throws IOException {
  if (path != null) {
    LOG.trace("Rendering freemarker tile [{}]", path);
    ActionContext ctx = readActionContext(request);
    registerTilesBeanModel(ctx);
    FreemarkerResult result = new FreemarkerResult(path);
    result.setWriter(request.getWriter());
    Container container = ctx.getContainer();
    container.inject(result);
    try {
      ActionInvocation invocation = ctx.getActionInvocation();
      result.doExecute(path, invocation);
    } catch (TemplateException e) {
      LOG.error("Exception was thrown during rendering value {}: {}", path, e.getMessage());
      throw new InvalidTemplateException(e);
    }
  } else {
    LOG.error("Path is null, cannot render template!");
    throw new InvalidTemplateException("Cannot render a null template");
  }
}

代码示例来源:origin: org.apache.tiles/tiles-template

container.render(definitionName, request);
if (flush) {
  request.getWriter().flush();

代码示例来源:origin: org.apache.tiles/tiles-template

container.renderContext(request);
if (flush) {
  request.getWriter().flush();

相关文章