com.filenet.wcm.toolkit.server.util
Class WcmMimeFormParser

java.lang.Object
  extended bycom.filenet.wcm.toolkit.server.util.WcmMimeFormParser

public class WcmMimeFormParser
extends java.lang.Object

WcmMimeFormParser parses a form that specifies its ENCTYPE as multipart/form-data, possibly containing one or more files in its request content.


Field Summary
static java.lang.String INPUT_FILENAME
          INPUT_FILENAME can be passed to the getSectionParameter method to get the appropriate key-value.
static java.lang.String INPUT_NAME
          INPUT_NAME can be passed to the getSectionParameter method to get the appropriate key-value.
static java.lang.String MIME_TYPE
          MIME_TYPE can be passed to the getSectionParameter method to get the appropriate key-value.
 
Constructor Summary
WcmMimeFormParser(javax.servlet.http.HttpServletRequest request)
          Construct a new mime form parser for the request object.
 
Method Summary
 java.util.Hashtable getMimeEncodedParameters(WcmDataStore ds)
          Reads the entire mime encoded request body, and parses it into a Hashtable of key-values.
 boolean getNextMimeSection()
          Read past any current section content to the next section header.
 java.lang.String getSectionContent()
          Read the section content, and return it as a String.
 long getSectionContentLength()
          Returns the content length for the current section.
 java.lang.String getSectionParameter(java.lang.String key)
          Get the section parameter key-value.
 java.util.Enumeration getSectionParameterKeys()
          Get an enumeration of all of the keys contained in the section header.
 boolean isEOD()
          Returns true if the end of the request input stream has been reached.
 boolean writeSectionContent(java.io.OutputStream os)
          Read the section content, and write it to the specified OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INPUT_NAME

public static java.lang.String INPUT_NAME
INPUT_NAME can be passed to the getSectionParameter method to get the appropriate key-value. This would be the form field name (request parameter name) corresponding to the current section.


INPUT_FILENAME

public static java.lang.String INPUT_FILENAME
INPUT_FILENAME can be passed to the getSectionParameter method to get the appropriate key-value. If the current section specifies file content, this would be the filename corresponding to the file content in this section.


MIME_TYPE

public static java.lang.String MIME_TYPE
MIME_TYPE can be passed to the getSectionParameter method to get the appropriate key-value. If the current section specifies file content, this would be the mime type corresponding to the file content in this section.

Constructor Detail

WcmMimeFormParser

public WcmMimeFormParser(javax.servlet.http.HttpServletRequest request)
                  throws java.io.IOException
Construct a new mime form parser for the request object. This can only be done once for a given request, since it reads the request content, which is sequential.

Parameters:
request - The HttpServletRequest.
Throws:
java.io.IOException
Method Detail

getMimeEncodedParameters

public java.util.Hashtable getMimeEncodedParameters(WcmDataStore ds)
                                             throws java.lang.Exception
Reads the entire mime encoded request body, and parses it into a Hashtable of key-values. Key-values that correspond to files will contain an instance of WcmUploadInputStream. All other key-values will contain an instance of String.

Parameters:
ds - A reference to WcmDataStore.
Returns:
An instance of Hashtable containing all of the key-values.
Throws:
java.lang.Exception

isEOD

public boolean isEOD()
Returns true if the end of the request input stream has been reached.

Returns:
true or false.

getSectionContentLength

public long getSectionContentLength()
Returns the content length for the current section. This value is valid only after getSectionContent or writeSectionContent have been called to read the current section content.

Returns:
The content length.

getSectionParameter

public java.lang.String getSectionParameter(java.lang.String key)
Get the section parameter key-value.

Parameters:
key - The key, which can be INPUT_NAME, INPUT_FILENAME or MIME_TYPE, or any other section header key-value that may be specified.
Returns:
The value for the specified key.

getSectionParameterKeys

public java.util.Enumeration getSectionParameterKeys()
Get an enumeration of all of the keys contained in the section header.

Returns:
An enumeration of the keys.

getSectionContent

public java.lang.String getSectionContent()
                                   throws java.io.IOException
Read the section content, and return it as a String.

Returns:
A String of the section content. null if it's not at the beginning of section content.
Throws:
java.io.IOException

writeSectionContent

public boolean writeSectionContent(java.io.OutputStream os)
                            throws java.io.IOException
Read the section content, and write it to the specified OutputStream.

Parameters:
os - The OutputStream to write to.
Returns:
true if successful. false if we're not at the beginning of section content.
Throws:
java.io.IOException

getNextMimeSection

public boolean getNextMimeSection()
                           throws java.io.IOException
Read past any current section content to the next section header.

Returns:
true if a new section was found; false if not.
Throws:
java.io.IOException


© Copyright IBM Corp. 2002, 2007. All Rights Reserved.