/** * Tries to determine the appropriate file format based on the a MIME * type that describes the content type. * * @param mimeType * A MIME type, e.g. "text/html". * @return An {@link PropertiesFormat} object if the MIME type was recognized, or * <tt>null</tt> otherwise. * @see #forMIMEType(String,PropertiesFormat) * @see #getMIMETypes() */ public static PropertiesFormat forMIMEType(final String mimeType) { return forMIMEType(mimeType, null); }
/** * Creates a new {@link PropertiesTextWriter} that will write to the supplied * {@link Writer}. * * @param writer * The {@link Writer} to write the {@link Properties} document * to. */ public PropertiesTextWriter(final Writer writer) { this.os = new WriterOutputStream(writer, PropertiesFormat.TEXT.getCharset()); }
/** * Tries to determine the appropriate file format based on the a MIME * type that describes the content type. The supplied fallback format will be * returned when the MIME type was not recognized. * * @param mimeType * A file name. * @return An {@link PropertiesFormat} that matches the MIME type, or the fallback format if * the extension was not recognized. * @see #forMIMEType(String) * @see #getMIMETypes() */ public static PropertiesFormat forMIMEType(String mimeType, PropertiesFormat fallback) { return matchMIMEType(mimeType, formats/* Iterable<FileFormat> */, fallback); }
entity.setContentType(format.getDefaultMIMEType()); final PropertiesFormat format = PropertiesFormat.forMIMEType(mimeType.getMimeType());
resp.setContentType(format.getDefaultMIMEType());
resp.setContentType(format.getDefaultMIMEType());
/** * Tries to determine the appropriate file format based on the a MIME * type that describes the content type. * * @param mimeType * A MIME type, e.g. "text/html". * @return An {@link PropertiesFormat} object if the MIME type was recognized, or * <tt>null</tt> otherwise. * @see #forMIMEType(String,PropertiesFormat) * @see #getMIMETypes() */ public static PropertiesFormat forMIMEType(final String mimeType) { return forMIMEType(mimeType, null); }
entity.setContentType(format.getDefaultMIMEType());
/** * Creates a new {@link PropertiesXMLWriter} that will write to the supplied * {@link Writer}. * * @param writer * The {@link Writer} to write the {@link Properties} document * to. */ public PropertiesXMLWriter(final Writer writer) { this.os = new WriterOutputStream(writer, PropertiesFormat.XML.getCharset()); }
/** * Tries to determine the appropriate file format based on the a MIME * type that describes the content type. The supplied fallback format will be * returned when the MIME type was not recognized. * * @param mimeType * A file name. * @return An {@link PropertiesFormat} that matches the MIME type, or the fallback format if * the extension was not recognized. * @see #forMIMEType(String) * @see #getMIMETypes() */ public static PropertiesFormat forMIMEType(String mimeType, PropertiesFormat fallback) { return matchMIMEType(mimeType, formats/* Iterable<FileFormat> */, fallback); }
log.info("Request body: " + contentType); final PropertiesFormat format = PropertiesFormat.forMIMEType(contentType);
entity.setContentType(format.getDefaultMIMEType());
/** * Creates a new {@link PropertiesXMLWriter} that will write to the supplied * {@link Writer}. * * @param writer * The {@link Writer} to write the {@link Properties} document * to. */ public PropertiesXMLWriter(final Writer writer) { this.os = new WriterOutputStream(writer, PropertiesFormat.XML.getCharset()); }
log.info("Request body: " + contentType); final PropertiesFormat format = PropertiesFormat.forMIMEType(contentType);
/** * Creates a new {@link PropertiesTextWriter} that will write to the supplied * {@link Writer}. * * @param writer * The {@link Writer} to write the {@link Properties} document * to. */ public PropertiesTextWriter(final Writer writer) { this.os = new WriterOutputStream(writer, PropertiesFormat.TEXT.getCharset()); }
log.info("Request body: " + contentType); final PropertiesFormat format = PropertiesFormat.forMIMEType(contentType);
@Override public Properties parse(final Reader reader) throws IOException { final InputStream in = new ReaderInputStream(reader, getFormat() .getCharset()); try { final Properties p = new Properties(); p.loadFromXML(in); return p; } finally { in.close(); } }
log.info("Request body: " + contentType); final PropertiesFormat format = PropertiesFormat.forMIMEType(contentType);
@Override public Properties parse(final Reader reader) throws IOException { final InputStream in = new ReaderInputStream(reader, getFormat() .getCharset()); try { final Properties p = new Properties(); p.loadFromXML(in); return p; } finally { in.close(); } }
.forMIMEType(t.getMimeType());