Functions of ballerina.net.http package
function addHeader(string key, string value)
Adds a transport header to the message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
key | string | The header name |
value | string | The header value |
function addHeader(string key, string value)
Adds a transport header to the message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
key | string | The header name |
value | string | The header value |
function clone() (Request )
Clones and creates a new instance of a request message
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
Request | request: The new instance of the request message |
function clone() (Response )
Clones and creates a new instance of a response message
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
Response | response: The new instance of the response message |
function createSessionIfAbsent() (Session )
Gets the session struct for valid id, otherwise create new
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
Session | Session: HTTP session struct |
function forward(Response resp)
Forwards client service response directly to the caller.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
resp | Response | The new instance of the response message |
function getAttribute(string attributeKey) (any )
Gets the session attribute
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
attributeKey | string | HTTPSession attribute key |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
any | any: HTTPSession attribute value |
function getAttributeNames() (string[] )
Gets the session attribute names
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string[] | string[]: HTTPSession attribute name array |
function getBinaryPayload() (blob )
Gets the message payload in BLOB format
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
blob | json: The BLOB reresentation of the message payload |
function getBinaryPayload() (blob )
Gets the message payload in BLOB format
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
blob | json: The BLOB reresentation of the message payload |
function getContentLength() (int )
Gets the Content-Length header from the message
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | int: length of the message |
function getContentLength() (int )
Gets the Content-Length header from the message
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | int: length of the message |
function getCreationTime() (int )
Gets the session creation time
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | int: HTTPSession creation time |
function getFormParams() (map )
Gets formParam map from HTTP message
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
map | map: The map of form params |
function getHeader(string headerName) (string )
Gets a transport header from the message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
headerName | string | The header name |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | string: The header value |
function getHeader(string headerName) (string )
Gets a transport header from the message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
headerName | string | The header name |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | string: The header value |
function getHeaders() (string[] )
Gets transport headers from the message
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string[] | string[]: The header values |
function getHeaders() (string[] )
Gets transport headers from the message
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string[] | string[]: The header values |
function getId() (string )
Gets the session id
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | string: HTTPSession id |
function getJsonPayload() (json )
Gets the message payload in JSON format
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
json | json: The JSON reresentation of the message payload |
function getJsonPayload() (json )
Gets the message payload in JSON format
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
json | json: The JSON reresentation of the message payload |
function getLastAccessedTime() (int )
Gets the session last accessed time
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | int: HTTPSession last accessed time |
function getMaxInactiveInterval() (int )
Gets the session max inactive interval
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | int: HTTPSession max inactive interval |
function getMethod() (string )
Gets the HTTP method from the message
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | string: http method value |
function getProperty(string propertyName) (string )
Retrieve a message property
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
propertyName | string | The name of the property |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | string: The property value |
function getProperty(string propertyName) (string )
Retrieve a message property
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
propertyName | string | The name of the property |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | string: The property value |
function getQueryParams() (map )
Gets queryParam map from HTTP message
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
map | map: The map of query params |
function getRequestURL() (string )
Gets the request URL from the message
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | string: The request URL value |
function getSession() (Session )
Gets the session struct for valid id
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
Session | Session: HTTP session struct |
function getStatusCode() (int )
Gets the HTTP status code from the message
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | int: http status code |
function getStringPayload() (string )
Gets the message payload in string format
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | string: The string representation of the message payload |
function getStringPayload() (string )
Gets the message payload in string format
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | string: The string representation of the message payload |
function getXmlPayload() (xml )
Gets the message payload in XML format
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
xml | xml: The XML representation of the message payload |
function getXmlPayload() (xml )
Gets the message payload in XML format
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
xml | xml: The XML representation of the message payload |
function invalidate()
Gets the session attribute
Parameters:
Parameter Name | Data Type | Description |
---|
function isNew() (boolean )
Gets the session status
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
boolean | boolean: HTTPSession status |
function removeAllHeaders()
Removes all transport headers from the message
Parameters:
Parameter Name | Data Type | Description |
---|
function removeAllHeaders()
Removes all transport headers from the message
Parameters:
Parameter Name | Data Type | Description |
---|
function removeAttribute(string attributeKey)
Remove the session attribute
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
attributeKey | string | HTTPSession attribute key |
function removeHeader(string key)
Removes a transport header from the message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
key | string | The header name |
function removeHeader(string key)
Removes a transport header from the message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
key | string | The header name |
function send()
Sends outbound response to the caller.
Parameters:
Parameter Name | Data Type | Description |
---|
function setAttribute(string attributeKey, any attributeValue)
Sets session attributes to the message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
attributeKey | string | HTTPSession attribute key |
attributeValue | any | HTTPSession attribute Value |
function setContentLength(int contentLength)
Sets the Content-Length header on the message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
contentLength | int | Length of the message |
function setContentLength(int contentLength)
Sets the Content-Length header on the message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
contentLength | int | Length of the message |
function setHeader(string key, string value)
Sets the value of a transport header
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
key | string | The header name |
value | string | The header value |
function setHeader(string key, string value)
Sets the value of a transport header
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
key | string | The header name |
value | string | The header value |
function setJsonPayload(json payload)
Sets the message payload using a JSON object
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
payload | json | The JSON payload object |
function setJsonPayload(json payload)
Sets the message payload using a JSON object
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
payload | json | The JSON payload object |
function setMaxInactiveInterval(int timeInterval)
Sets session max inactive interval
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
timeInterval | int | HTTPSession max inactive interval |
function setProperty(string propertyName, string propertyValue)
Sets a message property
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
propertyName | string | The name of the property |
propertyValue | string | The value of the property |
function setProperty(string propertyName, string propertyValue)
Sets a message property
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
propertyName | string | The name of the property |
propertyValue | string | The value of the property |
function setReasonPhrase(string reasonPhrase)
Sets a custom HTTP Reason phrase
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
reasonPhrase | string | Reason phrase value |
function setStatusCode(int statusCode)
Sets the HTTP StatusCode on the message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
statusCode | int | HTTP status code |
function setStringPayload(string payload)
Sets the message payload using a string object
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
payload | string | The string payload object |
function setStringPayload(string payload)
Sets the message payload using a string object
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
payload | string | The string payload object |
function setXmlPayload(xml payload)
Sets the message payload using an XML object
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
payload | xml | The XML payload object |
function setXmlPayload(xml payload)
Sets the message payload using an XML object
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
payload | xml | The XML payload object |
Connectors of ballerina.net.http package
connector ClientConnector (string serviceUri, Options connectorOptions)
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
serviceUri | string | |
connectorOptions | Options |
action delete(string path, Request req)
The DELETE action implementation of the HTTP connector
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
path | string | Resource path |
req | Request | A request message |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
Response | response: The response message |
action execute(string httpVerb, string path, Request req)
Invokes an HTTP call with the specified HTTP verb.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
httpVerb | string | HTTP verb value |
path | string | Resource path |
req | Request | A request message |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
Response | response: The response message |
action get(string path, Request req)
GET action implementation of the HTTP Connector
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
path | string | Request path |
req | Request | A request message |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
Response | response: The response message |
action head(string path, Request req)
The HEAD action implementation of the HTTP Connector.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
path | string | Resource path |
req | Request | A request message |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
Response | response: The response message |
action patch(string path, Request req)
The PATCH action implementation of the HTTP Connector.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
path | string | Resource path |
req | Request | A request message |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
Response | response: The response message |
action post(string path, Request req)
The POST action implementation of the HTTP Connector.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
path | string | Resource path |
req | Request | A request message |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
Response | response: The response message |
action put(string path, Request req)
The PUT action implementation of the HTTP Connector.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
path | string | Resource path |
req | Request | A request message |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
Response | response: The response message |
Structs of ballerina.net.http package
struct FollowRedirects
Fields:
Field Name | Data Type | Description |
---|---|---|
enabled | boolean | |
maxCount | int |
struct Options
Fields:
Field Name | Data Type | Description |
---|---|---|
port | int | |
endpointTimeout | int | |
followRedirects | FollowRedirects | |
ssl | SSL |
struct Request
Fields:
Field Name | Data Type | Description |
---|
struct Response
Fields:
Field Name | Data Type | Description |
---|
struct SSL
Fields:
Field Name | Data Type | Description |
---|---|---|
trustStoreFile | string | |
trustStorePassword | string | |
keyStoreFile | string | |
keyStorePassword | string | |
sslEnabledProtocols | string | |
ciphers | string | |
sslProtocol | string |
struct Session
Fields:
Field Name | Data Type | Description |
---|
Annotations of ballerina.net.http package
annotation configuration
Attributes:
Attribute Name | Data Type | Description |
---|---|---|
host | string | |
port | int | |
httpsPort | int | |
basePath | string | |
keyStoreFile | string | |
keyStorePassword | string | |
trustStoreFile | string | |
trustStorePassword | string | |
sslVerifyClient | string | |
certPassword | string | |
sslEnabledProtocols | string | |
ciphers | string | |
sslProtocol | string | |
allowOrigins | string[] | |
allowCredentials | boolean | |
allowMethods | string[] | |
allowHeaders | string[] | |
maxAge | int | |
exposeHeaders | string[] |
annotation resourceConfig
Attributes:
Attribute Name | Data Type | Description |
---|---|---|
methods | string[] | |
path | string | |
consumes | string[] | |
produces | string[] | |
allowOrigins | string[] | |
allowCredentials | boolean | |
allowMethods | string[] | |
allowHeaders | string[] | |
maxAge | int | |
exposeHeaders | string[] |