Package org.apache.synapse.transport.nhttp.debug

Examples of org.apache.synapse.transport.nhttp.debug.ServerConnectionDebug


            }
           
            NHttpClientConnection conn = ConnectionPool.getConnection(host, port);

            // Ensure MessageContext has a ClientConnectionDebug attached before we start streaming
            ServerConnectionDebug scd = (ServerConnectionDebug)
                msgContext.getProperty(ServerHandler.SERVER_CONNECTION_DEBUG);

            ClientConnectionDebug ccd;
            if (scd != null) {
                ccd = scd.getClientConnectionDebug();
                if (ccd == null) {
                    ccd = new ClientConnectionDebug(scd);
                    scd.setClientConnectionDebug(ccd);
                }
                ccd.recordRequestStartTime(conn, axis2Req);
                msgContext.setProperty(ClientHandler.CLIENT_CONNECTION_DEBUG, ccd);
            }
View Full Code Here


        context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
        context.setAttribute(NhttpConstants.MESSAGE_IN_FLIGHT, "true");

        // prepare to collect debug information
        conn.getContext().setAttribute(
                ServerHandler.SERVER_CONNECTION_DEBUG, new ServerConnectionDebug(conn));

        try {
            InputStream is;
            // Only create an input buffer and ContentInputStream if the request has content
            if (request instanceof HttpEntityEnclosingRequest) {
View Full Code Here

            }
           
            NHttpClientConnection conn = ConnectionPool.getConnection(host, port);

            // Ensure MessageContext has a ClientConnectionDebug attached before we start streaming
            ServerConnectionDebug scd = (ServerConnectionDebug)
                msgContext.getProperty(ServerHandler.SERVER_CONNECTION_DEBUG);

            ClientConnectionDebug ccd;
            if (scd != null) {
                ccd = scd.getClientConnectionDebug();
                if (ccd == null) {
                    ccd = new ClientConnectionDebug(scd);
                    scd.setClientConnectionDebug(ccd);
                }
                ccd.recordRequestStartTime(conn, axis2Req);
                msgContext.setProperty(ClientHandler.CLIENT_CONNECTION_DEBUG, ccd);
            }
View Full Code Here

                    worker.getConn().getContext().getAttribute("http.request");
            req.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE);
        }

        // pass ClientConnectionDebug to the Server side
        ServerConnectionDebug scd = (ServerConnectionDebug)
                worker.getConn().getContext().getAttribute(ServerHandler.SERVER_CONNECTION_DEBUG);
        ClientConnectionDebug ccd = (ClientConnectionDebug)
            msgContext.getProperty(ClientHandler.CLIENT_CONNECTION_DEBUG);

        if (scd != null && ccd != null) {
            scd.setClientConnectionDebug(ccd);
        } else if (scd == null && ccd != null) {
            scd = ccd.getServerConnectionDebug();
            scd.setClientConnectionDebug(ccd);
        }

        if (scd != null) {
            scd.recordResponseStartTime();
        }

        MetricsCollector lstMetrics = worker.getServiceHandler().getMetrics();
        try {
            worker.getServiceHandler().commitResponse(worker.getConn(), response);
            lstMetrics.reportResponseCode(response.getStatusLine().getStatusCode());
            OutputStream out = worker.getOutputStream();

            /*
             * if this is a dummy message to handle http 202 case with non-blocking IO
             * write an empty byte array as body
             */
            if (msgContext.isPropertyTrue(NhttpConstants.SC_ACCEPTED)
                || Boolean.TRUE == noEntityBody) {
                out.write(new byte[0]);
            } else {
                messageFormatter.writeTo(msgContext, format, out, false);
            }
            out.close();
            lstMetrics.incrementMessagesSent();

        } catch (HttpException e) {
            if (lstMetrics != null) {
                lstMetrics.incrementFaultsSending();
            }
            handleException("Unexpected HTTP protocol error sending response to : " +
                worker.getRemoteAddress() + "\n" + scd.dump(), e);
        } catch (ConnectionClosedException e) {
            if (lstMetrics != null) {
                lstMetrics.incrementFaultsSending();
            }
            log.warn("Connection closed by client : "
                    + worker.getRemoteAddress() + "\n" + scd.dump());
        } catch (IllegalStateException e) {
            if (lstMetrics != null) {
                lstMetrics.incrementFaultsSending();
            }
            log.warn("Connection closed by client : "
                    + worker.getRemoteAddress() + "\n" + scd.dump());
        } catch (IOException e) {
            if (lstMetrics != null) {
                lstMetrics.incrementFaultsSending();
            }
            handleException("IO Error sending response message to : " +
                worker.getRemoteAddress() + "\n" + scd.dump(), e);
        } catch (Exception e) {
            if (lstMetrics != null) {
                lstMetrics.incrementFaultsSending();
            }
            handleException("General Error sending response message to : " +
                worker.getRemoteAddress() + "\n" + scd.dump(), e);
        }

        InputStream is = worker.getIs();
        if (is != null) {
            try {
View Full Code Here

            }
           
            NHttpClientConnection conn = ConnectionPool.getConnection(host, port);

            // Ensure MessageContext has a ClientConnectionDebug attached before we start streaming
            ServerConnectionDebug scd = (ServerConnectionDebug)
                msgContext.getProperty(ServerHandler.SERVER_CONNECTION_DEBUG);

            ClientConnectionDebug ccd;
            if (scd != null) {
                ccd = scd.getClientConnectionDebug();
                if (ccd == null) {
                    ccd = new ClientConnectionDebug(scd);
                    scd.setClientConnectionDebug(ccd);
                }
                ccd.recordRequestStartTime(conn, axis2Req);
                msgContext.setProperty(ClientHandler.CLIENT_CONNECTION_DEBUG, ccd);
            }
View Full Code Here

        context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
        context.setAttribute(NhttpConstants.MESSAGE_IN_FLIGHT, "true");

        // prepare to collect debug information
        conn.getContext().setAttribute(
                ServerHandler.SERVER_CONNECTION_DEBUG, new ServerConnectionDebug(conn));

        try {
            InputStream is;
            // Only create an input buffer and ContentInputStream if the request has content
            if (request instanceof HttpEntityEnclosingRequest) {
View Full Code Here

            }
           
            NHttpClientConnection conn = ConnectionPool.getConnection(host, port);

            // Ensure MessageContext has a ClientConnectionDebug attached before we start streaming
            ServerConnectionDebug scd = (ServerConnectionDebug)
                msgContext.getProperty(ServerHandler.SERVER_CONNECTION_DEBUG);

            ClientConnectionDebug ccd;
            if (scd != null) {
                ccd = scd.getClientConnectionDebug();
                if (ccd == null) {
                    ccd = new ClientConnectionDebug(scd);
                    scd.setClientConnectionDebug(ccd);
                }
                ccd.recordRequestStartTime(conn, axis2Req);
                msgContext.setProperty(ClientHandler.CLIENT_CONNECTION_DEBUG, ccd);
            }
View Full Code Here

TOP

Related Classes of org.apache.synapse.transport.nhttp.debug.ServerConnectionDebug

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.