/** * Delete a content type based on the specified part name. If the specified * part name is registered with an override content type, then this content * type is removed, else the content type is removed in the default content * type list if it exists. Deprecated since you'd typically NOT want to * accidentally remove *.xml or *.rels from the default Content type list * * @param partUri * The part URI associated with the override content type to * delete. */ @Deprecated public void removeContentType(PartName partName) { if (partName == null) throw new IllegalArgumentException("partName"); // Override content type if (this.overrideContentType != null && (this.overrideContentType.get(partName.getURI()) != null)) { this.overrideContentType.remove(partName.getURI()); return; } // Default content type this.defaultContentType.remove(partName.getExtension().toLowerCase()); }
/** * Get the content type for the specified part, if any. * * @param partUri * The URI part to check. * @return The content type associated with the URI (in case of an override * content type) or the extension (in case of default content type), * else <code>null</code>. */ public String getContentType(PartName partName) { if (partName == null) throw new IllegalArgumentException("partName"); if ((this.overrideContentType != null) && this.overrideContentType.containsKey(partName.getURI())) return this.overrideContentType.get(partName.getURI()).getContentType(); String extension = partName.getExtension().toLowerCase(); if (this.defaultContentType.containsKey(extension)) return this.defaultContentType.get(extension).getContentType(); return null; }
public AlternativeFormatInputPart(PartName partName) throws InvalidFormatException { super(partName); String extension = partName.getExtension().toLowerCase(); if (extension.equals("htm")) { setAltChunkType(AltChunkType.Html); } else { for(AltChunkType type: AltChunkType.values()) { if (extension.equals(type.getExtension())) { setAltChunkType(type); } } } if (altChunkType==null) { log.warn("Unrecognized type: " + extension); } init(); }
"." + part.getPartName().getExtension(), this.getPackage().getParts().getParts() ); } else { String ext = part.getPartName().getExtension();
/** * Delete a content type based on the specified part name. If the specified * part name is registered with an override content type, then this content * type is removed, else the content type is removed in the default content * type list if it exists. Deprecated since you'd typically NOT want to * accidentally remove *.xml or *.rels from the default Content type list * * @param partUri * The part URI associated with the override content type to * delete. */ @Deprecated public void removeContentType(PartName partName) { if (partName == null) throw new IllegalArgumentException("partName"); // Override content type if (this.overrideContentType != null && (this.overrideContentType.get(partName.getURI()) != null)) { this.overrideContentType.remove(partName.getURI()); return; } // Default content type this.defaultContentType.remove(partName.getExtension().toLowerCase()); }
/** * Get the content type for the specified part, if any. * * @param partUri * The URI part to check. * @return The content type associated with the URI (in case of an override * content type) or the extension (in case of default content type), * else <code>null</code>. */ public String getContentType(PartName partName) { if (partName == null) throw new IllegalArgumentException("partName"); if ((this.overrideContentType != null) && this.overrideContentType.containsKey(partName.getURI())) return this.overrideContentType.get(partName.getURI()).getContentType(); String extension = partName.getExtension().toLowerCase(); if (this.defaultContentType.containsKey(extension)) return this.defaultContentType.get(extension).getContentType(); return null; }
public AlternativeFormatInputPart(PartName partName) throws InvalidFormatException { super(partName); String extension = partName.getExtension().toLowerCase(); if (extension.equals("htm")) { setAltChunkType(AltChunkType.Html); } else { for(AltChunkType type: AltChunkType.values()) { if (extension.equals(type.getExtension())) { setAltChunkType(type); } } } if (altChunkType==null) { log.warn("Unrecognized type: " + extension); } init(); }
"." + part.getPartName().getExtension(), this.getPackage().getParts().getParts() ); } else { String ext = part.getPartName().getExtension();