Search in sources :

Example 6 with HttpConnection

use of org.eclipse.jetty.server.HttpConnection in project gerrit by GerritCodeReview.

the class HiddenErrorHandler method handle.

@Override
public void handle(String target, Request baseRequest, HttpServletRequest req, HttpServletResponse res) throws IOException {
    HttpConnection conn = HttpConnection.getCurrentConnection();
    baseRequest.setHandled(true);
    try {
        log(req);
    } finally {
        reply(conn, res);
    }
}
Also used : HttpConnection(org.eclipse.jetty.server.HttpConnection)

Example 7 with HttpConnection

use of org.eclipse.jetty.server.HttpConnection in project zm-mailbox by Zimbra.

the class JettyUtil method setIdleTimeout.

public static void setIdleTimeout(long timeout, HttpServletRequest request) {
    if (request != null) {
        Object attr = request.getAttribute("org.eclipse.jetty.server.HttpConnection");
        if (attr instanceof HttpConnection) {
            @SuppressWarnings("resource") HttpConnection conn = (HttpConnection) attr;
            EndPoint ep = conn.getEndPoint();
            if (ep != null) {
                ep.setIdleTimeout(timeout);
            } else {
                ZimbraLog.misc.warn("null endpoint setting Jetty timeout?", new Exception());
            }
        } else {
            //this won't work for SPDY connections, so we'll have to consider this further once we enable it.
            ZimbraLog.misc.warn("got [%s] not instanceof org.eclipse.jetty.server.HttpConnection", attr, new Exception());
        }
    } else {
        ZimbraLog.misc.warn("cannot set timeout for null request", new Exception());
    }
}
Also used : HttpConnection(org.eclipse.jetty.server.HttpConnection) EndPoint(org.eclipse.jetty.io.EndPoint)

Aggregations

HttpConnection (org.eclipse.jetty.server.HttpConnection)7 EndPoint (org.eclipse.jetty.io.EndPoint)5 IOException (java.io.IOException)3 ByteBuffer (java.nio.ByteBuffer)2 SocketChannel (java.nio.channels.SocketChannel)2 ServletException (javax.servlet.ServletException)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 SelectChannelEndPoint (org.eclipse.jetty.io.SelectChannelEndPoint)2 SocketChannelEndPoint (org.eclipse.jetty.io.SocketChannelEndPoint)2 Connector (org.eclipse.jetty.server.Connector)2 HttpConnectionFactory (org.eclipse.jetty.server.HttpConnectionFactory)2 ServerConnector (org.eclipse.jetty.server.ServerConnector)2 BufferedReader (java.io.BufferedReader)1 EOFException (java.io.EOFException)1 File (java.io.File)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 OutputStream (java.io.OutputStream)1 Socket (java.net.Socket)1