org.eclipse.jetty.server.Response.setContentLength()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(156)

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

Response.setContentLength介绍

暂无

代码示例

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

@Override
public OutputStream writeResponseStatusAndHeaders(final long contentLength, final ContainerResponse context)
    throws ContainerException {
  final javax.ws.rs.core.Response.StatusType statusInfo = context.getStatusInfo();
  final int code = statusInfo.getStatusCode();
  final String reason = statusInfo.getReasonPhrase() == null
      ? HttpStatus.getMessage(code) : statusInfo.getReasonPhrase();
  response.setStatusWithReason(code, reason);
  if (contentLength != -1 && contentLength < Integer.MAX_VALUE) {
    response.setContentLength((int) contentLength);
  }
  for (final Map.Entry<String, List<String>> e : context.getStringHeaders().entrySet()) {
    for (final String value : e.getValue()) {
      response.addHeader(e.getKey(), value);
    }
  }
  try {
    return response.getOutputStream();
  } catch (final IOException ioe) {
    throw new ContainerException("Error during writing out the response headers.", ioe);
  }
}

代码示例来源:origin: org.eclipse.jetty/jetty-security

response.setContentLength(0);
response.sendRedirect(url);

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

protected void handleOptions(Request request,Response response) throws IOException
{
  if (!HttpMethod.OPTIONS.is(request.getMethod()))
    response.sendError(HttpStatus.BAD_REQUEST_400);
  request.setHandled(true);
  response.setStatus(200);
  response.getHttpFields().put(HttpHeader.ALLOW,"GET,POST,HEAD,OPTIONS");
  response.setContentLength(0);
  response.complete();
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

protected void handleOptions(Request request,Response response) throws IOException
{
  if (!HttpMethod.OPTIONS.is(request.getMethod()))
    response.sendError(HttpStatus.BAD_REQUEST_400);
  request.setHandled(true);
  response.setStatus(200);
  response.getHttpFields().put(HttpHeader.ALLOW,"GET,POST,HEAD,OPTIONS");
  response.setContentLength(0);
  response.complete();
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server

response.setContentLength(-1);
String etag=fields.get(HttpHeader.ETAG);
if (etag!=null)

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

url += "?" + request.getQueryString();
response.setContentLength(0);
response.sendRedirect(url);

代码示例来源:origin: Nextdoor/bender

response.setContentLength(0);
response.sendRedirect(url);

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

url += "?" + request.getQueryString();
response.setContentLength(0);
response.sendRedirect(url);

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

if (request.getQueryString() != null)
  url += "?" + request.getQueryString();
response.setContentLength(0);
response.sendRedirect(url);
if (request.getQueryString() != null)
  url += "?" + request.getQueryString();
response.setContentLength(0);
response.sendRedirect(url);

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.security

response.setContentLength(0);
response.sendRedirect(url);

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

if (request.getQueryString() != null)
  url += "?" + request.getQueryString();
response.setContentLength(0);
response.sendRedirect(url);
if (request.getQueryString() != null)
  url += "?" + request.getQueryString();
response.setContentLength(0);
response.sendRedirect(url);

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

if (request.getQueryString() != null)
  url += "?" + request.getQueryString();
response.setContentLength(0);
response.sendRedirect(url);
if (request.getQueryString() != null)
  url += "?" + request.getQueryString();
response.setContentLength(0);
response.sendRedirect(url);

代码示例来源:origin: jenkinsci/winstone

response.setContentLength(0);
response.sendRedirect(url);

代码示例来源:origin: sonian/elasticsearch-jetty

if (request.getQueryString() != null)
    url += "?" + request.getQueryString();
  response.setContentLength(0);
  response.sendRedirect(url);
} else
    url += "?" + request.getQueryString();
  response.setContentLength(0);
  response.sendRedirect(url);
} else

代码示例来源:origin: org.eclipse.jetty/security

if (request.getQueryString() != null)
  url += "?" + request.getQueryString();
response.setContentLength(0);
response.sendRedirect(url);
  url += "?" + request.getQueryString();
response.setContentLength(0);
response.sendRedirect(url);

代码示例来源:origin: Nextdoor/bender

setContentLength(writer.size());
try (ServletOutputStream outputStream = getOutputStream())

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

setContentLength(writer.size());
writer.writeTo(getOutputStream());
writer.destroy();

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

setContentLength(writer.size());
writer.writeTo(getOutputStream());
writer.destroy();

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

setContentLength(writer.size());
writer.writeTo(getOutputStream());
writer.destroy();

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

setContentLength(writer.size());
writer.writeTo(getOutputStream());
writer.destroy();

相关文章