Package org.apache.http

Examples of org.apache.http.HttpInetConnection


        }
        msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, headers);

        // find the remote party IP address and set it to the message context
        if (conn instanceof HttpInetConnection) {
            HttpInetConnection inetConn = (HttpInetConnection) conn;
            InetAddress remoteAddr = inetConn.getRemoteAddress();
            if (remoteAddr != null) {
                msgContext.setProperty(MessageContext.REMOTE_ADDR, remoteAddr.getHostAddress());
                msgContext.setProperty(NhttpConstants.REMOTE_HOST, remoteAddr.getHostName());
            }
        }
View Full Code Here


        public void handle(
                final HttpRequest request,
                final HttpResponse response,
                final HttpContext context) throws HttpException, IOException {
            final HttpInetConnection conn = (HttpInetConnection) context.getAttribute(HttpCoreContext.HTTP_CONNECTION);
            final String localhost = conn.getLocalAddress().getHostName();
            final int port = conn.getLocalPort();
            final String uri = request.getRequestLine().getUri();
            if (uri.equals("/oldlocation/")) {
                response.setStatusCode(this.statuscode);
                response.addHeader(new BasicHeader("Location",
                        "http://" + localhost + ":" + port + "/newlocation/"));
View Full Code Here

   
    public void handleRequest(final AxisHttpConnection conn, final HttpContext context)
            throws IOException, HttpException {
       
        if (conn instanceof HttpInetConnection) {
            HttpInetConnection inetconn = (HttpInetConnection) conn;
            this.msgContext.setProperty(MessageContext.REMOTE_ADDR,
                    inetconn.getRemoteAddress().getHostAddress());
            this.msgContext.setProperty(MessageContext.TRANSPORT_ADDR,
                    inetconn.getLocalAddress().getHostAddress());

            if (LOG.isDebugEnabled()) {
                LOG.debug("Remote address of the connection : " +
                        inetconn.getRemoteAddress().getHostAddress());
            }
        }
       
        HttpResponse response;
        try {
View Full Code Here

TOP

Related Classes of org.apache.http.HttpInetConnection

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.