Examples of MimeType


Examples of javax.activation.MimeType

        case COLLECTION:
        try {
          if (MimeTypeHelper.isMatch(
            request.getContentType(),
            "application/atom+xml")) {
            MimeType type = new MimeType(request.getContentType());
            String charset = type.getParameter("charset");
            String uri = AppTest.INSTANCE.getBase() + "/collections/entries";
            ParserOptions options = getParser().getDefaultParserOptions();
            options.setCharset(charset);
            Document doc = getParser().parse(request.getInputStream(), uri, options);
            if (doc.getRoot() instanceof Entry) {
View Full Code Here

Examples of javax.activation.MimeType

        switch(t) {
          case ENTRY:
            try {
              if (MimeTypeHelper.isMatch(request.getContentType(), "application/atom+xml")) {
                Entry entry = feed.getRoot().getEntries().get(target);
                MimeType type = new MimeType(request.getContentType());
                String charset = type.getParameter("charset");
                String uri = AppTest.INSTANCE.getBase() + "/collections/entries/" + target;
                ParserOptions options = getParser().getDefaultParserOptions();
                options.setCharset(charset);
                Document doc = getParser().parse(request.getInputStream(), uri, options);
                if (doc.getRoot() instanceof Entry) {
View Full Code Here

Examples of javax.activation.MimeType

        this.chars = chars;
    }

    private static MimeType newMimeType(String baseType) {
        try {
            return new MimeType(baseType);
        } catch (MimeTypeParseException e) {
            throw new IllegalArgumentException(e);
        }
    }
View Full Code Here

Examples of javax.activation.MimeType

        }
    }

    private static MimeType newMimeType(String primaryType, String subType) {
        try {
            return new MimeType(primaryType, subType);
        } catch (MimeTypeParseException e) {
            throw new IllegalArgumentException(e);
        }
    }
View Full Code Here

Examples of javax.activation.MimeType

    private final MimeType mimeTypeApplicationZip;
    private final MimeType mimeTypeApplicationJson;

    public DeveloperUtilitiesServiceDefault() {
        try {
            mimeTypeTextCsv = new MimeType("text", "csv");
            mimeTypeApplicationJson = new MimeType("application", "jzon");
            mimeTypeApplicationZip = new MimeType("application", "zip");
        } catch (MimeTypeParseException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of javax.activation.MimeType

    return EncodingUtil.decode(getHeader("Slug"));
  }

  public MimeType getContentType() throws MimeTypeParseException {
    String value = getHeader("Content-Type");
    return (value != null) ? new MimeType(value) : null;
  }
View Full Code Here

Examples of javax.activation.MimeType

        this.bytes = bytes;
    }

    private static MimeType newMimeType(String primaryType, String subtype) {
        try {
            return new MimeType(primaryType, subtype);
        } catch (MimeTypeParseException e) {
            throw new IllegalArgumentException(e);
        }
    }
View Full Code Here

Examples of javax.activation.MimeType

        }
    }

    private static MimeType newMimeType(String baseType) {
        try {
            return new MimeType(baseType);
        } catch (MimeTypeParseException e) {
            throw new IllegalArgumentException(e);
        }
    }
View Full Code Here

Examples of javax.activation.MimeType

        final String name  = data.substring(0, colonIdx);
        final int colon2Idx  = data.indexOf(":", colonIdx+1);
        final String mimeTypeBase = data.substring(colonIdx+1, colon2Idx);
        final byte[] bytes = Base64.decodeBase64(data.substring(colon2Idx+1));
        try {
            return new Blob(name, new MimeType(mimeTypeBase), bytes);
        } catch (MimeTypeParseException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of javax.activation.MimeType

        final String name  = data.substring(0, colonIdx);
        final int colon2Idx  = data.indexOf(":", colonIdx+1);
        final String mimeTypeBase = data.substring(colonIdx+1, colon2Idx);
        final CharSequence chars = data.substring(colon2Idx+1);
        try {
            return new Clob(name, new MimeType(mimeTypeBase), chars);
        } catch (MimeTypeParseException e) {
            throw new RuntimeException(e);
        }
    }
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.