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

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

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

Request.getHttpChannel介绍

暂无

代码示例

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

@Override
  public void handle(String target,
            Request baseRequest,
            HttpServletRequest request,
            HttpServletResponse response) throws IOException, ServletException {
    final Connector connector = baseRequest.getHttpChannel().getConnector();
    for (Entry entry : entries) {
      // reference equality works fine — none of the connectors implement #equals(Object)
      if (entry.connector == connector) {
        entry.handler.handle(target, baseRequest, request, response);
        return;
      }
    }
  }
}

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

@Override
  public void handle( String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException
  {
    HttpChannel httpChannel = baseRequest.getHttpChannel();
    if ( httpChannel != null ) // if the channel is not null, all good, you handle yourself.
    {
      super.handle( target, baseRequest, request, response );
    }
    else // if we do not have a real channel, then we just log ourselves
    {
      try
      {
        if ( _handler != null )
        {
          _handler.handle( target, baseRequest, request, response );
        }
      }
      finally
      {
        RequestLog requestLog = getRequestLog();
        if ( requestLog != null && baseRequest.getDispatcherType() == DispatcherType.REQUEST )
        {
          requestLog.log( baseRequest, (Response) response );
        }
      }
    }
  }
}

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

return true;
HttpConfiguration httpConfig = Request.getBaseRequest(request).getHttpChannel().getHttpConfiguration();

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

public boolean isPushSupported()
{
  return getHttpChannel().getHttpTransport().isPushSupported();
}

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

protected String getRemoteIP(Request baseRequest)
{
  // Do we have a forwarded header set?
  if (_forwardedHeader!=null && !_forwardedHeader.isEmpty())
  {
    // Yes, then try to get the remote IP from the header
    String remote = _rfc7239?getForwarded(baseRequest):getXForwardedFor(baseRequest);
    if (remote!=null && !remote.isEmpty())
      return remote;
  }
  
  // If no remote IP from a header, determine it directly from the channel
  // Do not use the request methods, as they may have been lied to by the 
  // RequestCustomizer!
  InetSocketAddress inet_addr = baseRequest.getHttpChannel().getRemoteAddress();
  if (inet_addr!=null && inet_addr.getAddress()!=null)
    return inet_addr.getAddress().getHostAddress();
  return null;
}

代码示例来源:origin: io.dropwizard/dropwizard-jetty

@Override
  public void handle(String target,
            Request baseRequest,
            HttpServletRequest request,
            HttpServletResponse response) throws IOException, ServletException {
    final Connector connector = baseRequest.getHttpChannel().getConnector();
    for (Entry entry : entries) {
      // reference equality works fine — none of the connectors implement #equals(Object)
      if (entry.connector == connector) {
        entry.handler.handle(target, baseRequest, request, response);
        return;
      }
    }
  }
}

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

@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
{
  if (baseRequest.getDispatcherType()==DispatcherType.REQUEST)
    baseRequest.getHttpChannel().addRequestLog(_requestLog);
  if (_handler!=null)
    _handler.handle(target,baseRequest, request, response);
}

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

@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
{
  if (baseRequest.getDispatcherType()==DispatcherType.REQUEST)
    baseRequest.getHttpChannel().addRequestLog(_requestLog);
  if (_handler!=null)
    _handler.handle(target,baseRequest, request, response);
}

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

public boolean isPushSupported()
{
  return !isPush() && getHttpChannel().getHttpTransport().isPushSupported();
}

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

protected void writeErrorPageBody(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks)
  throws IOException
{
  String uri= request.getRequestURI();
  writeErrorPageMessage(request,writer,code,message,uri);
  if (showStacks)
    writeErrorPageStacks(request,writer);
  Request.getBaseRequest(request).getHttpChannel().getHttpConfiguration()
    .writePoweredBy(writer,"<hr>","<hr/>\n");
}

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

protected void writeErrorPageBody(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks)
  throws IOException
{
  String uri= request.getRequestURI();
  writeErrorPageMessage(request,writer,code,message,uri);
  if (showStacks)
    writeErrorPageStacks(request,writer);
  Request.getBaseRequest(request).getHttpChannel().getHttpConfiguration()
    .writePoweredBy(writer,"<hr>","<hr/>\n");
}

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

@Override
  protected void closeConnection(HttpServletRequest request, HttpServletResponse response, Thread thread)
  {
    Request base_request=(request instanceof Request)?(Request)request:HttpChannel.getCurrentHttpChannel().getRequest();
    base_request.getHttpChannel().getEndPoint().close();
  }
}

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

@Override
  protected void closeConnection(HttpServletRequest request, HttpServletResponse response, Thread thread)
  {
    Request base_request=(request instanceof Request)?(Request)request:HttpChannel.getCurrentHttpChannel().getRequest();
    base_request.getHttpChannel().getEndPoint().close();
  }
}

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

