dw.svc
Class HTTPService
Object
dw.svc.Service
dw.svc.HTTPService
Represents an HTTP Service.
All Known Subclasses
Properties
authentication  :  String
The authentication type.
cachingTTL  :  Number
The caching time to live value.
client  :  HTTPClient  (Read Only)
The underlying HTTP client object.
encoding  :  String
The request body encoding to declare.
outFile  :  File
The output file, or null if there is none.
requestMethod  :  String
The request method.
Constructor Summary
This class does not have a constructor, so you cannot create it directly. To get an instance of this class, use one of the subclass constructors.
Method Summary
addHeader(name : String, val : String) : HTTPService
Adds an HTTP Header.
addParam(name : String, val : String) : HTTPService
Adds a query parameter that will be appended to the URL.
getAuthentication() : String
Returns the authentication type.
getCachingTTL() : Number
Returns the caching time to live value.
getClient() : HTTPClient
Returns the underlying HTTP client object.
getEncoding() : String
Returns the request body encoding to declare.
getOutFile() : File
Returns the output file, or null if there is none.
getRequestMethod() : String
Returns the request method.
setAuthentication(authentication : String) : HTTPService
Sets the type of authentication.
setCachingTTL(ttl : Number) : HTTPService
Enables caching for GET requests.
setEncoding(encoding : String) : HTTPService
Sets the encoding of the request body (if any).
setOutFile(outFile : File) : HTTPService
Sets the output file in which to write the HTTP response body.
setRequestMethod(requestMethod : String) : HTTPService
Sets the HTTP request method.
Methods inherited from class Service
Methods inherited from class Object
Method Detail
addHeader
addHeader(name : String, val : String) : HTTPService
Adds an HTTP Header.
Parameters:
name - Header name.
val - Header value.
Returns:
this HTTP Service.

addParam
addParam(name : String, val : String) : HTTPService
Adds a query parameter that will be appended to the URL.
Parameters:
name - Parameter name.
val - Parameter value.
Returns:
this HTTP Service.

getAuthentication
getAuthentication() : String
Returns the authentication type.
Returns:
Authentication type.

getCachingTTL
getCachingTTL() : Number
Returns the caching time to live value.
Returns:
The caching time to live value in seconds.

getClient
getClient() : HTTPClient
Returns the underlying HTTP client object.
Returns:
HTTP client object.

getEncoding
getEncoding() : String
Returns the request body encoding to declare.
Returns:
Request encoding.

getOutFile
getOutFile() : File
Returns the output file, or null if there is none.
Returns:
Output file or null.

getRequestMethod
getRequestMethod() : String
Returns the request method.
Returns:
HTTP Request method.

setAuthentication
setAuthentication(authentication : String) : HTTPService
Sets the type of authentication. Valid values include "BASIC" and "NONE".

The default value is BASIC.

Parameters:
authentication - Type of authentication.
Returns:
this HTTP Service.

setCachingTTL
setCachingTTL(ttl : Number) : HTTPService
Enables caching for GET requests.

This only caches status codes 2xx with a content length and size of less than 50k that are not immediately written to file. The URL and the user name are used as cache keys. The total size of cacheable content and the number of cached items is limited and automatically managed by the system.

Cache control information sent by the remote server is ignored.

Caching HTTP responses should be done very carefully. It is important to ensure that the response really depends only on the URL and doesn't contain any remote state information or time information which is independent of the URL. It is also important to verify that the application sends exactly the same URL multiple times.

Parameters:
ttl - The time to live for the cached content in seconds. A value of 0 disables caching.

setEncoding
setEncoding(encoding : String) : HTTPService
Sets the encoding of the request body (if any).

The default value is UTF-8.

Parameters:
encoding - Encoding of the request body.
Returns:
this HTTP Service.

setOutFile
setOutFile(outFile : File) : HTTPService
Sets the output file in which to write the HTTP response body.

The default behavior is to not write a file.

Parameters:
outFile - Output file, or null to disable.
Returns:
this HTTP Service.

setRequestMethod
setRequestMethod(requestMethod : String) : HTTPService
Sets the HTTP request method.

Valid values include GET, PUT, POST, and DELETE.

The default value is POST.

Parameters:
requestMethod - HTTP request method.
Returns:
this HTTP Service.