Ballerina API Documentation

Functions of ballerina.net.http package

function convertToResponse(message m)

Converts the message into an HTTP response

Parameters:

Parameter NameData TypeDescription
mmessageA message object

function getContentLength(message m) (int )

Gets the Content-Length header from the message

Parameters:

Parameter NameData TypeDescription
mmessageA message object

Return Parameters:

Return VariableData TypeDescription
intlength of the message

function getMethod(message m) (string )

Gets the HTTP method from the message

Parameters:

Parameter NameData TypeDescription
mmessageA message object

Return Parameters:

Return VariableData TypeDescription
stringhttp method value

function getRequestURL(message m) (string )

Gets the request URL from the message

Parameters:

Parameter NameData TypeDescription
mmessageThe message object

Return Parameters:

Return VariableData TypeDescription
stringThe request URL value

function getStatusCode(message m) (int )

Gets the HTTP status code from the message

Parameters:

Parameter NameData TypeDescription
mmessageA message object

Return Parameters:

Return VariableData TypeDescription
inthttp status code

function setContentLength(message m, int contentLength)

Sets the Content-Length header on the message

Parameters:

Parameter NameData TypeDescription
mmessageA message object
contentLengthintLength of the message

function setReasonPhrase(message m, string reasonPhrase)

Sets a custom HTTP Reason phrase

Parameters:

Parameter NameData TypeDescription
mmessageA message object
reasonPhrasestringReason phrase value

function setStatusCode(message m, int statusCode)

Sets the HTTP StatusCode on the message

Parameters:

Parameter NameData TypeDescription
mmessageA message object
statusCodeintHTTP status code


Connectors of ballerina.net.http package

connector ClientConnector (string serviceUri)

Native HTTP Client Connector

Parameters:

Parameter NameData TypeDescription
serviceUristring

Actions:

action delete()

The DELETE action implementation of the HTTP connector

Parameters:

Parameter NameData TypeDescription
cClientConnectorA connector object
pathstringResource path
mmessageA message object

Return Parameters:

Return VariableData TypeDescription
messageThe response message object

action execute()

Invokes an HTTP call with the specified HTTP verb.

Parameters:

Parameter NameData TypeDescription
cClientConnectorA connector object
httpVerbstringHTTP verb value
pathstringResource path
mmessageA message object

Return Parameters:

Return VariableData TypeDescription
messageThe response message object

action get()

GET action implementation of the HTTP Connector

Parameters:

Parameter NameData TypeDescription
cClientConnectorConnector
pathstringRequest path
mmessagemessage

Return Parameters:

Return VariableData TypeDescription
message

action head()

The HEAD action implementation of the HTTP Connector.

Parameters:

Parameter NameData TypeDescription
cClientConnectorA connector object
pathstringResource path
mmessageA message object

Return Parameters:

Return VariableData TypeDescription
messageThe response message object

action patch()

The PATCH action implementation of the HTTP Connector.

Parameters:

Parameter NameData TypeDescription
cClientConnectorA connector object
pathstringResource path
mmessageA message object

Return Parameters:

Return VariableData TypeDescription
messageThe response message object

action post()

The POST action implementation of the HTTP Connector.

Parameters:

Parameter NameData TypeDescription
cClientConnectorA connector object
pathstringResource path
mmessageA message object

Return Parameters:

Return VariableData TypeDescription
messageThe response message object

action put()

The PUT action implementation of the HTTP Connector.

Parameters:

Parameter NameData TypeDescription
cClientConnectorA connector object
pathstringResource path
mmessageA message object

Return Parameters:

Return VariableData TypeDescription
messageThe response message object


Menu

  • Functions
    • convertToResponse(message m)
    • getContentLength(message m) (int )
    • getMethod(message m) (string )
    • getRequestURL(message m) (string )
    • getStatusCode(message m) (int )
    • setContentLength(message m, int contentLength)
    • setReasonPhrase(message m, string reasonPhrase)
    • setStatusCode(message m, int statusCode)
  • Connectors
    • ClientConnector (string serviceUri)
      • delete(ClientConnector c, string path, message m)
      • execute(ClientConnector c, string httpVerb, string path, message m)
      • get(ClientConnector c, string path, message m)
      • head(ClientConnector c, string path, message m)
      • patch(ClientConnector c, string path, message m)
      • post(ClientConnector c, string path, message m)
      • put(ClientConnector c, string path, message m)

Copyright 2017 Ballerina API Documentation