Package org.apache.jetspeed.om.registry

Examples of org.apache.jetspeed.om.registry.MediaTypeEntry


            Iterator i = entry.listMediaTypes();

            while(i.hasNext())
            {
                String name = (String)i.next();
                MediaTypeEntry media = (MediaTypeEntry)Registry.getEntry(Registry.MEDIA_TYPE, name);
                if (media != null)
                {
                    if (baseType.equals(media.getMimeType())) return true;
                }
            }
        }

        return MimeType.HTML.equals( mimeType );
View Full Code Here


                Iterator i = entry.listMediaTypes();
   
                while(i.hasNext())
                {
                    String name = (String)i.next();
                    MediaTypeEntry media = (MediaTypeEntry)Registry.getEntry(Registry.MEDIA_TYPE, name);

                    if (media != null)
                    {
                        if (baseType.equals(media.getMimeType()))
                        {
                            allowed = true;
                            break;
                        }
                    }
View Full Code Here

        try
        {
            Enumeration en = getEntries();
            while(en.hasMoreElements())
            {
                MediaTypeEntry mte = (MediaTypeEntry)en.nextElement();

                if (DEBUG && Log.getLogger().isDebugEnabled())
                {
                    Log.debug("MediaTypeRegistry: found MediaTypeEntry for type " + mte.getMimeType() );
                }
                if (type.equals(mte.getMimeType()))
                {
                    result.add(mte);
                }
            }
        }
View Full Code Here

        MimeType mime = cm.getPreferredType();
        String characterSet = JetspeedResources.getString(JetspeedResources.CONTENT_ENCODING_KEY,"utf-8");
        data.setContentType( mime.getContentType());
        if ( mime != null )
        {
            MediaTypeEntry media = (MediaTypeEntry)Registry.getEntry(Registry.MEDIA_TYPE, mime.getCode());
            if ( media != null && media.getCharacterSet() != null)
            {
                characterSet = media.getCharacterSet();
            }
        }
        data.setCharSet( characterSet );

        if (Log.getLogger().isDebugEnabled())
View Full Code Here

            //example:  content type text/html => media type html
            MediaTypeRegistry mediaRegistry = (MediaTypeRegistry) Registry.get(Registry.MEDIA_TYPE);
            Enumeration en = mediaRegistry.getEntries();
            while(en.hasMoreElements())
            {
                MediaTypeEntry mte = (MediaTypeEntry)en.nextElement();

                //TODO:  the type can have wildcards, will REGEXP handle this?
                /*
                RE r = null;
                RECompiler rc = null;
               
                try
                {
                    rc = new RECompiler();
                    r = new RE();
                    r.setProgram(rc.compile(type));
                }
                catch (org.apache.regexp.RESyntaxException rex)
                {
                    log.warn("FusionPAM: error processing regular expression [" + type + "]: " +
                             rex.toString());
                }
                */
               
                if(type.indexOf('*') != -1)
                {
                    log.info("Found mime type with wildcard.");
                }
                else if (type.equals(mte.getMimeType()))// || r.match(mte.getMimeType()))
                {
                    log.info("Found media entry " + mte.getName() + " that matches mimetype " + type);
                    entry.addMediaType(mte.getName());
                    break;
                }
            }
        }
       
View Full Code Here

            if (regEntry != null)
            {
                CapabilityMap cm = null;
                if (regEntry instanceof MediaTypeEntry)
                {
                    MediaTypeEntry mediaTypeEntry = (MediaTypeEntry) regEntry;
                    cm = mediaTypeEntry.getCapabilityMap();
                }
                else if (regEntry instanceof ClientEntry)
                {
                    ClientEntry clientEntry = (ClientEntry) regEntry;
                    cm = clientEntry.getCapabilityMap();
View Full Code Here

            if (regEntry != null)
            {
                CapabilityMap cm = null;
                if (regEntry instanceof MediaTypeEntry)
                {
                    MediaTypeEntry mediaTypeEntry = (MediaTypeEntry) regEntry;
                    cm = mediaTypeEntry.getCapabilityMap();
                }
                else if (regEntry instanceof ClientEntry)
                {
                    ClientEntry clientEntry = (ClientEntry) regEntry;
                    cm = clientEntry.getCapabilityMap();
View Full Code Here

            String mime = ((MimeType)mimes.next()).getContentType();
            Iterator i = types.iterator();

            while(i.hasNext())
            {
                MediaTypeEntry mte = (MediaTypeEntry)i.next();

                if (mime.equals(mte.getMimeType()))
                {
                    if (entry.getCapabilityMap().containsAll(mte.getCapabilityMap()))
                    {
                        results.add(mte.getName());
                    }
                }
            }
        }
View Full Code Here

        if (media == null)
        {
            return true;
        }

        MediaTypeEntry mte = (MediaTypeEntry)Registry.getEntry(Registry.MEDIA_TYPE, media);

        if (!supportsMimeType(new MimeType(mte.getMimeType())))
        {
            return false;
        }

        return entry.getCapabilityMap().containsAll(mte.getCapabilityMap());

    }
View Full Code Here

            && (mode.equals(SecurityConstants.PARAM_MODE_DELETE)
                || mode.equals(SecurityConstants.PARAM_MODE_UPDATE)))
        {
            String mediaTypeName =
                rundata.getParameters().getString(registryEntryName);
            MediaTypeEntry mediaEntry =
                (MediaTypeEntry) Registry.getEntry(
                    registry,mediaTypeName);
            context.put("entry", mediaEntry);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.registry.MediaTypeEntry

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.