@Override
public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
{
  if (request.getHttpChannel().getEndPoint() instanceof DecryptedEndPoint)
  {
    request.setScheme(HttpScheme.HTTPS.asString());
    request.setSecure(true);
    SslConnection.DecryptedEndPoint ssl_endp = (DecryptedEndPoint)request.getHttpChannel().getEndPoint();
    SslConnection sslConnection = ssl_endp.getSslConnection();
    SSLEngine sslEngine=sslConnection.getSSLEngine();
    customize(sslEngine,request);
  }
}

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

/**
 * @param cookies
 *            The cookies to set.
 */
public void setCookies(Cookie[] cookies)
{
  if (_cookies == null)
    _cookies = new CookieCutter(getHttpChannel().getHttpConfiguration().getCookieCompliance());
  _cookies.setCookies(cookies);
}

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

@Override
public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
{
  if (request.getHttpChannel().getEndPoint() instanceof DecryptedEndPoint)
  {
    request.setScheme(HttpScheme.HTTPS.asString());
    request.setSecure(true);
    SslConnection.DecryptedEndPoint ssl_endp = (DecryptedEndPoint)request.getHttpChannel().getEndPoint();
    SslConnection sslConnection = ssl_endp.getSslConnection();
    SSLEngine sslEngine=sslConnection.getSSLEngine();
    customize(sslEngine,request);
  }
}

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

@Override
public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
{
  if (request.getHttpChannel().getEndPoint() instanceof DecryptedEndPoint)
  {
    request.setScheme(HttpScheme.HTTPS.asString());
    request.setSecure(true);
    SslConnection.DecryptedEndPoint ssl_endp = (DecryptedEndPoint)request.getHttpChannel().getEndPoint();
    SslConnection sslConnection = ssl_endp.getSslConnection();
    SSLEngine sslEngine=sslConnection.getSSLEngine();
    customize(sslEngine,request);
  }
}

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

@Override
public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
{
  if (request.getHttpChannel().getEndPoint() instanceof DecryptedEndPoint)
  {
    
    if (request.getHttpURI().getScheme()==null)
      request.setScheme(HttpScheme.HTTPS.asString());
    
    SslConnection.DecryptedEndPoint ssl_endp = (DecryptedEndPoint)request.getHttpChannel().getEndPoint();
    SslConnection sslConnection = ssl_endp.getSslConnection();
    SSLEngine sslEngine=sslConnection.getSSLEngine();
    customize(sslEngine,request);
  }
  if (HttpScheme.HTTPS.is(request.getScheme()))
    customizeSecure(request);
}

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

private MultiParts newMultiParts(ServletInputStream inputStream, String contentType, MultipartConfigElement config, Object object) throws IOException
{
  MultiPartFormDataCompliance compliance = getHttpChannel().getHttpConfiguration().getMultipartFormDataCompliance();
  if(LOG.isDebugEnabled())
    LOG.debug("newMultiParts {} {}",compliance, this);
  
  switch(compliance)
  {
    case RFC7578:
      return new MultiParts.MultiPartsHttpParser(getInputStream(), getContentType(), config,
          (_context != null?(File)_context.getAttribute("javax.servlet.context.tempdir"):null), this);
      
    case LEGACY: 
    default:
      return new MultiParts.MultiPartsUtilParser(getInputStream(), getContentType(), config,
        (_context != null?(File)_context.getAttribute("javax.servlet.context.tempdir"):null), this);
          
  }
}

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

@Override
public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
{
  EndPoint endp = request.getHttpChannel().getEndPoint();
  if (endp instanceof DecryptedEndPoint)
  {
    SslConnection.DecryptedEndPoint ssl_endp = (DecryptedEndPoint)endp;
    SslConnection sslConnection = ssl_endp.getSslConnection();
    SSLEngine sslEngine=sslConnection.getSSLEngine();
    customize(sslEngine,request);
    if (request.getHttpURI().getScheme()==null)
      request.setScheme(HttpScheme.HTTPS.asString());
  }
  else if (endp instanceof ProxyConnectionFactory.ProxyEndPoint)
  {
    ProxyConnectionFactory.ProxyEndPoint proxy = (ProxyConnectionFactory.ProxyEndPoint)endp;
    if (request.getHttpURI().getScheme()==null && proxy.getAttribute(ProxyConnectionFactory.TLS_VERSION)!=null)
      request.setScheme(HttpScheme.HTTPS.asString());       
  }
  if (HttpScheme.HTTPS.is(request.getScheme()))
    customizeSecure(request);
}

相关文章

Request类方法