Package org.jboss.soa.esb.http

Examples of org.jboss.soa.esb.http.HttpResponse


            return new String[0] ;
        }
    }

    private void attachResponseDetails(Message message, HttpMethodBase method, int responseCode) {
        HttpResponse response = new HttpResponse(responseCode);
        Properties properties = message.getProperties();

        response.setEncoding(method.getResponseCharSet());
        response.setLength(method.getResponseContentLength());

        Header[] responseHeaders = method.getResponseHeaders();
        for(Header responseHeader : responseHeaders) {
          String name = responseHeader.getName();
          String value = responseHeader.getValue();
            response.addHeader(new org.jboss.soa.esb.http.HttpHeader(name, value));
            // JBESB-2511
            new ResponseHeader(name, value).setPropertyNameThis(properties);
        }
        // JBESB-2761
        if (httpResponseStatusEnabled) {
          ResponseStatus.setHttpProperties(properties, responseCode, method.getStatusLine().getReasonPhrase());
        }
       
        response.setResponse(message);
    }
View Full Code Here


            message.getBody().add(payload);
        }

        message = router.process(message);

        HttpResponse responseInfo = HttpResponse.getResponse(message);
        System.out.println();
        System.out.println("Response Status Code: " + responseInfo.getResponseCode());
        System.out.println("Response payload:\n" + message.getBody().get());
        System.out.println("--------------------------\n");
    }
View Full Code Here

  public Object decompose(Message message, T requestWrapper) throws MessageDeliverException {
        HttpServletRequest request = requestWrapper.getRequest();
        HttpServletResponse  response = requestWrapper.getResponse();
        Integer status = HttpServletResponse.SC_OK;
        String encoding = null;
        HttpResponse responseInfo = org.jboss.soa.esb.http.HttpResponse.getResponse(message);

        if(responseInfo != null) {
            for(org.jboss.soa.esb.http.HttpHeader header : responseInfo.getHttpHeaders()) {
                String headerName = header.getName().toLowerCase();
                if(headerName.equals("content-type")) {
                    response.setContentType(header.getValue());
                } else if(responseHeaderFilterset.contains(headerName)) {
                    // Filter out!!
                } else {
                    response.setHeader(header.getName(), header.getValue());
                }
            }

            if(responseInfo.getContentType() != null) {
                response.setContentType(responseInfo.getContentType());
            }
            encoding = responseInfo.getEncoding();
            status = responseInfo.getResponseCode();
        }

        if(encoding == null) {
            encoding = request.getCharacterEncoding();
            if(encoding == null) {
View Full Code Here

    }


    public Message process(Message message) throws Exception {

        HttpResponse httpResponse = (HttpResponse) message.getBody().get(HttpResponse.RESPONSE_KEY);

        System.out.println("=========== Client Response: ===================================");
        System.out.println("Message Payload:");
        System.out.println("\t[" + message.getBody().get() + "]");

        System.out.println();
        System.out.println("Http Response:");
        System.out.println("\tCode: " + httpResponse.getResponseCode());
        System.out.println("\tLength: " + httpResponse.getLength());
        System.out.println("\tEncoding: " + httpResponse.getEncoding());

        System.out.println("\tHeaders:");
        List<HttpHeader> headers = httpResponse.getHttpHeaders();
        for (HttpHeader header : headers) {
            System.out.println("\t\t" + header.getName() + ": " + header.getValue());
        }

        System.out.println("================================================================");
View Full Code Here

TOP

Related Classes of org.jboss.soa.esb.http.HttpResponse

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.