Examples of ContentType


Examples of org.apache.poi.openxml4j.opc.internal.ContentType

   * @param marshaller
   *            The marshaller to register with the specified content type.
   */
  public void addMarshaller(String contentType, PartMarshaller marshaller) {
    try {
      partMarshallers.put(new ContentType(contentType), marshaller);
    } catch (InvalidFormatException e) {
      logger.log(POILogger.WARN, "The specified content type is not valid: '"
          + e.getMessage() + "'. The marshaller will not be added !");
    }
  }
View Full Code Here

Examples of org.apache.poi.openxml4j.opc.internal.ContentType

   *            The unmarshaller to register with the specified content type.
   */
  public void addUnmarshaller(String contentType,
      PartUnmarshaller unmarshaller) {
    try {
      partUnmarshallers.put(new ContentType(contentType), unmarshaller);
    } catch (InvalidFormatException e) {
      logger.log(POILogger.WARN, "The specified content type is not valid: '"
          + e.getMessage()
          + "'. The unmarshaller will not be added !");
    }
View Full Code Here

Examples of org.apache.poi.openxml4j.opc.internal.ContentType

    this.partMarshallers = new Hashtable<ContentType, PartMarshaller>(5);
    this.partUnmarshallers = new Hashtable<ContentType, PartUnmarshaller>(2);

    try {
      // Add 'default' unmarshaller
      this.partUnmarshallers.put(new ContentType(
          ContentTypes.CORE_PROPERTIES_PART),
          new PackagePropertiesUnmarshaller());

      // Add default marshaller
      this.defaultPartMarshaller = new DefaultMarshaller();
      // TODO Delocalize specialized marshallers
      this.partMarshallers.put(new ContentType(
          ContentTypes.CORE_PROPERTIES_PART),
          new ZipPackagePropertiesMarshaller());
    } catch (InvalidFormatException e) {
      // Should never happen
      throw new OpenXML4JRuntimeException(
View Full Code Here

Examples of org.apache.tapestry.ContentType

        // 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 ...

        _pageRenderQueue.initializeForPartialPageRender(rootRenderCommand);

        ContentType pageContentType = (ContentType) _request.getAttribute(
                InternalConstants.CONTENT_TYPE_ATTRIBUTE_NAME);
        String charset = pageContentType.getParameter(InternalConstants.CHARSET_CONTENT_TYPE_PARAMETER);

        ContentType contentType = new ContentType("text/javascript");
        contentType.setParameter(InternalConstants.CHARSET_CONTENT_TYPE_PARAMETER, charset);

        MarkupWriter writer = _factory.newMarkupWriter(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

Examples of org.apache.tapestry.annotations.ContentType

    {
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();
        String value = "text/pdf";

        ContentType annotation = newMock(ContentType.class);

        train_getAnnotation(ct, ContentType.class, annotation);

        expect(annotation.value()).andReturn(value);

        model.setMeta(TapestryConstants.RESPONSE_CONTENT_TYPE, value);

        replay();
View Full Code Here

Examples of org.apache.tapestry.internal.util.ContentType

public class ContentTypeTest extends Assert
{
    @Test
    public void simple_equals()
    {
        ContentType master = new ContentType("text/html");

        assertFalse(master.equals(null));
        assertFalse(master.equals(this));
        assertTrue(master.equals(master));
        assertTrue(master.equals(new ContentType("text/html")));
        assertFalse(master.equals(new ContentType("foo/bar")));
        assertFalse(master.equals(new ContentType("text/plain")));
    }
View Full Code Here

Examples of org.apache.tapestry.util.ContentType

            // provide it, try and guess it by the extension.

            if (contentType == null || contentType.length() == 0)
                contentType = getMimeType(resourcePath);

            OutputStream output = _response.getOutputStream(new ContentType(contentType));

            input = new BufferedInputStream(resourceConnection.getInputStream());

            byte[] buffer = new byte[BUFFER_SIZE];
View Full Code Here

Examples of org.apache.tapestry.util.ContentType

        String contentType,
        OutputStream stream)
    {
        this(safe, entities, contentType);

        ContentType contentTypeObject = new ContentType(contentType);
        String encoding = contentTypeObject.getParameter("charset");

        setOutputStream(stream, encoding);
    }
View Full Code Here

Examples of org.apache.tapestry.util.ContentType

     * @param encoding The value of the charset parameter of the content type if it is not already present.
     * @return The content type containing a charset parameter, e.g. text/html;charset=utf-8
     */
    private String generateFullContentType(String contentType, String encoding)
    {
        ContentType contentTypeObject = new ContentType(contentType);
        if (contentTypeObject.getParameter("charset") == null)
            contentTypeObject.setParameter("charset", encoding);
        return contentTypeObject.unparse();
    }
View Full Code Here

Examples of org.apache.tapestry5.ContentType

    public void renderPageResponse(Page page) throws IOException
    {
        assert page != null;

        ContentType contentType = pageContentTypeAnalyzer.findContentType(page);

        // For the moment, the content type is all that's used determine the model for the markup writer.
        // It's something of a can of worms.

        MarkupWriter writer = markupWriterFactory.newMarkupWriter(contentType);

        markupRenderer.renderPageMarkup(page, writer);

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

        long startNanos = System.nanoTime();

        writer.toMarkup(pw);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.