public JSMediaType(MediaType c) { this.id = c.getMediatypeId(); this.name = c.getName(); this.characterSet = c.getCharacterSet(); this.title = c.getTitle(); this.description = c.getDescription(); capabilities = new ArrayList(); mimeTypes = new ArrayList(); }
|| (mediaType.getMediatypeId() == 0)) mediaType.setCharacterSet(jsMediaType.getCharacterSet()); mediaType.setTitle(jsMediaType.getTitle()); mediaType.setDescription(jsMediaType.getDescription()); mediaType.addMimetype(_mt); added++; mediaType.addCapability(_ct); added++;
/** Add MediaType to the MediaTypeMap */ public void addMediaType(MediaType mediatype) { if (mediatype != null) // avoid null due to duplicates in database this.mediaTypeMap.put(mediatype.getName(), mediatype); }
if (encoding == null) if (mediaType != null && mediaType.getCharacterSet() != null) encoding = mediaType.getCharacterSet(); log.debug("MediaType: " + mediaType.getName()); log.debug("Encoding: " + encoding); log.debug("Mimetype: " + mimeType.getName()); request.setMediaType(mediaType.getName());
JSMediaType jsMediaType = new JSMediaType(mediaType); Iterator mimeTypeIterator = mediaType.getMimetypes().iterator(); while (mimeTypeIterator.hasNext()) Iterator iterator = mediaType.getCapabilities().iterator(); while (iterator.hasNext())
/** * Return true if this CapabilityMap supports the given media type * * @param media the name of a media type registered in the * MediaType registry * * @return true is the capabilities of this agent at least match those * required by the media type */ public boolean supportsMediaType(String media) { Iterator<MediaType> mediatypes = mediaTypeMap.values().iterator(); while (mediatypes.hasNext()) { if (mediatypes.next().getName().equals(media)) { return true; } } return false; }
templateLocatorDescriptor.setMediaType(capabilityMap.getPreferredMediaType().getName()); templateLocatorDescriptor.setCountry(locale.getCountry()); templateLocatorDescriptor.setLanguage(locale.getLanguage()); decorationLocatorDescriptor.setMediaType(capabilityMap.getPreferredMediaType().getName()); decorationLocatorDescriptor.setCountry(locale.getCountry()); decorationLocatorDescriptor.setLanguage(locale.getLanguage());
String layoutMediaType = capabilityMap.getPreferredMediaType().getName(); String layoutLanguage = locale.getLanguage(); String layoutCountry = locale.getCountry();