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; } }
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; } }
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; } }
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; }
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; }
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; }
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; }
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; }
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); } } }
getConnection().getEndPoint().setMaxIdleTime(Integer.valueOf(value.toString()));
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
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);
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);
protected void checkForwardedHeaders(EndPoint endpoint, Request request) throws IOException HttpFields httpFields = request.getConnection().getRequestFields();
protected void checkForwardedHeaders(EndPoint endpoint, Request request) throws IOException HttpFields httpFields = request.getConnection().getRequestFields();
protected void checkForwardedHeaders(EndPoint endpoint, Request request) throws IOException HttpFields httpFields = request.getConnection().getRequestFields();