Ballerina API Documentation

Functions of ballerina.net.http package

function addHeader(string key, string value)

Adds a transport header to the message

Parameters:

Parameter NameData TypeDescription
keystringThe header name
valuestringThe header value

function addHeader(string key, string value)

Adds a transport header to the message

Parameters:

Parameter NameData TypeDescription
keystringThe header name
valuestringThe header value

function clone() (Request )

Clones and creates a new instance of a request message

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
Requestrequest: The new instance of the request message

function clone() (Response )

Clones and creates a new instance of a response message

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
Responseresponse: The new instance of the response message

function createSessionIfAbsent() (Session )

Gets the session struct for valid id, otherwise create new

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
SessionSession: HTTP session struct

function forward(Response resp)

Forwards client service response directly to the caller.

Parameters:

Parameter NameData TypeDescription
respResponseThe new instance of the response message

function getAttribute(string attributeKey) (any )

Gets the session attribute

Parameters:

Parameter NameData TypeDescription
attributeKeystringHTTPSession attribute key

Return Parameters:

Return VariableData TypeDescription
anyany: HTTPSession attribute value

function getAttributeNames() (string[] )

Gets the session attribute names

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
string[]string[]: HTTPSession attribute name array

function getBinaryPayload() (blob )

Gets the message payload in BLOB format

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
blobjson: The BLOB reresentation of the message payload

function getBinaryPayload() (blob )

Gets the message payload in BLOB format

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
blobjson: The BLOB reresentation of the message payload

function getContentLength() (int )

Gets the Content-Length header from the message

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
intint: length of the message

function getContentLength() (int )

Gets the Content-Length header from the message

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
intint: length of the message

function getCreationTime() (int )

Gets the session creation time

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
intint: HTTPSession creation time

function getFormParams() (map )

Gets formParam map from HTTP message

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
mapmap: The map of form params

function getHeader(string headerName) (string )

Gets a transport header from the message

Parameters:

Parameter NameData TypeDescription
headerNamestringThe header name

Return Parameters:

Return VariableData TypeDescription
stringstring: The header value

function getHeader(string headerName) (string )

Gets a transport header from the message

Parameters:

Parameter NameData TypeDescription
headerNamestringThe header name

Return Parameters:

Return VariableData TypeDescription
stringstring: The header value

function getHeaders() (string[] )

Gets transport headers from the message

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
string[]string[]: The header values

function getHeaders() (string[] )

Gets transport headers from the message

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
string[]string[]: The header values

function getId() (string )

Gets the session id

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
stringstring: HTTPSession id

function getJsonPayload() (json )

Gets the message payload in JSON format

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
jsonjson: The JSON reresentation of the message payload

function getJsonPayload() (json )

Gets the message payload in JSON format

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
jsonjson: The JSON reresentation of the message payload

function getLastAccessedTime() (int )

Gets the session last accessed time

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
intint: HTTPSession last accessed time

function getMaxInactiveInterval() (int )

Gets the session max inactive interval

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
intint: HTTPSession max inactive interval

function getMethod() (string )

Gets the HTTP method from the message

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
stringstring: http method value

function getProperty(string propertyName) (string )

Retrieve a message property

Parameters:

Parameter NameData TypeDescription
propertyNamestringThe name of the property

Return Parameters:

Return VariableData TypeDescription
stringstring: The property value

function getProperty(string propertyName) (string )

Retrieve a message property

Parameters:

Parameter NameData TypeDescription
propertyNamestringThe name of the property

Return Parameters:

Return VariableData TypeDescription
stringstring: The property value

function getQueryParams() (map )

Gets queryParam map from HTTP message

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
mapmap: The map of query params

function getRequestURL() (string )

Gets the request URL from the message

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
stringstring: The request URL value

function getSession() (Session )

Gets the session struct for valid id

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
SessionSession: HTTP session struct

function getStatusCode() (int )

Gets the HTTP status code from the message

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
intint: http status code

function getStringPayload() (string )

Gets the message payload in string format

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
stringstring: The string representation of the message payload

function getStringPayload() (string )

Gets the message payload in string format

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
stringstring: The string representation of the message payload

function getXmlPayload() (xml )

Gets the message payload in XML format

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
xmlxml: The XML representation of the message payload

function getXmlPayload() (xml )

Gets the message payload in XML format

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
xmlxml: The XML representation of the message payload

function invalidate()

Gets the session attribute

Parameters:

Parameter NameData TypeDescription

function isNew() (boolean )

Gets the session status

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
booleanboolean: HTTPSession status

function removeAllHeaders()

Removes all transport headers from the message

Parameters:

Parameter NameData TypeDescription

function removeAllHeaders()

Removes all transport headers from the message

