|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream com.ibm.portal.resolver.streams.MultipartInputStream com.ibm.portal.resolver.streams.FormDataInputStream
public abstract class FormDataInputStream
Input stream that decodes a stream of type "multipart/form-data". This stream
in particular only iterates over those pieces of the input stream with a
Content-Disposition: form-data; The "name" attribute of this content
disposition is available via the FormDataInputStream.Entry.getName()
method. The class
also automatically detects the presence of the "_charset_" parameter and uses
it to correctly decode string parameters (see
http://www.whatwg.org/specs/web-forms/current-work/#the-charset). The stream
sequentially iterates over all parameters, and only applies the "_charset_"
parameter to all subsequent parameters. The "_charset_" parameter itself is
not exposed, but the current characterset can be queried via the
FormDataInputStream.Entry.getCharset()
method. Use the readString()
method to
read the complete parameter in the current characterset into a string
representation. This method is appropriate for small parameter values. Use
the read(Writer)
method to process large parameters or wrap the
InputStream
into a InputStreamReader
.
If this stream in used in conjunction with a DataSink, make sure to protect
potentially harmful operations with a nonce. The nonce should be part of the
stream as the hidden input field "_csrf_token_" and will be available via
FormDataInputStream.Entry.getNonce()
. This nonce value can be validated against the nonce
of the current user via the nonce service.
Nested Class Summary | |
---|---|
static class |
FormDataInputStream.Entry
Extension of the MultipartInputStream.Entry that adds information
about the parameter name and characterset. |
Field Summary | |
---|---|
static java.lang.String |
CONTENT_TYPE_FORM_DATA
Deprecated. use FormDataStream.CONTENT_TYPE_FORM_DATA instead |
static java.lang.String |
KEY_CHARSET
Deprecated. use FormDataStream.KEY_CHARSET instead |
static java.lang.String |
VALUE_FORM_DATA
Deprecated. use FormDataStream.VALUE_FORM_DATA instead |
Fields inherited from interface com.ibm.portal.resolver.streams.FormDataStream |
---|
KEY_CSRF_TOKEN |
Fields inherited from interface com.ibm.portal.resolver.streams.MultipartStream |
---|
CONTENT_TYPE_MULTIPART, KEY_CONTENT_DISPOSITION, KEY_FILENAME, KEY_MIME_BOUNDARY, KEY_NAME, VALUE_MULTIPART |
Constructor Summary | |
---|---|
FormDataInputStream()
|
Method Summary | |
---|---|
abstract FormDataInputStream.Entry |
getNextEntry()
Reads the next multipart stream entry and positions stream at the beginning of the entry data. |
static boolean |
matches(javax.mail.internet.ContentType ct)
Checks if the mime type is valid for a multipart/form-data input |
abstract int |
read(java.io.Writer dst)
Deprecated. use FormDataInputStream.Entry.read(Writer) instead |
abstract java.lang.String |
readString()
Deprecated. use FormDataInputStream.Entry.readString() instead |
Methods inherited from class java.io.InputStream |
---|
available, close, mark, markSupported, read, read, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.ibm.portal.resolver.streams.MultipartStream |
---|
closeEntry |
Methods inherited from interface java.nio.channels.Channel |
---|
close, isOpen |
Field Detail |
---|
@Deprecated public static final java.lang.String CONTENT_TYPE_FORM_DATA
FormDataStream.CONTENT_TYPE_FORM_DATA
instead
@Deprecated public static final java.lang.String KEY_CHARSET
FormDataStream.KEY_CHARSET
instead
@Deprecated public static final java.lang.String VALUE_FORM_DATA
FormDataStream.VALUE_FORM_DATA
instead
Constructor Detail |
---|
public FormDataInputStream()
Method Detail |
---|
public static boolean matches(javax.mail.internet.ContentType ct)
ct
- the content type to check, not null
true
if this is a valid content type, else
false
public abstract FormDataInputStream.Entry getNextEntry() throws java.io.IOException
Reads the next multipart stream entry and positions stream at the
beginning of the entry data. Note that FormDataInputStream.Entry
instances may be
recycled, the entry is only valid until the next call to
getNextEntry()
or MultipartStream.closeEntry()
.
The implementation will at least interpret the following headers automatically
MultipartStream.Entry.getContentType()
method
getNextEntry
in class MultipartInputStream
null
if there is no more
entry
java.io.IOException
- if an I/O error has occurred@Deprecated public abstract int read(java.io.Writer dst) throws java.io.IOException
FormDataInputStream.Entry.read(Writer)
instead
dst
- target writer, not null
java.io.IOException
- - if the data could not be read or copied@Deprecated public abstract java.lang.String readString() throws java.io.IOException
FormDataInputStream.Entry.readString()
instead
java.io.IOException
- if an I/O error has occurred
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |