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

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

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

Request.getConnection介绍

暂无

代码示例

代码示例来源:origin: 4thline/cling

public static boolean isConnectionOpen(HttpServletRequest request, byte[] heartbeat) {
  Request jettyRequest = (Request)request;
  AbstractHttpConnection connection = jettyRequest.getConnection();
  Socket socket = (Socket)connection.getEndPoint().getTransport();
  if (log.isLoggable(Level.FINE))
    log.fine("Checking if client connection is still open: " + socket.getRemoteSocketAddress());
  try {
    socket.getOutputStream().write(heartbeat);
    socket.getOutputStream().flush();
    return true;
  } catch (IOException ex) {
    if (log.isLoggable(Level.FINE))
      log.fine("Client connection has been closed: " + socket.getRemoteSocketAddress());
    return false;
  }
}

代码示例来源:origin: kingthy/TVRemoteIME

public static boolean isConnectionOpen(HttpServletRequest request, byte[] heartbeat) {
  Request jettyRequest = (Request)request;
  AbstractHttpConnection connection = jettyRequest.getConnection();
  Socket socket = (Socket)connection.getEndPoint().getTransport();
  if (log.isLoggable(Level.FINE))
    log.fine("Checking if client connection is still open: " + socket.getRemoteSocketAddress());
  try {
    socket.getOutputStream().write(heartbeat);
    socket.getOutputStream().flush();
    return true;
  } catch (IOException ex) {
    if (log.isLoggable(Level.FINE))
      log.fine("Client connection has been closed: " + socket.getRemoteSocketAddress());
    return false;
  }
}

代码示例来源:origin: org.fourthline.cling/cling-core

public static boolean isConnectionOpen(HttpServletRequest request, byte[] heartbeat) {
  Request jettyRequest = (Request)request;
  AbstractHttpConnection connection = jettyRequest.getConnection();
  Socket socket = (Socket)connection.getEndPoint().getTransport();
  if (log.isLoggable(Level.FINE))
    log.fine("Checking if client connection is still open: " + socket.getRemoteSocketAddress());
  try {
    socket.getOutputStream().write(heartbeat);
    socket.getOutputStream().flush();
    return true;
  } catch (IOException ex) {
    if (log.isLoggable(Level.FINE))
      log.fine("Client connection has been closed: " + socket.getRemoteSocketAddress());
    return false;
  }
}

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

public Object getAttribute(String name)
{
  if ("org.eclipse.jetty.io.EndPoint.maxIdleTime".equalsIgnoreCase(name))
    return new Long(getConnection().getEndPoint().getMaxIdleTime());
  Object attr = (_attributes == null)?null:_attributes.getAttribute(name);
  if (attr == null && Continuation.ATTRIBUTE.equals(name))
    return _async;
  return attr;
}

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

public Object getAttribute(String name)
{
  if ("org.eclipse.jetty.io.EndPoint.maxIdleTime".equalsIgnoreCase(name))
    return new Long(getConnection().getEndPoint().getMaxIdleTime());
  Object attr = (_attributes == null)?null:_attributes.getAttribute(name);
  if (attr == null && Continuation.ATTRIBUTE.equals(name))
    return _async;
  return attr;
}

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

public Object getAttribute(String name)
{
  if ("org.eclipse.jetty.io.EndPoint.maxIdleTime".equalsIgnoreCase(name))
    return new Long(getConnection().getEndPoint().getMaxIdleTime());
  Object attr = (_attributes == null)?null:_attributes.getAttribute(name);
  if (attr == null && Continuation.ATTRIBUTE.equals(name))
    return _async;
  return attr;
}

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

public Object getAttribute(String name)
{
  if ("org.eclipse.jetty.io.EndPoint.maxIdleTime".equalsIgnoreCase(name))
    return new Long(getConnection().getEndPoint().getMaxIdleTime());
  Object attr = (_attributes == null)?null:_attributes.getAttribute(name);
  if (attr == null && Continuation.ATTRIBUTE.equals(name))
    return _async;
  return attr;
}

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

public Object getAttribute(String name)
{
  if ("org.eclipse.jetty.io.EndPoint.maxIdleTime".equalsIgnoreCase(name))
    return new Long(getConnection().getEndPoint().getMaxIdleTime());
  Object attr = (_attributes == null)?null:_attributes.getAttribute(name);
  if (attr == null && Continuation.ATTRIBUTE.equals(name))
    return _async;
  return attr;
}

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

protected void closeConnection(HttpServletRequest request, HttpServletResponse response, Thread thread)
  {
    try
    {
      Request base_request=(request instanceof Request)?(Request)request:AbstractHttpConnection.getCurrentConnection().getRequest();
      base_request.getConnection().getEndPoint().close();
    }
    catch(IOException e)
    {
      LOG.warn(e);
    }
  }
}

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

