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

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

本文整理了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

  1. public static boolean isConnectionOpen(HttpServletRequest request, byte[] heartbeat) {
  2. Request jettyRequest = (Request)request;
  3. AbstractHttpConnection connection = jettyRequest.getConnection();
  4. Socket socket = (Socket)connection.getEndPoint().getTransport();
  5. if (log.isLoggable(Level.FINE))
  6. log.fine("Checking if client connection is still open: " + socket.getRemoteSocketAddress());
  7. try {
  8. socket.getOutputStream().write(heartbeat);
  9. socket.getOutputStream().flush();
  10. return true;
  11. } catch (IOException ex) {
  12. if (log.isLoggable(Level.FINE))
  13. log.fine("Client connection has been closed: " + socket.getRemoteSocketAddress());
  14. return false;
  15. }
  16. }

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

  1. public static boolean isConnectionOpen(HttpServletRequest request, byte[] heartbeat) {
  2. Request jettyRequest = (Request)request;
  3. AbstractHttpConnection connection = jettyRequest.getConnection();
  4. Socket socket = (Socket)connection.getEndPoint().getTransport();
  5. if (log.isLoggable(Level.FINE))
  6. log.fine("Checking if client connection is still open: " + socket.getRemoteSocketAddress());
  7. try {
  8. socket.getOutputStream().write(heartbeat);
  9. socket.getOutputStream().flush();
  10. return true;
  11. } catch (IOException ex) {
  12. if (log.isLoggable(Level.FINE))
  13. log.fine("Client connection has been closed: " + socket.getRemoteSocketAddress());
  14. return false;
  15. }
  16. }

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

  1. public static boolean isConnectionOpen(HttpServletRequest request, byte[] heartbeat) {
  2. Request jettyRequest = (Request)request;
  3. AbstractHttpConnection connection = jettyRequest.getConnection();
  4. Socket socket = (Socket)connection.getEndPoint().getTransport();
  5. if (log.isLoggable(Level.FINE))
  6. log.fine("Checking if client connection is still open: " + socket.getRemoteSocketAddress());
  7. try {
  8. socket.getOutputStream().write(heartbeat);
  9. socket.getOutputStream().flush();
  10. return true;
  11. } catch (IOException ex) {
  12. if (log.isLoggable(Level.FINE))
  13. log.fine("Client connection has been closed: " + socket.getRemoteSocketAddress());
  14. return false;
  15. }
  16. }

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

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

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

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

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

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

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

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

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

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

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

  1. protected void closeConnection(HttpServletRequest request, HttpServletResponse response, Thread thread)
  2. {
  3. try
  4. {
  5. Request base_request=(request instanceof Request)?(Request)request:AbstractHttpConnection.getCurrentConnection().getRequest();
  6. base_request.getConnection().getEndPoint().close();
  7. }
  8. catch(IOException e)
  9. {
  10. LOG.warn(e);
  11. }
  12. }
  13. }

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

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

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

  1. /**
  2. * Checks the incoming request against the whitelist and blacklist
  3. *
  4. * @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
  5. */
  6. @Override
  7. public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
  8. {
  9. // Get the real remote IP (not the one set by the forwarded headers (which may be forged))
  10. AbstractHttpConnection connection = baseRequest.getConnection();
  11. if (connection!=null)
  12. {
  13. EndPoint endp=connection.getEndPoint();
  14. if (endp!=null)
  15. {
  16. String addr = endp.getRemoteAddr();
  17. if (addr!=null && !isAddrUriAllowed(addr,baseRequest.getPathInfo()))
  18. {
  19. response.sendError(HttpStatus.FORBIDDEN_403);
  20. baseRequest.setHandled(true);
  21. return;
  22. }
  23. }
  24. }
  25. getHandler().handle(target,baseRequest, request, response);
  26. }

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

  1. /**
  2. * Checks the incoming request against the whitelist and blacklist
  3. *
  4. * @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
  5. */
  6. @Override
  7. public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
  8. {
  9. // Get the real remote IP (not the one set by the forwarded headers (which may be forged))
  10. AbstractHttpConnection connection = baseRequest.getConnection();
  11. if (connection!=null)
  12. {
  13. EndPoint endp=connection.getEndPoint();
  14. if (endp!=null)
  15. {
  16. String addr = endp.getRemoteAddr();
  17. if (addr!=null && !isAddrUriAllowed(addr,baseRequest.getPathInfo()))
  18. {
  19. response.sendError(HttpStatus.FORBIDDEN_403);
  20. baseRequest.setHandled(true);
  21. return;
  22. }
  23. }
  24. }
  25. getHandler().handle(target,baseRequest, request, response);
  26. }

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

  1. /**
  2. * Checks the incoming request against the whitelist and blacklist
  3. *
  4. * @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
  5. */
  6. @Override
  7. public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
  8. {
  9. // Get the real remote IP (not the one set by the forwarded headers (which may be forged))
  10. AbstractHttpConnection connection = baseRequest.getConnection();
  11. if (connection!=null)
  12. {
  13. EndPoint endp=connection.getEndPoint();
  14. if (endp!=null)
  15. {
  16. String addr = endp.getRemoteAddr();
  17. if (addr!=null && !isAddrUriAllowed(addr,baseRequest.getPathInfo()))
  18. {
  19. response.sendError(HttpStatus.FORBIDDEN_403);
  20. baseRequest.setHandled(true);
  21. return;
  22. }
  23. }
  24. }
  25. getHandler().handle(target,baseRequest, request, response);
  26. }

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

  1. /**
  2. * Checks the incoming request against the whitelist and blacklist
  3. *
  4. * @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
  5. */
  6. @Override
  7. public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
  8. {
  9. // Get the real remote IP (not the one set by the forwarded headers (which may be forged))
  10. AbstractHttpConnection connection = baseRequest.getConnection();
  11. if (connection!=null)
  12. {
  13. EndPoint endp=connection.getEndPoint();
  14. if (endp!=null)
  15. {
  16. String addr = endp.getRemoteAddr();
  17. if (addr!=null && !isAddrUriAllowed(addr,baseRequest.getPathInfo()))
  18. {
  19. response.sendError(HttpStatus.FORBIDDEN_403);
  20. baseRequest.setHandled(true);
  21. return;
  22. }
  23. }
  24. }
  25. getHandler().handle(target,baseRequest, request, response);
  26. }

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

  1. /**
  2. * Checks the incoming request against the whitelist and blacklist
  3. *
  4. * @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
  5. */
  6. @Override
  7. public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
  8. {
  9. // Get the real remote IP (not the one set by the forwarded headers (which may be forged))
  10. AbstractHttpConnection connection = baseRequest.getConnection();
  11. if (connection!=null)
  12. {
  13. EndPoint endp=connection.getEndPoint();
  14. if (endp!=null)
  15. {
  16. String addr = endp.getRemoteAddr();
  17. if (addr!=null && !isAddrUriAllowed(addr,baseRequest.getPathInfo()))
  18. {
  19. response.sendError(HttpStatus.FORBIDDEN_403);
  20. baseRequest.setHandled(true);
  21. return;
  22. }
  23. }
  24. }
  25. getHandler().handle(target,baseRequest, request, response);
  26. }

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

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

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

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

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

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

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

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

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

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

相关文章

Request类方法