dw.net
Class HTTPRequestPart
Object
dw.net.HTTPRequestPart
Simple class representing a single part in a multi-part HTTP POST request. A part always has a name, and either a string value or a value which comes from the contents of a File. For each of the two types, a character encoding may be specified, and for file parts, a content type may additionally be specified.

Note: when this class is used with sensitive data, be careful in persisting sensitive information.

Properties
contentType  :  String  (Read Only)
The content type of this part.
encoding  :  String  (Read Only)
Get the charset to be used to encode the string.
fileValue  :  File  (Read Only)
Get the file value of the part.
name  :  String  (Read Only)
Get the name of the part.
stringValue  :  String  (Read Only)
Get the string value of the part.
Constructor Summary
HTTPRequestPart(name : String, value : String)
Construct a part representing a simple string name/value pair.
HTTPRequestPart(name : String, value : String, encoding : String)
Construct a part representing a simple string name/value pair.
HTTPRequestPart(name : String, file : File)
Construct a part representing a name/File pair.
HTTPRequestPart(name : String, file : File, contentType : String, encoding : String)
Construct a part representing a name/File pair.
Method Summary
getContentType() : String
Returns the content type of this part.
getEncoding() : String
Get the charset to be used to encode the string.
getFileValue() : File
Get the file value of the part.
getName() : String
Get the name of the part.
getStringValue() : String
Get the string value of the part.
Methods inherited from class Object
Constructor Detail
HTTPRequestPart
public HTTPRequestPart(name : String, value : String)
Construct a part representing a simple string name/value pair. The HTTP message uses "US-ASCII" as the default character set for the part.
Parameters:
name - The name of the part.
value - The string to post.

HTTPRequestPart
public HTTPRequestPart(name : String, value : String, encoding : String)
Construct a part representing a simple string name/value pair. The HTTP message uses the specified encoding or "US-ASCII" if null is passed for the part.
Parameters:
name - The name of the part.
value - The string to post.
encoding - The charset to be used to encode the string, if null the default is used.

HTTPRequestPart
public HTTPRequestPart(name : String, file : File)
Construct a part representing a name/File pair. The HTTP message will use "application/octet-stream" as the content type and "ISO-8859-1" as the character set for the part.
Parameters:
name - The name of the file part
file - The file to post

HTTPRequestPart
public HTTPRequestPart(name : String, file : File, contentType : String, encoding : String)
Construct a part representing a name/File pair.

  • If both contentType and encoding are null, then the part will be defaulted to use "application/octet-stream" as the content-type and "ISO-8859-1" as the encoding.
  • If only the encoding is null, then the contentType will be used without an encoding.
  • If only the contentType is null, then it will be defaulted to "text/plain".
Parameters:
name - The name of the file part
file - The file to post
contentType - The content type for this part, if null or blank the default is used.
encoding - the charset encoding for this part, if null or blank the default is used

Method Detail
getContentType
getContentType() : String
Returns the content type of this part.
Returns:
The content type, or null if content type was not specified.

getEncoding
getEncoding() : String
Get the charset to be used to encode the string.
Returns:
The charset, or null if charset was not specified.

getFileValue
getFileValue() : File
Get the file value of the part.
Returns:
The file value, or null if this part is not a file part.

getName
getName() : String
Get the name of the part.
Returns:
The part name, never null.

getStringValue
getStringValue() : String
Get the string value of the part.
Returns:
The string value, or null if this part is is not a string part.

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.