Java 类org.eclipse.jetty.server.AbstractHttpConnection 实例源码

项目:BeyondUPnP    文件:AndroidJettyServletContainer.java   
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;
    }
}
项目:DroidDLNA    文件:JettyServletContainer.java   
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;
    }
}
项目:elasticsearch-jetty-cat    文件:JettyHttpServerErrorHandler.java   
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException {
    AbstractHttpConnection connection = AbstractHttpConnection.getCurrentConnection();
    connection.getRequest().setHandled(true);
    response.setContentType(MimeTypes.TEXT_PLAIN_8859_1);
    ByteArrayISO8859Writer writer= new ByteArrayISO8859Writer(4096);
    writer.write(request.getAttribute(Dispatcher.ERROR_STATUS_CODE) + " " +
                 request.getAttribute(Dispatcher.ERROR_MESSAGE) + " " +
                 request.getAttribute(Dispatcher.ERROR_REQUEST_URI));
    writer.flush();
    response.setContentLength(writer.size());
    writer.writeTo(response.getOutputStream());
    writer.destroy();
}
项目:pinpoint    文件:Jetty8xServerHandleInterceptor.java   
@Override
protected Request getRequest(final Object[] args) {
    if (args == null || args.length < 1) {
        return null;
    }

    if (args[0] instanceof AbstractHttpConnection) {
        try {
            AbstractHttpConnection connection = (AbstractHttpConnection) args[0];
            return connection.getRequest();
        } catch (Throwable ignored) {
        }
    }
    return null;
}