Package net.infopeers.restrant.engine.parser

Examples of net.infopeers.restrant.engine.parser.BasicPatternParser$ContentType


            }
        };

        resources.triggerEvent("providecompletions", new Object[] { input }, callback);

        ContentType contentType = responseRenderer.findContentType(this);

        MarkupWriter writer = factory.newMarkupWriter(contentType);

        generateResponseMarkup(writer, matchesHolder.get());

        return new TextStreamResponse(contentType.getMimeType(), writer.toString());
    }
View Full Code Here


    {
        ComponentResources pageResources = page.getRootComponent().getComponentResources();

        String contentTypeString = metaDataLocator.findMeta(MetaDataConstants.RESPONSE_CONTENT_TYPE, pageResources,
                                                            String.class);
        ContentType contentType = new ContentType(contentTypeString);

        // Make sure thre's always a charset specified.

        String encoding = contentType.getParameter(InternalConstants.CHARSET_CONTENT_TYPE_PARAMETER);

        if (encoding == null)
        {
            encoding = metaDataLocator
                    .findMeta(MetaDataConstants.RESPONSE_ENCODING, pageResources, String.class);
            contentType.setParameter(InternalConstants.CHARSET_CONTENT_TYPE_PARAMETER, encoding);
        }

        return contentType;
    }
View Full Code Here

        RequestPageCache cache = mockRequestPageCache();
        PageContentTypeAnalyzer analyzer = mockPageContentTypeAnalyzer();
        Component component = mockComponent();
        String pageName = "foo/bar";
        Page page = mockPage();
        ContentType contentType = new ContentType("zig/zag");
        ComponentResources resources = mockComponentResources();

        train_getComponentResources(component, resources);
        train_getPageName(resources, pageName);
        train_get(cache, pageName, page);
View Full Code Here

        // If we end up doing a partial render, the page render queue service needs to know the
        // page that will be rendered (for logging purposes, if nothing else).

        queue.setRenderingPage(activePage);

        ContentType contentType = pageContentTypeAnalyzer.findContentType(activePage);

        request.setAttribute(InternalConstants.CONTENT_TYPE_ATTRIBUTE_NAME, contentType);

        Page containerPage = cache.get(parameters.getContainingPageName());
View Full Code Here

        foBuilder.append(root.getChildMarkup().trim());
      }
    });
    pageRenderQueue.addPartialRenderer(fo);

    MarkupWriter markupWriter = markupWriterFactory.newMarkupWriter(new ContentType("text/xml"));
    partialMarkupRenderer.renderMarkup(markupWriter, new JSONObject());
    return foBuilder.toString();
  }
View Full Code Here

    {
        // This is a complex area as we are trying to keep public and private services properly
        // seperated, and trying to keep stateless and stateful (i.e., perthread scope) services
        // seperated. So we inform the stateful queue service what it needs to do here ...

        ContentType pageContentType =
                (ContentType) request.getAttribute(InternalConstants.CONTENT_TYPE_ATTRIBUTE_NAME);

        ContentType contentType = new ContentType(InternalConstants.JSON_MIME_TYPE, outputEncoding);

        MarkupWriter writer = factory.newPartialMarkupWriter(pageContentType);

        JSONObject reply = new JSONObject();

        // ... and here, the pipeline eventually reaches the PRQ to let it render the root render command.

        partialMarkupRenderer.renderMarkup(writer, reply);

        PrintWriter pw = response.getPrintWriter(contentType.toString());

        pw.print(reply);

        pw.flush();
    }
View Full Code Here

        this.outputEncoding = outputEncoding;
    }

    public void processResultValue(JSONArray value) throws IOException
    {
        ContentType contentType = new ContentType(InternalConstants.JSON_MIME_TYPE, outputEncoding);

        PrintWriter pw = response.getPrintWriter(contentType.toString());

        pw.print(value.toString());

        pw.flush();
    }
View Full Code Here

        this.outputEncoding = outputEncoding;
    }

    public void processResultValue(JSONObject value) throws IOException
    {
        ContentType contentType = new ContentType(InternalConstants.JSON_MIME_TYPE, outputEncoding);

        PrintWriter pw = response.getPrintWriter(contentType.toString());

        pw.print(value.toString());

        pw.flush();
    }
View Full Code Here

        RequestPageCache cache = mockRequestPageCache();
        PageContentTypeAnalyzer analyzer = mockPageContentTypeAnalyzer();
        Component component = mockComponent();
        String pageName = "foo/bar";
        Page page = mockPage();
        ContentType contentType = new ContentType("zig/zag");
        ComponentResources resources = mockComponentResources();

        train_getComponentResources(component, resources);
        train_getPageName(resources, pageName);
        train_get(cache, pageName, page);
View Full Code Here

        if (pageActivator.activatePage(activePage.getRootElement().getComponentResources(), parameters
                .getPageActivationContext(), interceptor))
            return;

        ContentType contentType = pageContentTypeAnalyzer.findContentType(activePage);

        request.setAttribute(InternalConstants.CONTENT_TYPE_ATTRIBUTE_NAME, contentType);

        Page containerPage = cache.get(parameters.getContainingPageName());
View Full Code Here

TOP

Related Classes of net.infopeers.restrant.engine.parser.BasicPatternParser$ContentType

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.