Package org.switchyard.component.http.composer

Examples of org.switchyard.component.http.composer.HttpRequestBindingData


    private static class StandaloneHandler implements HttpHandler {

        public void handle(HttpExchange exchange) {
            try {
                HttpRequestBindingData httpRequest = new HttpRequestBindingData();
                httpRequest.setBodyFromStream(exchange.getRequestBody());
                Assert.assertEquals(INPUT, httpRequest.getBodyAsString());
                httpRequest.setBody(OUTPUT);
                exchange.sendResponseHeaders(200, httpRequest.getBodyBytes().available());
                httpRequest.writeBodyToStream(exchange.getResponseBody());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
View Full Code Here


                httpclient.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF, authpref);
            }
            if (_proxyHost != null) {
                httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, _proxyHost);
            }
            HttpBindingData httpRequest = _messageComposer.decompose(exchange, new HttpRequestBindingData());
            HttpRequestBase request = null;
            if (_httpMethod.equals(HTTP_GET)) {
                request = new HttpGet(_baseAddress);
            } else if (_httpMethod.equals(HTTP_POST)) {
                request = new HttpPost(_baseAddress);
View Full Code Here

     * @throws ServletException if any Servlet exception
     * @throws IOException if the streams could not be written or read
     */
    public void handle(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

            HttpRequestBindingData httpRequest = new HttpRequestBindingData();
            try {
                httpRequest.setContentType(new ContentType(request.getContentType()));
                httpRequest.setBodyFromStream(request.getInputStream());
                for (Enumeration<String> headerNames = request.getHeaderNames(); headerNames.hasMoreElements();) {
                    String name = headerNames.nextElement();
                    for (Enumeration<String> values = request.getHeaders(name); values.hasMoreElements();) {
                        String value = values.nextElement();
                        httpRequest.addHeader(name, value);
                    }
                }
                httpRequest.setRequestInfo(getRequestInfo(request));
            } catch (IOException e) {
                response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                HttpLogger.ROOT_LOGGER.unexpectedExceptionWhileReadingRequest(e);
            }
            ClassLoader origCl = null;
View Full Code Here

            _handler = handler;
        }

        public void handle(HttpExchange exchange) {
            try {
                HttpRequestBindingData httpRequest = new HttpRequestBindingData();
                byte[] responseBody = null;
                try {
                    String contentTypeStr = exchange.getRequestHeaders().getFirst(CONTENT_TYPE);
                    ContentType contentType = new ContentType(contentTypeStr);
                    httpRequest.setContentType(contentType);
                    httpRequest.setBodyFromStream(exchange.getRequestBody());
                    httpRequest.setHeaders(exchange.getRequestHeaders());
                    httpRequest.setRequestInfo(getRequestInfo(exchange, contentType));
                } catch (IOException e) {
                    HttpLogger.ROOT_LOGGER.unexpectedExceptionWhileReadingRequest(e);
                }
                HttpResponseBindingData httpResponse = _handler.invoke(httpRequest);
                try {
View Full Code Here

TOP

Related Classes of org.switchyard.component.http.composer.HttpRequestBindingData

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.