Parameters:

Parameter NameData TypeDescription

function removeAttribute(string attributeKey)

Remove the session attribute

Parameters:

Parameter NameData TypeDescription
attributeKeystringHTTPSession attribute key

function removeHeader(string key)

Removes a transport header from the message

Parameters:

Parameter NameData TypeDescription
keystringThe header name

function removeHeader(string key)

Removes a transport header from the message

Parameters:

Parameter NameData TypeDescription
keystringThe header name

function send()

Sends outbound response to the caller.

Parameters:

Parameter NameData TypeDescription

function setAttribute(string attributeKey, any attributeValue)

Sets session attributes to the message

Parameters:

Parameter NameData TypeDescription
attributeKeystringHTTPSession attribute key
attributeValueanyHTTPSession attribute Value

function setContentLength(int contentLength)

Sets the Content-Length header on the message

Parameters:

Parameter NameData TypeDescription
contentLengthintLength of the message

function setContentLength(int contentLength)

Sets the Content-Length header on the message

Parameters:

Parameter NameData TypeDescription
contentLengthintLength of the message

function setHeader(string key, string value)

Sets the value of a transport header

Parameters:

Parameter NameData TypeDescription
keystringThe header name
valuestringThe header value

function setHeader(string key, string value)

Sets the value of a transport header

Parameters:

Parameter NameData TypeDescription
keystringThe header name
valuestringThe header value

function setJsonPayload(json payload)

Sets the message payload using a JSON object

Parameters:

Parameter NameData TypeDescription
payloadjsonThe JSON payload object

function setJsonPayload(json payload)

Sets the message payload using a JSON object

Parameters:

Parameter NameData TypeDescription
payloadjsonThe JSON payload object

function setMaxInactiveInterval(int timeInterval)

Sets session max inactive interval

Parameters:

Parameter NameData TypeDescription
timeIntervalintHTTPSession max inactive interval

function setProperty(string propertyName, string propertyValue)

Sets a message property

Parameters:

Parameter NameData TypeDescription
propertyNamestringThe name of the property
propertyValuestringThe value of the property

function setProperty(string propertyName, string propertyValue)

Sets a message property

Parameters:

Parameter NameData TypeDescription
propertyNamestringThe name of the property
propertyValuestringThe value of the property

function setReasonPhrase(string reasonPhrase)

Sets a custom HTTP Reason phrase

Parameters:

Parameter NameData TypeDescription
reasonPhrasestringReason phrase value

function setStatusCode(int statusCode)

Sets the HTTP StatusCode on the message

Parameters:

Parameter NameData TypeDescription
statusCodeintHTTP status code

function setStringPayload(string payload)

Sets the message payload using a string object

Parameters:

Parameter NameData TypeDescription
payloadstringThe string payload object

function setStringPayload(string payload)

Sets the message payload using a string object

Parameters:

Parameter NameData TypeDescription
payloadstringThe string payload object

function setXmlPayload(xml payload)

Sets the message payload using an XML object

Parameters:

Parameter NameData TypeDescription
payloadxmlThe XML payload object

function setXmlPayload(xml payload)

Sets the message payload using an XML object

Parameters:

Parameter NameData TypeDescription
payloadxmlThe XML payload object


Connectors of ballerina.net.http package

connector ClientConnector (string serviceUri, Options connectorOptions)

Parameters:

Parameter NameData TypeDescription
serviceUristring
connectorOptionsOptions

Actions:

action delete(string path, Request req)

The DELETE action implementation of the HTTP connector

Parameters:

Parameter NameData TypeDescription
pathstringResource path
reqRequestA request message

Return Parameters:

Return VariableData TypeDescription
Responseresponse: The response message

action execute(string httpVerb, string path, Request req)

Invokes an HTTP call with the specified HTTP verb.

Parameters:

Parameter NameData TypeDescription
httpVerbstringHTTP verb value
pathstringResource path
reqRequestA request message

Return Parameters:

Return VariableData TypeDescription
Responseresponse: The response message

action get(string path, Request req)

GET action implementation of the HTTP Connector

Parameters:

Parameter NameData TypeDescription
pathstringRequest path
reqRequestA request message

Return Parameters:

Return VariableData TypeDescription
Responseresponse: The response message

action head(string path, Request req)

The HEAD action implementation of the HTTP Connector.

Parameters:

Parameter NameData TypeDescription
pathstringResource path
reqRequestA request message

Return Parameters:

Return VariableData TypeDescription
Responseresponse: The response message

action patch(string path, Request req)

The PATCH action implementation of the HTTP Connector.

Parameters:

Parameter NameData TypeDescription
pathstringResource path
reqRequestA request message

Return Parameters:

