Package org.jboss.metadata.web.spec

Examples of org.jboss.metadata.web.spec.MimeMappingMetaData


        mapping.setServletName(servlet);
        mappings.add(mapping);
    }

    static MimeMappingMetaData createMimeMapping(String extension, String mimeType) {
        MimeMappingMetaData mapping = new MimeMappingMetaData();
        mapping.setExtension(extension);
        mapping.setMimeType(mimeType);
        return mapping;
    }
View Full Code Here


* @author Remy Maucherat
*/
public class MimeMappingMetaDataParser extends MetaDataElementParser {

    public static MimeMappingMetaData parse(XMLStreamReader reader) throws XMLStreamException {
        MimeMappingMetaData mimeMapping = new MimeMappingMetaData();

        // Handle attributes
        final int count = reader.getAttributeCount();
        for (int i = 0; i < count; i ++) {
            final String value = reader.getAttributeValue(i);
            if (reader.getAttributeNamespace(i) != null) {
                continue;
            }
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case ID: {
                    mimeMapping.setId(value);
                    break;
                }
                default: throw unexpectedAttribute(reader, i);
            }
        }

        // Handle elements
        while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
            final Element element = Element.forName(reader.getLocalName());
            switch (element) {
                case EXTENSION:
                    mimeMapping.setExtension(reader.getElementText());
                    break;
                case MIME_TYPE:
                    mimeMapping.setMimeType(reader.getElementText());
                    break;
                default: throw unexpectedElement(reader);
            }
        }

View Full Code Here

TOP

Related Classes of org.jboss.metadata.web.spec.MimeMappingMetaData

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.