Package com.volantis.mcs.servlet

Examples of com.volantis.mcs.servlet.MarinerServletRequestContext


        MarinerServletApplication.getInstance(this.getServletContext());

        // Take the basic cached XML and process it through MCS and then
        // write it to the resonse stream.  Generate xdime based on device
        // etc. available in request.
        MarinerServletRequestContext mcsContext =
                new MarinerServletRequestContext(this.getServletContext(),
                                                 request,
                                                 response);

        // The processed page will be written to the response, so
        // we don't need to do anything further.
View Full Code Here


    public int doStartTag() throws JspException {
        // Create and initialise a MarinerJspRequestContext for the current
        // request.
        try {
            ServletRequest request = pageContext.getRequest();
            context = new MarinerServletRequestContext(
                    pageContext.getServletContext(), request,
                    pageContext.getResponse());

            // Store the context in the PageContext so it can be accessed from
            // inside the page.
View Full Code Here

                            HttpServletResponse response,
                            Exception except) {

        // Try to send the response as XDIME
        try {
            MarinerServletRequestContext msrc =
                    new MarinerServletRequestContext(
                            getServletConfig().getServletContext(),
                            request, response);

            StringWriter writer = new StringWriter();
            writer.write(XDIME_MESSAGE_START);
View Full Code Here

    private void writeMesg(HttpServletRequest request,
                           HttpServletResponse response,
                           String mesg) {
        // Try to send the response as XDIME
        try {
            MarinerServletRequestContext msrc =
                    new MarinerServletRequestContext(
                            getServletConfig().getServletContext(), request,
                            response);

            MarlinSAXHelper.parse(msrc,
                                  MarlinSAXHelper.getDefaultErrorHandler(),
View Full Code Here



        try {
           
            MarinerServletRequestContext servletRequestContext =
                new MarinerServletRequestContext(
                    filterConfig.getServletContext(),
                    requestWrapper,
                    response);
           
            // 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 xmlReader = MarlinSAXHelper.getXMLReader(servletRequestContext, null);

            // todo: The following baseURI initialisation code should be
            // unnecessary if the system id is properly set on the InputSource.
            // However, this needs to be tested properly before changing it as
            // there were some problems with the pipeline.
            EnvironmentContext environmentContext =
                ContextInternals.getEnvironmentContext(servletRequestContext);

            // 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 = filterConfig.getServletContext().getResource("/");
                 String baseURIAsString = baseURI.toExternalForm();
                 if (logger.isDebugEnabled()) {
                     logger.debug("Setting Base URI " + baseURIAsString);
                 }
                 pipelineContext.pushBaseURI(baseURIAsString);
             } catch (MalformedURLException e) {
                 throw new ServletException(e);
             }

            // Treat the response wrapper as an InputSource for the XML parser.
            Reader reader = responseWrapper.getReader();
            InputSource inputSource = new InputSource(reader);
            //inputSource.setSystemId(baseURIAsString);

            // Parse the response and process it as XDIME.
            xmlReader.parse(inputSource);
               
            servletRequestContext.release();
       } catch (MarinerContextException e) {
            logger.error("portal-filter-exception",
                    new Object[]{responseWrapper.getContentsAsString()});
            logger.error("mariner-context-exception", e);
            throw new ServletException(
View Full Code Here

        context.setProtocol(protocol);
    }

    public static MarinerRequestContext initialiseMarinerRequestContext(
            ExpectationBuilder expectations) {
        MarinerServletRequestContext requestContext;
        HttpServletRequest servletRequest = new MockHTTPServletRequest();

        requestContext = new MockMarinerServletRequestContext(servletRequest, new MockHTTPServletResponse());

        Project project = new RuntimeProjectMock("projectMock", expectations);
View Full Code Here

    protected void process( HttpServletRequest request,
                            HttpServletResponse response)
        throws ServletException, IOException {
           
        Volantis bean = getVolantisBean();
        MarinerServletRequestContext context =
                                getMarinerRequestContext( request, response );
                               
        String dev = context.getDeviceName();
           
        response.setContentType( "text/plain" );
        PrintWriter out = response.getWriter();
        if( dev == null ) {
            out.print( "Device Not Found" );
View Full Code Here

            throws Exception {
        final HttpServletRequestMock servletRequest =
                new HttpServletRequestMock();
        final HttpServletResponse servletResponse =
                new HttpServletResponseStub();
        return new MarinerServletRequestContext(servletContext,
                servletRequest,
                servletResponse,
                initialEnvContext);
    }
View Full Code Here

        // =====================================================================
        //   Test Expectations
        // =====================================================================

        MarinerRequestContext requestContext = new MarinerServletRequestContext(
                servletApplication.getServletContext(),
                requestMock, responseMock);

        httpSessionMock.expects
                .getAttribute(MarinerServletSessionContext.class.getName())
View Full Code Here

   * @return a MarinerURL object
   */
  public MarinerURL mapToExternalURL(MarinerRequestContext context,
                                     MarinerURL url)
  {           
      MarinerServletRequestContext servletContext = (MarinerServletRequestContext)context;
      HttpServletRequest request = servletContext.getHttpRequest();
      //HttpServletResponse response = servletContext.getHttpResponse();         
           
      /* The are two ways to get the original request URI.
       *
       * 1a. Get the Portal Application Framework environment via a non-published
View Full Code Here

TOP

Related Classes of com.volantis.mcs.servlet.MarinerServletRequestContext

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.