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

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

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

Response.setHeader介绍

暂无

代码示例

代码示例来源:origin: jooby-project/jooby

@Override
protected void handshake(final Runnable handler) throws Exception {
 /** Infinite timeout because the continuation is never resumed but only completed on close. */
 req.getAsyncContext().setTimeout(0L);
 /** Server sent events headers. */
 rsp.setStatus(HttpServletResponse.SC_OK);
 rsp.setHeader("Connection", "Close");
 rsp.setContentType("text/event-stream; charset=utf-8");
 rsp.flushBuffer();
 HttpChannel channel = rsp.getHttpChannel();
 Connector connector = channel.getConnector();
 Executor executor = connector.getExecutor();
 executor.execute(handler);
}

代码示例来源:origin: stackoverflow.com

//response handler
void handleRequest(Request request, Response response) {
  if(request.method == "OPTIONS") {
    response.setHeader("Access-Control-Allow-Origin","http://clientDomain.com")
    response.setHeader("Access-Control-Allow-Methods", "GET,POST,PUT,DELETE,OPTIONS");
    response.setHeader("Access-Control-Allow-Headers", "Content-Type");
  }


}

代码示例来源:origin: stackoverflow.com

void handleRequest(Request request, Response response) {
  if(request.method == "OPTIONS") {
    response.setHeader("Access-Control-Allow- Origin","Your_Domain")
    response.setHeader("Access-Control-Allow-Methods",  "GET,POST,PUT,DELETE,OPTIONS");
    response.setHeader("Access-Control-Allow-Headers", "Content-Type");
  }
}

代码示例来源:origin: stackoverflow.com

response.setHeader ("Content-Disposition", "attachment; filename=\"" + file.getName() + "\"");

代码示例来源:origin: zhuzhengquan/pc5s

private void setServer(HttpServletResponse response){
   Response r=(Response)response;
   r.setHeader(HttpHeader.SERVER.asString(), "pc5s");
}

代码示例来源:origin: stackoverflow.com

response.setHeader("Expires", "0");
response.setHeader("Cache-Control",
  "must-revalidate, post-check=0, pre-check=0");

代码示例来源:origin: stackoverflow.com

response.setHeader("Content-Disposition", "attachment; filename=\"old_fmt_map.kmz\"");
renderAsKmz(response, kmlFileContent,"old_fmt_map.kml");
return;

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

@Override
public void addHeader(String name, String value)
{
  if (isIncluding())
  {
    if (name.startsWith(SET_INCLUDE_HEADER_PREFIX))
      name = name.substring(SET_INCLUDE_HEADER_PREFIX.length());
    else
      return;
  }
  if (HttpHeader.CONTENT_TYPE.is(name))
  {
    setContentType(value);
    return;
  }
  if (HttpHeader.CONTENT_LENGTH.is(name))
  {
    setHeader(name,value);
    return;
  }
  _fields.add(name, value);
}

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

@Override
public void addHeader(String name, String value)
{
  if (isIncluding())
  {
    if (name.startsWith(SET_INCLUDE_HEADER_PREFIX))
      name = name.substring(SET_INCLUDE_HEADER_PREFIX.length());
    else
      return;
  }
  if (HttpHeader.CONTENT_TYPE.is(name))
  {
    setContentType(value);
    return;
  }
  
  if (HttpHeader.CONTENT_LENGTH.is(name))
  {
    setHeader(name,value);
    return;
  }
  
  _fields.add(name, value);
}

代码示例来源:origin: theonedev/onedev

@Override
public void addHeader(String name, String value)
{
  if (isIncluding())
  {
    if (name.startsWith(SET_INCLUDE_HEADER_PREFIX))
      name = name.substring(SET_INCLUDE_HEADER_PREFIX.length());
    else
      return;
  }
  if (HttpHeader.CONTENT_TYPE.is(name))
  {
    setContentType(value);
    return;
  }
  
  if (HttpHeader.CONTENT_LENGTH.is(name))
  {
    setHeader(name,value);
    return;
  }
  
  _fields.add(name, value);
}

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

@Override
public void addHeader(String name, String value)
{
  if (isIncluding())
  {
    if (name.startsWith(SET_INCLUDE_HEADER_PREFIX))
      name = name.substring(SET_INCLUDE_HEADER_PREFIX.length());
    else
      return;
  }
  if (HttpHeader.CONTENT_TYPE.is(name))
  {
    setContentType(value);
    return;
  }
  
  if (HttpHeader.CONTENT_LENGTH.is(name))
  {
    setHeader(name,value);
    return;
  }
  
  _fields.add(name, value);
}

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

setHeader(HttpHeaders.LOCATION,location);
setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
complete();

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

setHeader(HttpHeaders.LOCATION,location);
setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
complete();

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

setHeader(HttpHeaders.LOCATION,location);
setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
complete();

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

setHeader(HttpHeader.LOCATION, location);
setStatus(code);
closeOutput();

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

setHeader(HttpHeaders.LOCATION,location);
setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
complete();

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

setHeader(HttpHeader.LOCATION, location);
setStatus(code);
closeOutput();

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

setHeader(HttpHeader.LOCATION, location);
setStatus(code);
closeOutput();

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

@Override
protected void handshake(final Runnable handler) throws Exception {
 /** Infinite timeout because the continuation is never resumed but only completed on close. */
 req.getAsyncContext().setTimeout(0L);
 /** Server sent events headers. */
 rsp.setStatus(HttpServletResponse.SC_OK);
 rsp.setHeader("Connection", "Close");
 rsp.setContentType("text/event-stream; charset=utf-8");
 rsp.flushBuffer();
 HttpChannel channel = rsp.getHttpChannel();
 Connector connector = channel.getConnector();
 Executor executor = connector.getExecutor();
 executor.execute(handler);
}

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

_response.setHeader(HttpHeader.CONNECTION.asString(),HttpHeaderValue.CLOSE.asString());
_response.sendError(500, x.getMessage());

相关文章