Package com.volantis.mcs.internal

Examples of com.volantis.mcs.internal.InternalResponse


        try {
            InternalConfig internalConfig = new InternalConfig();
            InternalRequest internalRequest = new InternalRequest( deviceName,
                                                                   "mps" );
            InternalResponse internalResponse = new InternalResponse();

            MarinerRequestContext requestContext =
                    new MarinerInternalRequestContext( internalConfig,
                            internalRequest,
                            internalResponse,
                            null );


            // set character encoding if not null
            if (characterEncoding != null) {
                requestContext.setCharacterEncoding(characterEncoding);
            }


            // Parse the contents of the response as Marlin markup.
            // The processed page will be written to the response, so
            // we don't need to do anything further.
            XMLReader reader =
                    MarlinSAXHelper.getXMLReader( requestContext, null );

            EnvironmentContext environmentContext =
                    ContextInternals.getEnvironmentContext( requestContext );

            // The getXMLReader() call above will set up the pipelineContext in
            // the environmentContext.  See MarlinSAXHelper.setPipelineContext()
            XMLPipelineContext pipelineContext =
                    environmentContext.getPipelineContext();
            // set the Base URI in the pipeline's context
            try {
                URL baseURI = new URL( baseUrl );
                if( logger.isDebugEnabled() ) {
                    logger.debug( "Setting Base URI "
                                        + baseURI.toExternalForm() );
                }
                pipelineContext.pushBaseURI( baseURI.toExternalForm() );
            } catch( MalformedURLException e ) {
                throw new MessageException( e );
            }
            reader.parse( new InputSource( new StringReader( messageXML ) ) );

            MPSApplicationContext applicationContext =
                 (MPSApplicationContext)ContextInternals.getApplicationContext(
                                                               requestContext );

            applicationContext.getAssetMap();

            // set charset type for content
            String contentType = getContentTypeHeader(
                                        internalResponse.getContentType(),
                                        characterEncoding);


            rawMessage = new ProtocolIndependentMessage(
                    internalResponse.getResponseAsString(),
                    contentType,
                    applicationContext.getAssetMap(),
                    characterEncoding);
            rawMessage.setBaseURL( new URL( baseUrl ) );
            rawMessage.setMaxFileSize( applicationContext.getMaxFileSize() );
View Full Code Here


    protected MarinerRequestContext
            createInitialRequestContext(EnvironmentContext initialEnvContext)
            throws Exception {
        final InternalRequest internalRequest =
                new InternalRequest("myDevice", "myApp");
        final InternalResponse internalResponse = new InternalResponse();

        return new MarinerInternalRequestContext(
                null,
                internalRequest,
                internalResponse,
View Full Code Here

TOP

Related Classes of com.volantis.mcs.internal.InternalResponse

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.