SAP J2EE Engine

Version 6.40


com.sap.engine.services.servlets_jsp.lib.multipart
Class MultipartPart

java.lang.Object
  |
  +--com.sap.engine.services.servlets_jsp.lib.multipart.MultipartPart

public abstract class MultipartPart
extends java.lang.Object

This class represents a sub-message of a multipart http message. Each sub-message has headers and body.

Version:
6.30
See Also:
MultipartMessage

Field Summary
protected  java.util.Hashtable headers
           
protected  int size
           
 
Constructor Summary
MultipartPart()
           
 
Method Summary
 void addHeader(java.lang.String headerName, java.lang.String headerValue)
          Adds a header with specified name and value in this multipart sub-message.
 java.util.Enumeration getAllHeaderNames()
          Returns an enumeration of the names of all headers of this multipart sub-message.
 byte[] getBody()
          Returns a byte array containing the body of this multipart sub-message.
 java.lang.String getCharacterEncoding()
          Returns the value of the character encoding of this sub-message as specified by its Content-type header
 java.lang.String getContentID()
          Returns the value of the Content-Id header of this sub-message
 java.lang.String getContentType()
          Returns the content type of this multipart sub-message as specified by its Content-Type headers.
 java.lang.String getDisposition()
          Returns the content-disposition of this multipart sub-message.
 java.lang.String getFileName()
          Returns the file name of the file that this sub-message represents.
 java.lang.String getHeader(java.lang.String headerName)
          Returns the value of a header with a specified name that is set for this multipart sub-message.
 java.lang.String[] getHeaderValues(java.lang.String headerName)
          Returns the values of headers with specified name of this multipart sub-message.
abstract  java.io.InputStream getInputStream()
          Returns an input stream for reading the body of this multipart sub-message.
 java.lang.String getName()
          Returns the name of the body of this multipart sub-message.
 int getSize()
          Returns the size of the body of this multipart sub-message.
 java.lang.String getTransferEncoding()
          Returns the value of the Content-Transfer-Encoding header of this sub-message
 boolean isFormParameter()
          Returns if this multipart sub-message represents a form-based request parameter as specified by RFC 1867.
 void removeHeader(java.lang.String headerName)
          Removes a header with specified name from this multipart sub-message.
 void setHeader(java.lang.String headerName, java.lang.String headerValue)
          Sets a header with specified name and value in this multipart sub-message.
abstract  void setText(java.lang.String text)
          Sets a body of this multipart sub-message.
abstract  void writeTo(java.io.OutputStream outputstream)
          Writes this multipart sub-message to an output stream according to the multipart message's syntax.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

protected int size

headers

protected java.util.Hashtable headers
Constructor Detail

MultipartPart

public MultipartPart()
Method Detail

getSize

public int getSize()
Returns the size of the body of this multipart sub-message.
Returns:
The size of the sub-message body

getContentType

public java.lang.String getContentType()
Returns the content type of this multipart sub-message as specified by its Content-Type headers.
Returns:
The content type of the sub-message

getDisposition

public java.lang.String getDisposition()
Returns the content-disposition of this multipart sub-message. The content-disposition is the value of the Content-Disposition header (without its parameters) of the sub-message.
Returns:
The value of the content-disposition header (without its parameters) of this message

getName

public java.lang.String getName()
Returns the name of the body of this multipart sub-message. The name is the value of the parameter "name" of the Content-Disposition header of this sub-message
Returns:
The name of this sub-message

isFormParameter

public boolean isFormParameter()
Returns if this multipart sub-message represents a form-based request parameter as specified by RFC 1867.
Returns:
True, if this sub-message represents a form-based request parameter, and false otherwise

getFileName

public java.lang.String getFileName()
Returns the file name of the file that this sub-message represents. The sub-message can represent a file if the http multipart message has the same syntax as the one defined by RFC 1867.
Returns:
The name of the file this sub-message represents or null if the message doesn't represent a file as defined by RFC 1867

getInputStream

public abstract java.io.InputStream getInputStream()
Returns an input stream for reading the body of this multipart sub-message.
Returns:
An input stream for reading the body of this multipart sub-message.

getBody

public byte[] getBody()
               throws java.io.IOException
Returns a byte array containing the body of this multipart sub-message.
Returns:
The body of this message represented as byte array. The size of the byte array is equal to the size of the body.

setText

public abstract void setText(java.lang.String text)
Sets a body of this multipart sub-message.
Parameters:
text - A String representing the sub-message body

writeTo

public abstract void writeTo(java.io.OutputStream outputstream)
Writes this multipart sub-message to an output stream according to the multipart message's syntax.
Parameters:
outputstream - An output stream where the message will be written to

getHeader

public java.lang.String getHeader(java.lang.String headerName)
Returns the value of a header with a specified name that is set for this multipart sub-message.
Parameters:
headerName - The name of the header that is set
Returns:
The value of the first header with the specified name that is set for this message, or null if such header does not exist

getHeaderValues

public java.lang.String[] getHeaderValues(java.lang.String headerName)
Returns the values of headers with specified name of this multipart sub-message.
Parameters:
headerName - The name of the header that is set
Returns:
An array with the values of all headers with the specified name, or null if such headers do not exist

setHeader

public void setHeader(java.lang.String headerName,
                      java.lang.String headerValue)
Sets a header with specified name and value in this multipart sub-message. If the sub-message already contains headers with the same name, they will be removed.
Parameters:
headerName - The name of the header that will be set
headerValue - The value of the header that will de set

addHeader

public void addHeader(java.lang.String headerName,
                      java.lang.String headerValue)
Adds a header with specified name and value in this multipart sub-message.
Parameters:
headerName - The name of the header that will be added
headerValue - The value of the header that will de added

removeHeader

public void removeHeader(java.lang.String headerName)
Removes a header with specified name from this multipart sub-message.
Parameters:
headerName - The name of the header that will be removed

getAllHeaderNames

public java.util.Enumeration getAllHeaderNames()
Returns an enumeration of the names of all headers of this multipart sub-message. Each element of this enumeration is a String representing the name of the next header.
Returns:
An enumeration of the names of all headers of this multipart sub-message

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Returns the value of the character encoding of this sub-message as specified by its Content-type header
Returns:
The value of the character encoding of this sub-message

getTransferEncoding

public java.lang.String getTransferEncoding()
Returns the value of the Content-Transfer-Encoding header of this sub-message
Returns:
The value of the Content-Transfer-Encoding header of this sub-message

getContentID

public java.lang.String getContentID()
Returns the value of the Content-Id header of this sub-message
Returns:
The value of the Content-Id header of this sub-message

SAP J2EE Engine

Version 6.40


Copyright © 2001-2005 SAP AG. All Rights Reserved.