/** 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); }
/** * 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; }
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(); }
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();