Package wt.federation
Class FederatedHttpBodyPart
java.lang.Object
wt.federation.FederatedHttpBodyPart
- All Implemented Interfaces:
Externalizable,Serializable
Defines and manages MIME body parts contained in HTTP request and response
messages.
Supported API: true
Extendable: false
Supported API: true
Extendable: false
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor returning an instance initialized with an empty set of MIME headings and null content.FederatedHttpBodyPart(String contentType) Constructor returning an instance initialized with the specified MIME content type and null content.FederatedHttpBodyPart(FederatedHttpInputStream inputStream, String boundary) Constructor returning an instance initialized from the result of reading the specified input stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHeading(String line) Parses and adds the specified line to the set of MIME headings.voidaddHeading(String keyword, String value) Adds the heading specified by keyword/value pair to the set of MIME headings.static StringgetBoundary(String contentType) Returns the boundary string specified within a Content-Type heading.getHeading(String keyword) Returns the heading with the specified keyword.getPart(int index) Returns the body part associated with the specified index.intgetSize()Returns the size, in octets, of the body part.booleanReturns true if this body part is the last body part of a MIME multipart object (its boundary line is the final boundary of the multipart object).booleanReturns true if the content of the body part is a nested multipart object.voidremoveHeading(String keyword) Removes the heading with the specified keyword.intwriteTo(OutputStream outputStream) Writes the body part in HTTP MIME format to the specified output stream, and returns the number of octets written.
-
Constructor Details
-
FederatedHttpBodyPart
Constructor returning an instance initialized with an empty set of MIME headings and null content.
Supported API: true- Throws:
WTPropertyVetoException
-
FederatedHttpBodyPart
Constructor returning an instance initialized with the specified MIME content type and null content.
Supported API: true- Parameters:
contentType-- Throws:
WTPropertyVetoException
-
FederatedHttpBodyPart
public FederatedHttpBodyPart(FederatedHttpInputStream inputStream, String boundary) throws WTPropertyVetoException, FederationServicesException Constructor returning an instance initialized from the result of reading the specified input stream. Reading stops when the specified MIME boundary is detected.
Supported API: true- Parameters:
inputStream-boundary-- Throws:
WTPropertyVetoExceptionFederationServicesException
-
-
Method Details
-
getSize
Returns the size, in octets, of the body part. This can be used in calculating the Content-Length value to be specified in an HTTP request message.
Supported API: true- Returns:
- int
- Throws:
FederationServicesException
-
writeTo
Writes the body part in HTTP MIME format to the specified output stream, and returns the number of octets written. If the output stream argument is null, nothing is written, but the number of bytes that would have been written are returned.
Supported API: true- Parameters:
outputStream-- Returns:
- int
- Throws:
FederationServicesException
-
addHeading
Parses and adds the specified line to the set of MIME headings.
Supported API: true- Parameters:
line-
-
addHeading
Adds the heading specified by keyword/value pair to the set of MIME headings.
Supported API: true- Parameters:
keyword-value-
-
getHeading
Returns the heading with the specified keyword.
Supported API: true- Parameters:
keyword-- Returns:
- String
-
removeHeading
Removes the heading with the specified keyword.
Supported API: true- Parameters:
keyword-
-
isMultipart
public boolean isMultipart()Returns true if the content of the body part is a nested multipart object.
Supported API: true- Returns:
- boolean
-
getBoundary
Returns the boundary string specified within a Content-Type heading.
Supported API: true- Parameters:
contentType-- Returns:
- String
-
getPart
Returns the body part associated with the specified index. If the object is not a multipart object, the object returns itself if the specified index is 0. Null is returned if the specified index is greater than the index of the last body part in the multipart object (or the index is greater than 0 when the object is not a multipart).
Supported API: true- Parameters:
index-- Returns:
- FederatedHttpBodyPart
-
isLastPart
public boolean isLastPart()Returns true if this body part is the last body part of a MIME multipart object (its boundary line is the final boundary of the multipart object).
Supported API: true- Returns:
- boolean
-