Package javax.activation

Examples of javax.activation.MimeType


     * @throws IRISyntaxException
     */
    public Content setContent(IRI uri, String mediatype) {
        try {
            FOMFactory factory = (FOMFactory)this.factory;
            Content content = factory.newContent(new MimeType(mediatype));
            content.setSrc(uri.toString());
            setContentElement(content);
            return content;
        } catch (javax.activation.MimeTypeParseException e) {
            throw new org.apache.abdera.util.MimeTypeParseException(e);
View Full Code Here


                for (String type : mediaRanges) {
                    if (type.equalsIgnoreCase("entry")) {
                        addSimpleExtension(ACCEPT, "application/atom+xml;type=entry");
                    } else {
                        try {
                            addSimpleExtension(ACCEPT, new MimeType(type).toString());
                        } catch (javax.activation.MimeTypeParseException e) {
                            throw new org.apache.abdera.util.MimeTypeParseException(e);
                        }
                    }
                }
View Full Code Here

        complete();
        if (mediaRanges != null) {
            for (String type : mediaRanges) {
                if (!accepts(type)) {
                    try {
                        addSimpleExtension(ACCEPT, new MimeType(type).toString());
                    } catch (Exception e) {
                    }
                }
            }
        }
View Full Code Here

        complete();
        if (value != null) {
            if (this.getFirstElement() != null)
                this.getFirstElement().discard();

            MimeType mtype = this.getMimeType();
            if (mtype == null) {
                String mt = getFactory().getMimeType(value);
                if (mt != null) {
                    setMimeType(mt);
                    mtype = getMimeType();
View Full Code Here

        }
        return this;
    }

    public MimeType getMimeType() {
        MimeType type = null;
        String mimeType = getAttributeValue(TYPE);
        if (mimeType != null) {
            try {
                type = new MimeType(mimeType);
            } catch (Exception e) {
            }
        }
        return type;
    }
View Full Code Here

    public Content setMimeType(String type) {
        complete();
        try {
            if (type != null)
                setAttributeValue(TYPE, (new MimeType(type)).toString());
            else
                removeAttribute(TYPE);
        } catch (javax.activation.MimeTypeParseException e) {
            throw new org.apache.abdera.util.MimeTypeParseException(e);
        }
View Full Code Here

    }

    public DataHandler getDataHandler() {
        if (!Type.MEDIA.equals(type))
            throw new UnsupportedOperationException(Localizer.get("DATA.HANDLER.NOT.SUPPORTED"));
        MimeType type = getMimeType();
        java.net.URL src = null;
        try {
            src = getSrc().toURL();
        } catch (Exception e) {
        }
        DataHandler dh = null;
        if (src == null) {
            dh =
                (DataHandler)DataHandlerUtils
                    .getDataHandlerFromText(getText(), (type != null) ? type.toString() : null);
        } else {
            dh = new DataHandler(new URLDataSource(src));
        }
        return dh;
    }
View Full Code Here

        return contentType;
    }

    public Document<T> setContentType(String contentType) {
        try {
            this.contentType = new MimeType(contentType);
            if (this.contentType.getParameter("charset") != null)
                setCharset(this.contentType.getParameter("charset"));
        } catch (javax.activation.MimeTypeParseException e) {
            throw new org.apache.abdera.util.MimeTypeParseException(e);
        }
View Full Code Here

        return locale;
    }

    protected Link selectLink(List<Link> links, String type, String hreflang) {
        for (Link link : links) {
            MimeType mt = link.getMimeType();
            boolean typematch = MimeTypeHelper.isMatch((mt != null) ? mt.toString() : null, type);
            boolean langmatch =
                "*".equals(hreflang) || ((hreflang != null) ? hreflang.equals(link.getHrefLang())
                    : link.getHrefLang() == null);
            if (typematch && langmatch)
                return link;
View Full Code Here

            // The next line MimeType mimeType = new MimeType();
            // must not be removed! If it is, the class loader will not be
            // able to find the javax.activation package thus making
            // javaxActivation object null and causing NullPointerExceptions.
            MimeType mimeType = new MimeType();
            Package javaxActivation = Package.getPackage("javax.activation");
            logger.info("package-implementation-title", new Object[]{
                javaxActivation.getName(),
                javaxActivation.getImplementationTitle()});
            logger.info("package-implementation-vendor", new Object[]{
View Full Code Here

TOP

Related Classes of javax.activation.MimeType

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.