Return VariableData TypeDescription
Responseresponse: The response message

action post(string path, Request req)

The POST action implementation of the HTTP Connector.

Parameters:

Parameter NameData TypeDescription
pathstringResource path
reqRequestA request message

Return Parameters:

Return VariableData TypeDescription
Responseresponse: The response message

action put(string path, Request req)

The PUT action implementation of the HTTP Connector.

Parameters:

Parameter NameData TypeDescription
pathstringResource path
reqRequestA request message

Return Parameters:

Return VariableData TypeDescription
Responseresponse: The response message


Structs of ballerina.net.http package

struct FollowRedirects

Fields:

Field NameData TypeDescription
enabledboolean
maxCountint

struct Options

Fields:

Field NameData TypeDescription
portint
endpointTimeoutint
followRedirectsFollowRedirects
sslSSL

struct Request

Fields:

Field NameData TypeDescription

struct Response

Fields:

Field NameData TypeDescription

struct SSL

Fields:

Field NameData TypeDescription
trustStoreFilestring
trustStorePasswordstring
keyStoreFilestring
keyStorePasswordstring
sslEnabledProtocolsstring
ciphersstring
sslProtocolstring

struct Session

Fields:

Field NameData TypeDescription


Annotations of ballerina.net.http package

annotation configuration

Attributes:

Attribute NameData TypeDescription
hoststring
portint
httpsPortint
basePathstring
keyStoreFilestring
keyStorePasswordstring
trustStoreFilestring
trustStorePasswordstring
sslVerifyClientstring
certPasswordstring
sslEnabledProtocolsstring
ciphersstring
sslProtocolstring
allowOriginsstring[]
allowCredentialsboolean
allowMethodsstring[]
allowHeadersstring[]
maxAgeint
exposeHeadersstring[]

annotation resourceConfig

Attributes:

Attribute NameData TypeDescription
methodsstring[]
pathstring
consumesstring[]
producesstring[]
allowOriginsstring[]
allowCredentialsboolean
allowMethodsstring[]
allowHeadersstring[]
maxAgeint
exposeHeadersstring[]


Menu

  • Functions
    • addHeader(string key, string value)
    • addHeader(string key, string value)
    • clone() (Request )
    • clone() (Response )
    • createSessionIfAbsent() (Session )
    • forward(Response resp)
    • getAttribute(string attributeKey) (any )
    • getAttributeNames() (string[] )
    • getBinaryPayload() (blob )
    • getBinaryPayload() (blob )
    • getContentLength() (int )
    • getContentLength() (int )
    • getCreationTime() (int )
    • getFormParams() (map )
    • getHeader(string headerName) (string )
    • getHeader(string headerName) (string )
    • getHeaders() (string[] )
    • getHeaders() (string[] )
    • getId() (string )
    • getJsonPayload() (json )
    • getJsonPayload() (json )
    • getLastAccessedTime() (int )
    • getMaxInactiveInterval() (int )
    • getMethod() (string )
    • getProperty(string propertyName) (string )
    • getProperty(string propertyName) (string )
    • getQueryParams() (map )
    • getRequestURL() (string )
    • getSession() (Session )
    • getStatusCode() (int )
    • getStringPayload() (string )
    • getStringPayload() (string )
    • getXmlPayload() (xml )
    • getXmlPayload() (xml )
    • invalidate()
    • isNew() (boolean )
    • removeAllHeaders()
    • removeAllHeaders()
    • removeAttribute(string attributeKey)
    • removeHeader(string key)
    • removeHeader(string key)
    • send()
    • setAttribute(string attributeKey, any attributeValue)
    • setContentLength(int contentLength)
    • setContentLength(int contentLength)
    • setHeader(string key, string value)
    • setHeader(string key, string value)
    • setJsonPayload(json payload)
    • setJsonPayload(json payload)
    • setMaxInactiveInterval(int timeInterval)
    • setProperty(string propertyName, string propertyValue)
    • setProperty(string propertyName, string propertyValue)
    • setReasonPhrase(string reasonPhrase)
    • setStatusCode(int statusCode)
    • setStringPayload(string payload)
    • setStringPayload(string payload)
    • setXmlPayload(xml payload)
    • setXmlPayload(xml payload)
  • Connectors
    • ClientConnector (string serviceUri, Options connectorOptions)
      • delete(Request req)
      • execute(string path, Request req)
      • get(Request req)
      • head(Request req)
      • patch(Request req)
      • post(Request req)
      • put(Request req)
  • Structs
    • FollowRedirects
    • Options
    • Request
    • Response
    • SSL
    • Session
  • Annotations
    • configuration
    • resourceConfig

Copyright 2017 Ballerina API Documentation