public class ContentFilter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ContentFilter.FilterStatus |
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
HTML_MIME_TYPES
The HTML mime types are defined here, to allow other modules to identify it
|
Constructor and Description |
---|
ContentFilter() |
Modifier and Type | Method and Description |
---|---|
static UnsafeContentTypeException |
checkMIMEType(java.lang.String expectedMIME)
Check whether we can safely handle a specific MIME type.
|
static java.lang.String |
detectCharset(byte[] input,
int length,
FilterMIMEType handler,
java.lang.String maybeCharset) |
static ContentFilter.FilterStatus |
filter(java.io.InputStream input,
java.io.OutputStream output,
java.lang.String typeName,
java.lang.String maybeCharset,
FilterCallback filterCallback)
Deprecated.
|
static ContentFilter.FilterStatus |
filter(java.io.InputStream input,
java.io.OutputStream output,
java.lang.String typeName,
java.lang.String maybeCharset,
java.lang.String schemeHostAndPort,
FilterCallback filterCallback)
Filter some data.
|
static ContentFilter.FilterStatus |
filter(java.io.InputStream input,
java.io.OutputStream output,
java.lang.String typeName,
java.net.URI baseURI,
FoundURICallback cb,
TagReplacerCallback trc,
java.lang.String maybeCharset)
Deprecated.
|
static ContentFilter.FilterStatus |
filter(java.io.InputStream input,
java.io.OutputStream output,
java.lang.String typeName,
java.net.URI baseURI,
java.lang.String schemeHostAndPort,
FoundURICallback cb,
TagReplacerCallback trc,
java.lang.String maybeCharset)
Filter some data.
|
static ContentFilter.FilterStatus |
filter(java.io.InputStream input,
java.io.OutputStream output,
java.lang.String typeName,
java.net.URI baseURI,
java.lang.String schemeHostAndPort,
FoundURICallback cb,
TagReplacerCallback trc,
java.lang.String maybeCharset,
LinkFilterExceptionProvider linkFilterExceptionProvider)
Filter some data.
|
static FilterMIMEType |
getMIMEType(java.lang.String mimeType) |
static void |
init() |
static java.lang.String |
mimeTypeForSrc(java.lang.String uriold) |
static void |
register(FilterMIMEType mimeType) |
static boolean |
startsWith(byte[] data,
byte[] cmp,
int length) |
static java.lang.String |
stripMIMEType(java.lang.String mimeType) |
public static final java.lang.String[] HTML_MIME_TYPES
public static void init()
public static void register(FilterMIMEType mimeType)
public static java.lang.String stripMIMEType(java.lang.String mimeType)
public static FilterMIMEType getMIMEType(java.lang.String mimeType)
@Deprecated public static ContentFilter.FilterStatus filter(java.io.InputStream input, java.io.OutputStream output, java.lang.String typeName, java.net.URI baseURI, FoundURICallback cb, TagReplacerCallback trc, java.lang.String maybeCharset) throws UnsafeContentTypeException, java.io.IOException
UnsafeContentTypeException
java.io.IOException
public static ContentFilter.FilterStatus filter(java.io.InputStream input, java.io.OutputStream output, java.lang.String typeName, java.net.URI baseURI, java.lang.String schemeHostAndPort, FoundURICallback cb, TagReplacerCallback trc, java.lang.String maybeCharset) throws UnsafeContentTypeException, java.io.IOException
input
- Source stream to read data fromoutput
- Stream to write filtered data totypeName
- MIME type for input dataschemeHostAndPort
- HOST and PORT from the requestmaybeCharset
- MIME type of the referring document, as a hint, some types,
such as CSS, will inherit it if no other data is available.java.io.IOException
- If an internal error involving s occurred.UnsafeContentTypeException
- If the MIME type is declared unsafe (e.g. pdf files)java.lang.IllegalStateException
- If data is invalid (e.g. corrupted file) and the filter have no way to recover.public static ContentFilter.FilterStatus filter(java.io.InputStream input, java.io.OutputStream output, java.lang.String typeName, java.net.URI baseURI, java.lang.String schemeHostAndPort, FoundURICallback cb, TagReplacerCallback trc, java.lang.String maybeCharset, LinkFilterExceptionProvider linkFilterExceptionProvider) throws UnsafeContentTypeException, java.io.IOException
input
- Source stream to read data fromoutput
- Stream to write filtered data totypeName
- MIME type for input dataschemeHostAndPort
- HOST and PORT from the requestmaybeCharset
- MIME type of the referring document, as a hint, some types,
such as CSS, will inherit it if no other data is available.java.io.IOException
- If an internal error involving s occurred.UnsafeContentTypeException
- If the MIME type is declared unsafe (e.g. pdf files)java.lang.IllegalStateException
- If data is invalid (e.g. corrupted file) and the filter have no way to recover.@Deprecated public static ContentFilter.FilterStatus filter(java.io.InputStream input, java.io.OutputStream output, java.lang.String typeName, java.lang.String maybeCharset, FilterCallback filterCallback) throws UnsafeContentTypeException, java.io.IOException
UnsafeContentTypeException
java.io.IOException
public static ContentFilter.FilterStatus filter(java.io.InputStream input, java.io.OutputStream output, java.lang.String typeName, java.lang.String maybeCharset, java.lang.String schemeHostAndPort, FilterCallback filterCallback) throws UnsafeContentTypeException, java.io.IOException
input
- Source stream to read data fromoutput
- Stream to write filtered data totypeName
- MIME type for input datamaybeCharset
- MIME type of the referring document, as a hint, some types,
such as CSS, will inherit it if no other data is available.schemeHostAndPort
- HOST and PORT from the requestjava.io.IOException
- If an internal error involving buckets occurred.UnsafeContentTypeException
- If the MIME type is declared unsafe (e.g. pdf files)java.lang.IllegalStateException
- If data is invalid (e.g. corrupted file) and the filter have no way to recover.public static java.lang.String detectCharset(byte[] input, int length, FilterMIMEType handler, java.lang.String maybeCharset) throws java.io.IOException
java.io.IOException
public static boolean startsWith(byte[] data, byte[] cmp, int length)
public static java.lang.String mimeTypeForSrc(java.lang.String uriold)
public static UnsafeContentTypeException checkMIMEType(java.lang.String expectedMIME)