Package com.volantis.mcs.context

Examples of com.volantis.mcs.context.MarinerRequestContext


            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() );
            rawMessage.setMaxMMSize( applicationContext.getMaxMMSize() );

            requestContext.release();
        } catch (SAXException se) {
            Exception cause = se.getException();
            // Check the root cause of the SAXException, as it may not be
            // logged correctly.
            if (cause != null) {
View Full Code Here


     *         the current request.
     */
    public static MarinerRequestContext getCurrent(InternalRequest request) {
        // Look and see if the current request has had a
        // MarinerServletRequestContext created for it.
        MarinerRequestContext context = (MarinerRequestContext)
                request.getAttribute(REQUEST_ATTRIBUTE_NAME);

        if (logger.isDebugEnabled()) {
            logger.debug("Retrieved reference to " + context
                    + " from " + request);
View Full Code Here

    public static
    MarinerRequestContext getCurrent(ServletRequest request) {

        // Look and see if the current request has had a
        // MarinerServletRequestContext created for it.
        MarinerRequestContext context = (MarinerRequestContext)
                request.getAttribute(REQUEST_ATTRIBUTE_NAME);

        if (logger.isDebugEnabled()) {
            logger.debug("Retrieved reference to " + context
                    + " from " + request);
View Full Code Here

        RuntimeDeviceLayout runtimeDeviceLayout1 =
                RuntimeDeviceLayoutTestHelper.activate(canvasLayout);
        RuntimeDeviceLayout runtimeDeviceLayout =
                runtimeDeviceLayout1;

        MarinerRequestContext requestContext = new TestMarinerRequestContext();
        context = new TestMarinerPageContext();
        context.pushRequestContext(requestContext);
        context.setDeviceLayout(runtimeDeviceLayout);

        DeviceLayoutContext deviceContext = new TestDeviceLayoutContext();
View Full Code Here

     * expect there to be no containing tag or expect a <tr> container.
     */
    public void testSpatialFormatIteratorRowContainingTag() throws Exception {
        privateSetUp();

        MarinerRequestContext requestContext
                = new TestMarinerRequestContext();
        TestMarinerPageContext context = new TestMarinerPageContext();
        context.pushRequestContext(requestContext);
        protocol.setMarinerPageContext(context);

View Full Code Here

        // Activate the device layout.
        RuntimeDeviceLayout runtimeDeviceLayout =
                RuntimeDeviceLayoutTestHelper.activate(canvasLayout);

        MarinerRequestContext requestContext = new TestMarinerRequestContext();
        context = new TestMarinerPageContext();
        context.pushRequestContext(requestContext);
        context.setDeviceLayout(runtimeDeviceLayout);

        DeviceLayoutContext deviceContext = new DeviceLayoutContext();
View Full Code Here

        attributes.setName("testName");
        attributes.setMultiple(multipleSelect);
        attributes.setTitle("title");

        MarinerRequestContext requestContext = new TestMarinerRequestContext();

        TestMarinerPageContext context =
            (TestMarinerPageContext)protocol.getMarinerPageContext();

        context.pushRequestContext(requestContext);
View Full Code Here

    // javadoc inherited
    protected AbstractMenuRenderer createTestableMenuRenderer() {

        // create and initialise the MarinerPageContext
        TestMarinerPageContext pageContext = new TestMarinerPageContext();
        MarinerRequestContext requestContext = new TestMarinerRequestContext();

        pageContext.pushRequestContext(requestContext);
        ContextInternals.setMarinerPageContext(requestContext, pageContext);
        PaneInstance paneInstance = new TestPaneInstance() {
            public OutputBuffer getCurrentBuffer() {
View Full Code Here

     * <tr> tags for this protocol.
     */
    public void testSpatialFormatIteratorRowContainingTag() throws Exception {
        privateSetUp();

        MarinerRequestContext requestContext
                = new TestMarinerRequestContext();
        TestMarinerPageContext context = new TestMarinerPageContext();
        context.pushRequestContext(requestContext);
        protocol.setMarinerPageContext(context);

View Full Code Here

        RuntimeDeviceLayout runtimeDeviceLayout1 =
                RuntimeDeviceLayoutTestHelper.activate(canvasLayout);
        RuntimeDeviceLayout runtimeDeviceLayout =
                runtimeDeviceLayout1;

        MarinerRequestContext requestContext = new TestMarinerRequestContext();
        context = new TestMarinerPageContext();
        context.pushRequestContext(requestContext);
        context.setDeviceLayout(runtimeDeviceLayout);

        DeviceLayoutContext deviceContext = new TestDeviceLayoutContext();
View Full Code Here

TOP

Related Classes of com.volantis.mcs.context.MarinerRequestContext

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.