{ } }
Tree PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD com.ibm.portal.resolver.streams
Class FormDataInputStreamjava.lang.Objectjava.io.InputStream
com.ibm.portal.resolver.streams.MultipartInputStream
com.ibm.portal.resolver.streams.FormDataInputStream
- All Implemented Interfaces:
- FormDataStream, MultipartStream, java.io.Closeable, java.nio.channels.Channel
public abstract class FormDataInputStream- extends MultipartInputStream
- implements FormDataStream
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.
- Since:
- 6.1.0
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 insteadprotected static java.lang.String COPYRIGHT
copyright statementstatic java.lang.String KEY_CHARSET
Deprecated. use FormDataStream.KEY_CHARSET insteadstatic 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(ContentType ct)
Checks if the mime type is valid for a multipart/form-data inputabstract int read(java.io.Writer dst)
Deprecated. use FormDataInputStream.Entry.read(Writer) insteadabstract 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 CONTENT_TYPE_FORM_DATA
@Deprecated public static final java.lang.String CONTENT_TYPE_FORM_DATA
- Deprecated. use FormDataStream.CONTENT_TYPE_FORM_DATA instead
- mime type constants
- See Also:
- Constant Field Values
COPYRIGHT
protected static final java.lang.String COPYRIGHT
- copyright statement
KEY_CHARSET
@Deprecated public static final java.lang.String KEY_CHARSET
- Deprecated. use FormDataStream.KEY_CHARSET instead
- The special key of a form-upload parameter that the browsers set to the correct characterset
- See Also:
- Constant Field Values
VALUE_FORM_DATA
@Deprecated public static final java.lang.String VALUE_FORM_DATA
- Deprecated. use FormDataStream.VALUE_FORM_DATA instead
- identification of a content disposition that identifies a form field
- See Also:
- Constant Field Values
Constructor Detail FormDataInputStream
public FormDataInputStream()
Method Detail matches
public static boolean matches(ContentType ct)
- Checks if the mime type is valid for a multipart/form-data input
- Parameters:
- ct - the content type to check, not null
- Returns:
- true if this is a valid content type, else false
- Since:
- 8.0
getNextEntry
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
- Content-Type: to implement the MultipartStream.Entry.getContentType() method
- Content-Transfer-Encoding: to select the correct decoding for the content
- Specified by:
- getNextEntry in class MultipartInputStream
- Returns:
- the form entry just read or null if there is no more entry
- Throws:
- java.io.IOException - if an I/O error has occurred
read
@Deprecated public abstract int read(java.io.Writer dst) throws java.io.IOException
- Deprecated. use FormDataInputStream.Entry.read(Writer) instead
- Reads the value of the field in the current characterset and copies it into the target writer.
- Parameters:
- dst - target writer, not null
- Returns:
- the number of characters actually copied
- Throws:
- java.io.IOException - - if the data could not be read or copied
readString
@Deprecated public abstract java.lang.String readString() throws java.io.IOException
- Deprecated. use FormDataInputStream.Entry.readString() instead
- Reads the value of the field as a string
- Returns:
- the value as a string
- Throws:
- java.io.IOException - if an I/O error has occurred
Tree PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD