|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||

java.lang.Objectorg.xlightweb.Part
public class Part
Part
| Constructor Summary | |
|---|---|
Part(File file)
constructor |
|
Part(IHeader header,
ByteBuffer[] body)
constructor |
|
Part(IHeader header,
File file)
constructor |
|
Part(IHeader header,
NonBlockingBodyDataSource body)
constructor |
|
Part(IHeader header,
String body)
constructor |
|
Part(String contentType,
ByteBuffer[] body)
constructor |
|
Part(String contentType,
String body)
constructor |
|
| Method Summary | |
|---|---|
void |
addHeader(String headername,
String headervalue)
Adds a header with the given name and value. |
void |
addHeaderLine(String line)
adds a raw header line |
void |
addHeaderlines(String... lines)
adds raw header lines |
boolean |
containsHeader(String headername)
Returns a boolean indicating whether the named header has already been set. |
BlockingBodyDataSource |
getBlockingBody()
|
BodyDataSource |
getBody()
returns the blocking body |
String |
getCharacterEncoding()
Returns the name of the character encoding used in the body of this message. |
String |
getContentType()
Returns the MIME type of the body of the messag, or null if the type is not known. |
String |
getDisposition()
returns the content disposition header of the part, or null if the type is not known. |
String |
getDispositionParam(String name)
returns the content disposition param value or null if not setsee also rfc2183 |
String |
getDispositionType()
returns the content disposition type or null if not setsee also rfc2183 |
String |
getHeader(String headername)
Returns the value of the specified header as a String. |
String |
getHeader(String headername,
String dfltValue)
Returns the value of the specified header as a String. |
List<String> |
getHeaderList(String headername)
Returns all the values of the specified header as an List of String objects. |
Enumeration |
getHeaderNames()
Returns an enumeration of all the header names. |
Set<String> |
getHeaderNameSet()
Returns an set of all the header names. |
Enumeration |
getHeaders(String headername)
Returns all the values of the specified header as an Enumeration of String objects. |
NonBlockingBodyDataSource |
getNonBlockingBody()
returns the non-blocking body |
IHeader |
getPartHeader()
returns the part header |
String |
getTransferEncoding()
returns the Transfer-Encoding header parameter or null if the header is not set |
boolean |
hasBody()
returns true if the part has a body |
void |
removeHeader(String headername)
removes a header with the given name |
void |
setContentType(String type)
sets the MIME type of the body of the part |
void |
setHeader(String headername,
String headervalue)
Sets a header with the given name and value. |
void |
setTransferEncoding(String transferEncoding)
sets the Transfer-Encoding parameter |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Part(String contentType,
String body)
throws IOException
contentType - the content typebody - the body
IOException - if an exception occurs
public Part(IHeader header,
String body)
throws IOException
header - the headerbody - the body
IOException - if an exception occurs
public Part(String contentType,
ByteBuffer[] body)
throws IOException
contentType - the content typebody - the body
IOException - if an exception occurs
public Part(File file)
throws IOException
file - the file
IOException - if an exception occurs
public Part(IHeader header,
File file)
throws IOException
header - the headerfile - the file
IOException - if an exception occurs
public Part(IHeader header,
ByteBuffer[] body)
throws IOException
header - the headerbody - the body
IOException - if an exception occurs
public Part(IHeader header,
NonBlockingBodyDataSource body)
throws IOException
header - the headerbody - the body
IOException - if an exception occurs| Method Detail |
|---|
public IHeader getPartHeader()
getPartHeader in interface IPart
public final NonBlockingBodyDataSource getNonBlockingBody()
throws IOException
getNonBlockingBody in interface IPartnull if parte is bodyless
IOExceptionpublic final boolean hasBody()
hasBody in interface IPart
public final BlockingBodyDataSource getBlockingBody()
throws IOException
getBlockingBody in interface IPartIOException
public BodyDataSource getBody()
throws IOException
getBody in interface IPartnull if part is bodyless
IOException
public final void addHeader(String headername,
String headervalue)
addHeader in interface IHeaderheadername - the name of the headerheadervalue - the additional header value. If it contains octet string, it should be encoded
according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt)public final void addHeaderLine(String line)
addHeaderLine in interface IHeaderline - the headerlinepublic final void addHeaderlines(String... lines)
addHeaderlines in interface IHeaderlines - the headerlinespublic final boolean containsHeader(String headername)
containsHeader in interface IHeadertrue if the named header has already been set; false otherwisepublic final String getCharacterEncoding()
getCharacterEncoding in interface IHeaderString containing the name of the character encodingpublic final String getContentType()
null if the type is not known.
getContentType in interface IHeaderString containing the name of the MIME type of
the message, or null if the type is not knownpublic final String getDisposition()
null if the type is not known.
getDisposition in interface IHeaderString containing the name of the content disposition of
the part, or null if the type is not knownpublic final String getDispositionParam(String name)
null if not set
getDispositionParam in interface IHeadername - the parameter name
null if not setpublic final String getDispositionType()
null if not set
getDispositionType in interface IHeadernull if not setpublic final String getHeader(String headername)
String.
If the part did not include a header of the specified name,
this method returns null.
If there are multiple headers with the same name, this method
returns the first head in the part.
getHeader in interface IHeaderheadername - a String specifying the header name
String containing the value of the
requested header, or null if the part
does not have a header of that name
public String getHeader(String headername,
String dfltValue)
String.
If the part did not include a header of the specified name,
this method returns null.
If there are multiple headers with the same name, this method
returns the first head in the part.
getHeader in interface IHeaderheadername - a String specifying the header namedfltValue - the default value if the header is not set
String containing the value of the
requested header, or null if the part
does not have a header of that namepublic final List<String> getHeaderList(String headername)
List of String objects.
Some headers, such as Accept-Language can be set
by part producer as several headers each with a different value rather than
sending the header as a comma separated list.
getHeaderList in interface IHeaderheadername - a String specifying the header name
List containing the values of the requested header.
If the part does not have any headers of that name return an empty enumeration.public final Enumeration getHeaderNames()
getHeaderNames in interface IHeaderpublic final Set<String> getHeaderNameSet()
getHeaderNameSet in interface IHeaderpublic final Enumeration getHeaders(String headername)
Enumeration of String objects.
Some headers, such as Accept-Language can be set
by part producer as several headers each with a different value rather than
sending the header as a comma separated list.
getHeaders in interface IHeaderheadername - a String specifying the header name
Enumeration containing the values of the requested header.
If the part does not have any headers of that name return an empty enumeration.public final String getTransferEncoding()
null if the header is not set
getTransferEncoding in interface IHeadernull if the header is not setpublic final void removeHeader(String headername)
removeHeader in interface IHeaderheadername - the name of the headerpublic final void setContentType(String type)
setContentType in interface IHeadertype - the MIME type of the body of the part
public final void setHeader(String headername,
String headervalue)
setHeader in interface IHeaderheadername - the name of the headerheadervalue - the header value If it contains octet string,
it should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt)public final void setTransferEncoding(String transferEncoding)
setTransferEncoding in interface IHeadertransferEncoding - the Transfer-Encoding parameterpublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||