For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.


HTTP adapter connectionPolicy element

The connectionPolicy element of the adapter-descriptor file lets you configure settings for our adapter's HTTP connection.

This page describes only the connectionPolicy element of the adapter-descriptor file. For information about other elements, see The JavaScript adapter-descriptor file.


Structure

The following example of a connectionPolicy element shows its structure.

<connectionPolicy xsi:type="http:HTTPConnectionPolicyType"; cookiePolicy="cookie-policy" maxRedirects="10"> <protocol>protocol</protocol> <domain>host-name</domain> <port>host-port</port> <connectionTimeoutInMilliseconds>connection_timeout</connectionTimeoutInMilliseconds> <socketTimeoutInMilliseconds>socket_timeout</socketTimeoutInMilliseconds> <authentication> … </authentication> <proxy> … </proxy> <sslCertificateAlias>ssl-certificate-alias</sslCertificateAlias> <sslCertificatePassword>ssl-certificate-password</sslCertificatePassword> <maxConcurrentConnectionsPerNode>max_concurrent_connections</maxConcurrentConnectionsPerNode> </connectionPolicy>


Attributes

The connectionPolicy element has the following attributes.

xsi:type

Mandatory.

The value of this attribute must be http:HTTPConnectionPolicyType.

cookiePolicy

Optional.

This attribute sets how the HTTP adapter handles cookies that arrive from the back-end application. The following values are valid.

  • BEST_MATCH: default value
  • BROWSER_COMPATIBILITY
  • RFC_2109
  • RFC_2965
  • NETSCAPE
  • IGNORE_COOKIES
For more information about these values, see HTTP components.
maxRedirects

Optional.

The maximum number of redirects that the HTTP adapter can follow. This attribute is useful when the back-end application sends circular redirects as a result of some error, such as authentication failures. If this attribute is set to 0, the adapter does not attempt to follow redirects at all, and the HTTP 302 response is returned to the user. The default value is 10.


Subelements

The connectionPolicy element has the following subelements.

protocol

Optional.

The URL protocol to use. The following values are valid.

  • http: default
  • https
domain

Mandatory.

The host address.

port

Optional.

The port address.

sslCertificateAlias

Optional for regular HTTP authentication and simple SSL authentication.

Mandatory for mutual SSL authentication.

The alias of the adapter private SSL key, which is used by the HTTP adapter key manager to access the correct SSL certificate in the keystore. For more information about the keystore setup process, see Using SSL in HTTP adapters.

sslCertificatePassword

Optional for regular HTTP authentication and simple SSL authentication.

Mandatory for mutual SSL authentication.

The password of the adapter private SSL key, which is used by the HTTP adapter key manager to access the correct SSL certificate in the keystore. For more information about the keystore setup process, see Using SSL in HTTP adapters.

authentication

Optional.

Authentication configuration of the HTTP adapter. The HTTP adapter can use one of two authentication protocols. Define the <authentication> element, as follows:

  • Basic authentication

    <authentication> <basic/> </authentication>

  • Digest authentication

    <authentication> <digest/> </authentication>

The connection policy can contain a <serverIdentity> element. This feature applies to all authentication schemes. For example:

<authentication> <basic/> <serverIdentity> <username></username> <password></password> </serverIdentity> </authentication>

proxy

Optional.

The proxy element specifies the details of the proxy server to use when accessing the back-end application. Add a proxy element inside the connectionPolicy element. The proxy details must include the protocol domain and port. If the proxy requires authentication, add a nested authentication element inside proxy. This element has the same structure as the one used to describe the authentication protocol of the adapter. For more information, see the authentication element.

The following example shows a proxy that requires basic authentication and uses a server identity.

<connectionPolicy xsi:type="http:HTTPConnectionPolicyType"> <protocol>http</protocol> <domain>www.bbc.co.uk</domain> <proxy> <protocol>http</protocol> <domain>wl-proxy</domain> <port>8167</port> <authentication> <basic/> <serverIdentity> <username>${proxy.user}</username> <password>${proxy.password}</password> </serverIdentity> </authentication> </proxy> </connectionPolicy>

maxConcurrentConnectionsPerNode

Optional.

Defines the maximum number of concurrent connections, which the MobileFirst Server can open to the back end.

IBM MobileFirst™ Platform Foundation does not limit the incoming service requests from applications. This subelement can be configured at the application server level. This product limits only the number of concurrent HTTP connections to the back-end service.

The default number of concurrent HTTP connections is 50. We can modify this number based on the expected concurrent requests to the adapter and the maximum requests allowed on the back-end service. We can also configure the back-end service to limit the number of concurrent incoming requests.

Consider a two-node system, where the expected load on the system is 100 concurrent requests and the back-end service can support up to 80 concurrent requests. We can set maxConcurrentConnectionsPerNode to 40. This setting ensures that no more than 80 concurrent requests are made to the back-end service.

If you increase the value, the back-end application needs more memory. To avoid memory issues, do not to set this value too high. Instead, estimate the average and peak number of transactions per second, and evaluate their average duration. Then, calculate the number of required concurrent connections as indicated in this example, and add a 5-10% margin. Then, monitor your back end, and adjust this value as required, to ensure that your back-end application can process all incoming requests.

When we deploy adapters to a cluster, set the value of this attribute to the maximum required load divided by the number of cluster members.

For more information about how to size your back-end application, see the Scalability and Hardware Sizing document and its accompanying hardware calculator spreadsheet at Developer Center website for IBM MobileFirst Platform Foundation.

connectionTimeoutInMilliseconds

Optional.

The timeout in milliseconds until a connection to the back-end can be established. Setting this timeout does not ensure that a timeout exception occurs after a specific time elapses after the invocation of the HTTP request.

If you pass a different value for this parameter in the invokeHTTP() JavaScript function, we can override the value that is defined here. For more information, see the WL.Server class.

socketTimeoutInMilliseconds

Optional.

The timeout in milliseconds between two consecutive packets, starting from the connection packet. Setting this timeout does not ensure that a timeout exception occurs after a specific time elapses after the invocation of the HTTP request.

If you pass a different value for the socketTimeoutInMilliseconds parameter in the invokeHttp() JavaScript function, we can override the value that is defined here. For more information, see the WL.Server class.

Parent topic: The JavaScript adapter-descriptor file