Package com.volantis.mcs.context

Examples of com.volantis.mcs.context.MarinerPageContext


   * @param requestContext the MarinerRequestContext
   * @return the Volantis bean
   */
  private Volantis getVolantisBean(MarinerRequestContext requestContext) {
    if(volantisBean == null) {
      MarinerPageContext marinerPageContext =
  ContextInternals.getMarinerPageContext(requestContext);
      volantisBean = marinerPageContext.getVolantisBean();
    }
    return volantisBean;
  }
View Full Code Here


                            + " from " + request);
                }
            }

            // Get a MarinerPageContext object.
            final MarinerPageContext context;

            if (enclosingRequestContext != null) {
                context =
                        ContextInternals.getMarinerPageContext(
                                enclosingRequestContext);
            } else {
                context = volantisBean.createMarinerPageContext();
            }

            // Create and initialise the EnvironmentContext, do this after the
            // MarinerPageContext has been allocated but before it has been
            // initialised as this is needed during the initialisation.
            environmentContext.initialise(context);
            environmentContext.initialiseSession();

            ExpressionContext exprContext =
                    environmentContext.getExpressionContext();

            // If there is an expression context then it must have been associated
            // with an enclosing request context since we are still initialising
            // this instance of MarinerServletRequestContext. We now must associate
            // the expression context with this MarinerServletRequestContext.
            //
            // An expression context can be associated with more than one request
            // context, although not concurrently. When the request context is no
            // longer needed, the expression context (if any) should be reset to
            // the enclosing request context.
            if (exprContext == null) {
                ExpressionSupport.createExpressionEnv(this,
                        volantisBean, environmentContext,
                        context.getDevicePolicyAccessor());
            } else {
                exprContext.setProperty(MarinerRequestContext.class, this,
                        false);
            }

            ContextInternals.setEnvironmentContext(this, environmentContext);

            if (enclosingRequestContext != null) {
                // Copy our application context, as nothing has changed from an
                // application point of view.
                appContext =
                        ContextInternals.getApplicationContext(
                                enclosingRequestContext);
                if (logger.isDebugEnabled()) {
                    logger.debug("Retrieved applicationContext " + appContext);
                }
            } else {
                // We are the top level request so initialise an application context
                // for this application
                appContext = acf.createApplicationContext(this);
                if (logger.isDebugEnabled()) {
                    logger.debug(
                            "Created new applicationContext " + appContext);
                }
            }

            // Store the application context away as it is required to
            // initialise the page context.
            ContextInternals.setApplicationContext(this, appContext);

            // Save the reference away immediately so if a problem occurs during the
            // initialisation it is cleaned up properly.
            ContextInternals.setMarinerPageContext(this, context);

            // Initialise the page context.
            if (enclosingRequestContext == null) {
                context.initialisePage(volantisBean, this,
                        enclosingRequestContext,
                        requestURL, requestHeaders);
            } else {
                // Make this the current request context
                context.pushRequestContext(this);
            }


            // Select the best charset that we could find from the accept headers.
            EncodingManager encodingManager = appContext.getEncodingManager();
            AcceptCharsetSelector selector = new AcceptCharsetSelector(
                    encodingManager);
            HttpHeaders rHeaders = HttpFactory.getDefaultInstance()
                    .createHTTPHeaders();
            String charset = selector.selectCharset(rHeaders,
                (DefaultDevice) context.getDevice().getDevice());
            if (charset != null) {
                // Use the selected charset.
                // This should always succeed since we already validated it.
                setCharacterEncoding(charset);
            } else {
View Full Code Here

                            + " from " + request);
                }
            }

            // Get a MarinerPageContext object.
            final MarinerPageContext context;

            if (enclosingRequestContext != null) {
                context =
                        ContextInternals.getMarinerPageContext(
                                enclosingRequestContext);
            } else {
                context = volantisBean.createMarinerPageContext();
            }

            // Create and initialise the EnvironmentContext, do this after the
            // MarinerPageContext has been allocated but before it has been
            // initialised as this is needed during the initialisation.
            environmentContext.initialise(context);
            environmentContext.initialiseSession();

            ExpressionContext exprContext =
                    environmentContext.getExpressionContext();

            // If there is an expression context then it must have been associated
            // with an enclosing request context since we are still initialising
            // this instance of MarinerServletRequestContext. We now must associate
            // the expression context with this MarinerServletRequestContext.
            //
            // An expression context can be associated with more than one request
            // context, although not concurrently. When the request context is no
            // longer needed, the expression context (if any) should be reset to
            // the enclosing request context.
            if (exprContext == null) {
                ExpressionSupport.createExpressionEnv(this,
                        volantisBean, environmentContext,
                        context.getDevicePolicyAccessor());
            } else {
                exprContext.setProperty(MarinerRequestContext.class, this,
                        false);
            }

            ContextInternals.setEnvironmentContext(this, environmentContext);

            if (enclosingRequestContext != null) {
                // Copy our application context, as nothing has changed from an
                // application point of view.
                appContext =
                        ContextInternals.getApplicationContext(
                                enclosingRequestContext);
                if (logger.isDebugEnabled()) {
                    logger.debug("Retrieved applicationContext " + appContext);
                }
            } else {
                // We are the top level request so initialise an application context
                // for this application
                appContext = acf.createApplicationContext(this);
                if (logger.isDebugEnabled()) {
                    logger.debug(
                            "Created new applicationContext " + appContext);
                }
            }

            // Store the application context away as it is required to
            // initialise the page context.
            ContextInternals.setApplicationContext(this, appContext);

            // Save the reference away immediately so if a problem occurs during the
            // initialisation it is cleaned up properly.
            ContextInternals.setMarinerPageContext(this, context);

            // Initialise the page context.
            if (enclosingRequestContext == null) {
                context.initialisePage(volantisBean, this,
                        enclosingRequestContext,
                        requestURL, requestHeaders);
            } else {
                // Make this the current request context
                context.pushRequestContext(this);
            }


            // Select the best charset that we could find from the accept headers.
            EncodingManager encodingManager = appContext.getEncodingManager();
            AcceptCharsetSelector selector = new AcceptCharsetSelector(
                    encodingManager);
            HttpHeaders rHeaders = HttpServletFactory.
                    getDefaultInstance().getHTTPHeaders(request);
            String charset = selector.selectCharset(rHeaders,
                (DefaultDevice) context.getDevice().getDevice());
            if (charset != null) {
                // Use the selected charset.
                // This should always succeed since we already validated it.
                setCharacterEncoding(charset);
            } else {
View Full Code Here

   * @param requestContext the MarinerRequestContext
   * @return the Volantis bean
   */
  private Volantis getVolantisBean(MarinerRequestContext requestContext) {
    if(volantisBean == null) {
      MarinerPageContext marinerPageContext =
  ContextInternals.getMarinerPageContext(requestContext);
      volantisBean = marinerPageContext.getVolantisBean();
    }
    return volantisBean;
  }
View Full Code Here

    public int elementStart(MarinerRequestContext context,
                            PAPIAttributes mcsiAttributes)
            throws PAPIException {

        JdbcPoliciesAttributes attrs = (JdbcPoliciesAttributes) mcsiAttributes;
        MarinerPageContext pageContext =
                ContextInternals.getMarinerPageContext(context);

        LocalRepository jdbcRepository =
                pageContext.getVolantisBean().getJDBCRepository();

        InternalProjectFactory factory =
                InternalProjectFactory.getInternalInstance();

        policySource = factory.createJDBCPolicySource(jdbcRepository,
                attrs.getName());

        parent = findParent(pageContext, elementName);

        pageContext.pushMCSIElement(this);

        return PROCESS_ELEMENT_BODY;
    }
View Full Code Here

            throws PAPIException {
        if (parent != null) {
            parent.setPolicySource(policySource);
            // only pop ourselves of the stack if there was a parent.  if there
            // wasn't we would not have pushed ourselves onto the stack.
            MarinerPageContext pageContext =
                    ContextInternals.getMarinerPageContext(context);
            pageContext.popMCSIElement();
        }

        return CONTINUE_PROCESSING;
    }
View Full Code Here

    public int elementStart(MarinerRequestContext context,
                            PAPIAttributes mcsiAttributes)
            throws PAPIException {

        AssetsAttributes attrs = (AssetsAttributes) mcsiAttributes;
        MarinerPageContext pageContext =
                ContextInternals.getMarinerPageContext(context);

        assetsConfiguration = initialiseAssetConfiguration(attrs);

        parent = findParent(pageContext, elementName);

        pageContext.pushMCSIElement(this);

        return PROCESS_ELEMENT_BODY;
    }
View Full Code Here

            throws PAPIException {
        if (parent != null) {
            parent.setAssetsConfiguration(assetsConfiguration);
            // only pop ourselves of the stack if there was a parent.  if there
            // wasn't we would not have pushed ourselves onto the stack.
            MarinerPageContext pageContext =
                    ContextInternals.getMarinerPageContext(context);
            pageContext.popMCSIElement();
        }

        return CONTINUE_PROCESSING;
    }
View Full Code Here

    // Javadoc inherited from MCSIElement interface
    public int elementStart(MarinerRequestContext context,
                            PAPIAttributes mcsiAttributes)
            throws PAPIException {

        MarinerPageContext pageContext =
                ContextInternals.getMarinerPageContext(context);

        parent = findParent(pageContext, elementName);

        AssetsConfiguration assetsConfiguration = parent.getAssetsConfiguration();
        String generatedResourceBaseDir = null;
        GeneratedResourcesConfiguration generatedResourcesConfiguration =
                parent.getGeneratedResourcesConfiguration();
        if (generatedResourcesConfiguration != null) {
            generatedResourceBaseDir =
                    generatedResourcesConfiguration.getBaseDir();
        }
        policySource = parent.getPolicySource();
        CacheControlConstraintsMap cacheControlConstraintsMap =
                pageContext.getVolantisBean().getProjectManager().getDefaultProject().getCacheControlConstraintsMap();
        DynamicProjectKey key = new DynamicProjectKey(policySource,
                assetsConfiguration, generatedResourceBaseDir, cacheControlConstraintsMap);

        project = pageContext.getVolantisBean().getDynamicProject(key);
        if (logger.isDebugEnabled()) {
            logger.debug("Setting project to : PolicySource [" +
                ((policySource != null) ? policySource.toString() : "null") +
                "," +
                ((assetsConfiguration != null)
       ? assetsConfiguration.getBaseUrl() : "null") +
                "," +         
                ((generatedResourcesConfiguration != null)
       ? generatedResourcesConfiguration.getBaseDir()
       : "null") +
                "]");
        }
        pageContext.pushMCSIElement(this);
        context.pushProject(project);
        return PROCESS_ELEMENT_BODY;
    }
View Full Code Here

            throws PAPIException {
        if (parent != null) {
            // only pop ourselves of the stack if there was a parent.  if there
            // wasn't we would not have pushed ourselves onto the stack.
            context.popProject(project);
            MarinerPageContext pageContext =
                    ContextInternals.getMarinerPageContext(context);
            pageContext.popMCSIElement();
        }

        return CONTINUE_PROCESSING;
    }
View Full Code Here

TOP

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

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.