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

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

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

Request.getHeader介绍

暂无

代码示例

代码示例来源:origin: jphp-group/jphp

@Signature
public String header(String name) {
  return request.getHeader(name);
}

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

while (headerNames.hasMoreElements()) {
  final String headerName = headerNames.nextElement();
  String headerValue = request.getHeader(headerName);
  requestContext.headers(headerName, headerValue == null ? "" : headerValue);

代码示例来源:origin: i2p/i2p.i2p

protected void logExtended(Request request, 
              Response response, 
              Writer writer) throws IOException 
{
  String referer = request.getHeader("Referer");
  if (referer == null) 
    writer.write("\"-\" ");
  else 
  {
    writer.write('"');
    writer.write(referer);
    writer.write("\" ");
  }
  
  String agent = request.getHeader("User-Agent");
  if (agent == null)
    writer.write("\"-\" ");
  else
  {
    writer.write('"');
    writer.write(agent);
    writer.write('"');
  }          
}

代码示例来源:origin: OAuth-Apis/apis

private String getHeaderCaseInsensitive(Request request, String headerName) {
  Enumeration<String> headerNames = (Enumeration<String>) request.getHeaderNames();
  while (headerNames.hasMoreElements()){
    String curHeaderName = (String) headerNames.nextElement();
    if (curHeaderName.toLowerCase().equals(headerName)) {
      return request.getHeader(curHeaderName);
    }
  }
  return null;
}

代码示例来源:origin: i2p/i2p.i2p

if (_preferProxiedForAddress) 
  addr = request.getHeader("X-Forwarded-For");
    addr = request.getHeader("X-I2P-DestHash");
    if (addr != null)
      addr += ".i2p";
  } else {
    addr = request.getHeader("X-I2P-DestB32");

代码示例来源:origin: com.madgag/org.eclipse.jgit.junit.http

private static Map<String, String> cloneHeaders(final Request req) {
  Map<String, String> r = new TreeMap<String, String>();
  Enumeration hn = req.getHeaderNames();
  while (hn.hasMoreElements()) {
    String key = (String) hn.nextElement();
    if (!r.containsKey(key)) {
      r.put(key, req.getHeader(key));
    }
  }
  return Collections.unmodifiableMap(r);
}

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

@Override
  public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
  {
    if (request.getHeader("Host") == null)
      request.setAuthority(serverName,serverPort);  // TODO set the field as well?
  }
}

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

@Override
  public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
  {
    if (request.getHeader("Host") == null)
      request.setAuthority(serverName,serverPort);  // TODO set the field as well?
  }
}

代码示例来源:origin: com.nitorcreations/willow-logging-jetty

@Override
public String getUserAgent() {
 return request.getHeader(HttpHeader.USER_AGENT.toString());
}

代码示例来源:origin: kiegroup/droolsjbpm-integration

@Override
  public void handle( Request request, HttpServletResponse response ) {
    response.setStatus(HTTP_OK);
    h1.set(request.getHeader("h1"));
    h2.set(request.getHeader("h2"));
  }
};

代码示例来源:origin: kiegroup/droolsjbpm-integration

@Override
  public void handle( Request request, HttpServletResponse response ) {
    response.setStatus(HTTP_OK);
    header.set(request.getHeader("Accept"));
  }
};

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

@Override
  public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
  {
    if (request.getHeader("Host") == null)
    {
      request.setServerName(serverName);
      if (serverPort > 0)
        request.setServerPort(serverPort);
    }
  }
}

代码示例来源:origin: kiegroup/droolsjbpm-integration

@Override
  public void handle( Request request, HttpServletResponse response ) {
    response.setStatus(HTTP_OK);
    header.set(request.getHeader("Accept"));
  }
};

代码示例来源:origin: kiegroup/droolsjbpm-integration

@Override
  public void handle( Request request, HttpServletResponse response ) {
    response.setStatus(HTTP_OK);
    header.set(request.getHeader("User-Agent"));
  }
};

代码示例来源:origin: kiegroup/droolsjbpm-integration

@Override
  public void handle( Request request, HttpServletResponse response ) {
    response.setStatus(HTTP_OK);
    header.set(request.getHeader("If-None-Match"));
  }
};

代码示例来源:origin: com.nitorcreations/willow-logging-jetty

@Override
public String getAddress() {
 String addr = null;
 if (preferProxiedForAddress) {
  addr = request.getHeader(HttpHeader.X_FORWARDED_FOR.toString());
 }
 if (addr == null) {
  addr = request.getRemoteAddr();
 }
 return addr;
}

代码示例来源:origin: kiegroup/droolsjbpm-integration

@Override
  public void handle( Request request, HttpServletResponse response ) {
    response.setStatus(HTTP_OK);
    header.set(request.getHeader("Accept-Encoding"));
  }
};

代码示例来源:origin: kiegroup/droolsjbpm-integration

@Override
  public void handle( Request request, HttpServletResponse response ) {
    String auth = request.getHeader("Authorization");
    auth = auth.substring(auth.indexOf(' ') + 1);
    auth = B64Code.decode(auth, CHARSET_UTF8);
    int colon = auth.indexOf(':');
    user.set(auth.substring(0, colon));
    password.set(auth.substring(colon + 1));
    response.setStatus(HTTP_OK);
  }
};

代码示例来源:origin: kiegroup/droolsjbpm-integration

@Override
  public void handle( Request request, HttpServletResponse response ) {
    response.setStatus(HTTP_OK);
    if( !"gzip".equals(request.getHeader("Accept-Encoding")) )
      return;
    write("hello not compressed");
  }
};

代码示例来源:origin: kiegroup/droolsjbpm-integration

@Override
 public void handle(Request request, HttpServletResponse response) {
  proxyHitCount.incrementAndGet();
  String auth = request.getHeader("Proxy-Authorization");
  auth = auth.substring(auth.indexOf(' ') + 1);
  auth = B64Code.decode(auth, CHARSET_UTF8);
  int colon = auth.indexOf(':');
  proxyUser.set(auth.substring(0, colon));
  proxyPassword.set(auth.substring(colon + 1));
  request.setHandled(false);
 }
};

相关文章

Request类方法