Package org.apache.jetspeed.capabilities

Examples of org.apache.jetspeed.capabilities.MediaType


                    {
                        throw new RuntimeException("Unable to get preferred Mimetype for client: "+entry.getName());                       
                    }

                    // Set preferred Mediatype for Mimetype
                    MediaType mediaTypeEntry = getMediaTypeForMimeType(mimeTypeEntry.getName());
                    if (mediaTypeEntry == null)
                    {
                        throw new RuntimeException("Unable to find preferred Mediatype for Mimetype/client: "+mimeTypeEntry.getName()+"/"+entry.getName());
                    }
                    map.setPreferredMediaType(mediaTypeEntry);
View Full Code Here


      }
        }
        if (co == null || co.isEmpty())
        {
            MediaType mt = getMediaType("html");
            Vector v = new Vector();
            v.add(mt);
            return v;
        }
        return co;
View Full Code Here

  /*
     * @see org.apache.jetspeed.capabilities.Capabilities#createMediaType(String)
     */
  public MediaType createMediaType(String mediaTypeName)   throws ClassNotFoundException
      {
    MediaType mediaType = null;
    if (mediaTypeName != null)
    {
      //try to find it in space
      mediaType = this.getMediaType(mediaTypeName);
      if (mediaType != null)
        return mediaType;
    }
        try
        {
          mediaType = (MediaType) beanFactory.getBean(
                    this.mediaTypeBeanName, MediaType.class);
          mediaType.setName(mediaTypeName);
            return mediaType;
        } catch (Exception e)
        {
            log.error("Failed to create mediaType instance for " + this.mediaTypeBeanName
                    + " error : " + e.getLocalizedMessage());
View Full Code Here

            {
                JSMediaType jsMediaType = (JSMediaType) mediaTypeIterator.next();
                // create a new Media
                try
                {
                    MediaType mediaType = caps.createMediaType(jsMediaType.getName());
                    /**
                     * THE KEY_OVERWRITE_EXISTING test IS required for media
                     * types, since they carry no other information than the
                     * name Used here for consistency, though
                     */
                    if ((isSettingSet(settings, JetspeedSerializer.KEY_OVERWRITE_EXISTING))
                            || (mediaType.getMediatypeId() == 0))
                    {
                        // set object fields
                        mediaType.setCharacterSet(jsMediaType.getCharacterSet());
                        mediaType.setTitle(jsMediaType.getTitle());
                        mediaType.setDescription(jsMediaType.getDescription());

                        try
                        {
                            line = jsMediaType.getMimeTypesString().toString();
                            List<String> list = getTokens(line);
                            if ((list != null) && (list.size() > 0))
                            {
                                Iterator<String> _it1 = list.iterator();
                                int added = 0;
                                while (_it1.hasNext())
                                {
                                    MimeType _mt = caps.createMimeType((String) _it1.next());
                                    if (_mt != null)
                                        mediaType.addMimetype(_mt);
                                    added++;
                                }
                            }
                        }
                        catch (Exception e1)
                        {
                            e1.printStackTrace();
                        }
                        try
                        {
                            line = jsMediaType.getCapabilitiesString().toString();
                            List<String> list = getTokens(line);
                            if ((list != null) && (list.size() > 0))
                            {
                                Iterator<String> _it1 = list.iterator();
                                if ((list != null) && (list.size() > 0))
                                {
                                    int added = 0;
                                    while (_it1.hasNext())
                                    {
                                        Capability _ct = caps.createCapability((String) _it1.next());
                                        if (_ct != null)
                                            mediaType.addCapability(_ct);
                                        added++;
                                    }
                                }
                            }
                        }
View Full Code Here

        while (list.hasNext())
        {
            try
            {
                MediaType mediaType = (MediaType) list.next();
                JSMediaType jsMediaType = new JSMediaType(mediaType);
                // find the mimeTypes
                Iterator mimeTypeIterator = mediaType.getMimetypes().iterator();
                while (mimeTypeIterator.hasNext())
                {
                    MimeType mimeType = (MimeType) mimeTypeIterator.next();
                    JSMimeType jsMimeType = (JSMimeType) refs.mimeMap.get(mimeType.getName());
                    if (jsMimeType != null) jsMediaType.getMimeTypes().add(jsMimeType);
                }
                // find the capabilities
                Iterator iterator = mediaType.getCapabilities().iterator();
                while (iterator.hasNext())
                {
                    Capability capability = (Capability) iterator.next();
                    JSCapability jsCapability = (JSCapability) refs.capabilityMap.get(capability
                            .getName());
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.capabilities.MediaType

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.