getConnection().getEndPoint().setMaxIdleTime(Integer.valueOf(value.toString()));

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

/**
 * Checks the incoming request against the whitelist and blacklist
 * 
 * @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
  // Get the real remote IP (not the one set by the forwarded headers (which may be forged))
  AbstractHttpConnection connection = baseRequest.getConnection();
  if (connection!=null)
  {
    EndPoint endp=connection.getEndPoint();
    if (endp!=null)
    {
      String addr = endp.getRemoteAddr();
      if (addr!=null && !isAddrUriAllowed(addr,baseRequest.getPathInfo()))
      {
        response.sendError(HttpStatus.FORBIDDEN_403);
        baseRequest.setHandled(true);
        return;
      }
    }
  }
  
  getHandler().handle(target,baseRequest, request, response);
}

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

/**
 * Checks the incoming request against the whitelist and blacklist
 * 
 * @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
  // Get the real remote IP (not the one set by the forwarded headers (which may be forged))
  AbstractHttpConnection connection = baseRequest.getConnection();
  if (connection!=null)
  {
    EndPoint endp=connection.getEndPoint();
    if (endp!=null)
    {
      String addr = endp.getRemoteAddr();
      if (addr!=null && !isAddrUriAllowed(addr,baseRequest.getPathInfo()))
      {
        response.sendError(HttpStatus.FORBIDDEN_403);
        baseRequest.setHandled(true);
        return;
      }
    }
  }
  
  getHandler().handle(target,baseRequest, request, response);
}

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

/**
 * Checks the incoming request against the whitelist and blacklist
 * 
 * @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
  // Get the real remote IP (not the one set by the forwarded headers (which may be forged))
  AbstractHttpConnection connection = baseRequest.getConnection();
  if (connection!=null)
  {
    EndPoint endp=connection.getEndPoint();
    if (endp!=null)
    {
      String addr = endp.getRemoteAddr();
      if (addr!=null && !isAddrUriAllowed(addr,baseRequest.getPathInfo()))
      {
        response.sendError(HttpStatus.FORBIDDEN_403);
        baseRequest.setHandled(true);
        return;
      }
    }
  }
  
  getHandler().handle(target,baseRequest, request, response);
}

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

/**
 * Checks the incoming request against the whitelist and blacklist
 * 
 * @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
  // Get the real remote IP (not the one set by the forwarded headers (which may be forged))
  AbstractHttpConnection connection = baseRequest.getConnection();
  if (connection!=null)
  {
    EndPoint endp=connection.getEndPoint();
    if (endp!=null)
    {
      String addr = endp.getRemoteAddr();
      if (addr!=null && !isAddrUriAllowed(addr,baseRequest.getPathInfo()))
      {
        response.sendError(HttpStatus.FORBIDDEN_403);
        baseRequest.setHandled(true);
        return;
      }
    }
  }
  
  getHandler().handle(target,baseRequest, request, response);
}

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

/**
 * Checks the incoming request against the whitelist and blacklist
 * 
 * @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
  // Get the real remote IP (not the one set by the forwarded headers (which may be forged))
  AbstractHttpConnection connection = baseRequest.getConnection();
  if (connection!=null)
  {
    EndPoint endp=connection.getEndPoint();
    if (endp!=null)
    {
      String addr = endp.getRemoteAddr();
      if (addr!=null && !isAddrUriAllowed(addr,baseRequest.getPathInfo()))
      {
        response.sendError(HttpStatus.FORBIDDEN_403);
        baseRequest.setHandled(true);
        return;
      }
    }
  }
  
  getHandler().handle(target,baseRequest, request, response);
}

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

baseRequest.getConnection().include();
if (_named!=null)
  _contextHandler.handle(_named,baseRequest, (HttpServletRequest)request, (HttpServletResponse)response);
baseRequest.getConnection().included();
baseRequest.setParameters(old_params);
baseRequest.setDispatcherType(old_type);

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

baseRequest.getConnection().include();
if (_named!=null)
  _contextHandler.handle(_named,baseRequest, (HttpServletRequest)request, (HttpServletResponse)response);
baseRequest.getConnection().included();
baseRequest.setParameters(old_params);
baseRequest.setDispatcherType(old_type);

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

protected void checkForwardedHeaders(EndPoint endpoint, Request request) throws IOException
  HttpFields httpFields = request.getConnection().getRequestFields();

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

protected void checkForwardedHeaders(EndPoint endpoint, Request request) throws IOException
  HttpFields httpFields = request.getConnection().getRequestFields();

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

protected void checkForwardedHeaders(EndPoint endpoint, Request request) throws IOException
  HttpFields httpFields = request.getConnection().getRequestFields();

相关文章

Request类方法