Package com.volantis.mcs.utilities

Examples of com.volantis.mcs.utilities.HttpResponseHeader


                requestHeaders.add( "Accept-Charset: " + characterEncoding );
            }

            HttpClient client = new HttpClient( messageURL, requestHeaders );

            HttpResponseHeader responseHeaders = client.getResponseHeaders();

            if( responseHeaders.getErrorCode() == 200 ) {

                // read in message from URL
                InputStreamReader isr =
                        (InputStreamReader)client.getInputStreamReader();
                String encoding = isr.getEncoding();

                StringBuffer bodyContent = new StringBuffer();

                char[] line = new char[1024];
                int read = isr.read(line, 0, line.length);
                while( read > -1 ) {
                    bodyContent.append( line, 0, read );
                    read = isr.read(line, 0, line.length);
                }
                String msg = bodyContent.toString();

                // if a charset has been specified we need to convert from
                // the InputStreamReader charset into the specified
                // charset
                if (characterEncoding != null) {
                    msg = ContentUtilities.convertEncoding(msg,
                                                           encoding,
                                                           characterEncoding);
                }
                String contentType = getContentTypeHeader(
                        responseHeaders.getHeader("Content-Type"),
                        characterEncoding);
                rawMessage = new ProtocolIndependentMessage(
                                        msg,
                                        contentType,
                                        getAssetMapFromHeaders(responseHeaders),
                                        characterEncoding);
                rawMessage.setBaseURL(messageURL);
                rawMessage.setMaxFileSize(
                                getMaxFileSizeFromHeaders( responseHeaders ) );
                rawMessage.setMaxMMSize(
                                getMaxMMSizeFromHeaders( responseHeaders ) );
            } else {
                throw new MessageException(
                        localizer.format( "mcs-server-unknown-error",
                        new Integer( responseHeaders.getErrorCode() ) ) );
            }
        } catch( Exception e ) {
            throw new MessageException( e );
        }
        return rawMessage;
View Full Code Here


                                            passTable, DARGS, formName);
   
        // Get ATG's response
        BufferedReader responseReader =
                                   (BufferedReader)postClient.getReader();       
        HttpResponseHeader responseHeader =
                                    new HttpResponseHeader(responseReader);
           
        // Dispatch the response to the user's browser
        servletUtils.dispatchUserResponse(request, response,
                                            responseReader, responseHeader);
    }
View Full Code Here

                    sendPostData(request, marinerTargetURL, formData);
       
            // Get ATG's response
            BufferedReader responseReader =
                    (BufferedReader)postClient.getReader();
            HttpResponseHeader responseHeader =
                    new HttpResponseHeader(responseReader);
               
            // Dispatch the response to the user's browser
            servletUtils.dispatchUserResponse(request, response,
                    responseReader, responseHeader);
           
View Full Code Here

TOP

Related Classes of com.volantis.mcs.utilities.HttpResponseHeader

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.