You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Application service module that provides several core services to help with HTTP request and HTTP response management.

Syntax

Response = HTTP_Services(Service, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10)

Returns

The meaning of the response value depends on the service.

Parameters

ParameterDescription
ServiceThe name of the service being requested. Required.
Param1 - Param10Generic parameters.

Remarks 

This service module contains the library of critical HTTP communication services. In here are the services that process the HTTP request, sets the relevant HTTP request header fields, sets the HTTP method, and then allows the developer to set the appropriate HTTP response header fields, status code, and body. Many of these services are called automatically from core routines (like the HTTP_MCP controller) so that the critical HTTP request details are accessible to the developer in a very convenient manner.

Services

ServiceDescription
RunHTTPService

Calls the indicated HTTP web service routine.

SetSelfURL

Sets the self URL for the current service. The self URL is the URL that identifies itself. It is typically returned in responses to serve as a self-referencing ID apart from other URLs that might be returned which direct the caller to other services.

GetSelfURL

Returns the self URL for the current service.

SetOECGIRequest

Sets the HTTP request that the OECGI creates to memory so it can be retrieved by later routines. This avoids the need to pass this around into various routines.

GetOECGIRequest

Returns the original HTTP request that the OECGI creates.

GetHTTPValue

Returns a specific HTTP request value. This is normally set within the SetOECGIRequest service. This method is not called directly as other services normally are. It is a generic service that various 'GetHTTPxxxx' services will call. This is why the meta data doesn't include GetHTTPValue but one or more specific GetHTTPxxxx options.

SetRequestHeaderFields

Sets all of the Request Header Fields based on the content of the HTTP request that the OECGI creates. This assumes the SetOECGIRequest service has already been called so that the Request array is in memory.

SetRequestHeaderField

Sets the indicated Request Header Field with the indicated value. This can then be retrieved with a GetRequestHeaderField service call so that server processing can operate accordingly.

GetRequestHeaderFields

Returns all of the Request Header Field names and values. These are formatted as Name : <space> Value <crlf> with an extra <crlf> appended after the last field/value pair.

GetRequestHeaderField

Returns the value previously set for the indicated Request Header Field. The Name argument is case-insensitive but if the indicated Request Header Field has not been set then an error condition will be set.

SetQueryFields

Sets all of the Query Fields based on the content of the HTTP request that the OECGI creates. This assumes the SetOECGIRequest service has already been called so that the Request array is in memory.

SetQueryField

Sets the indicated Query field with the indicated value. This can then be retrieved with a GetQueryField service call so that server processing can operate accordingly.

GetQueryField

Returns the value previously set for the indicated Query Field. If then indicated Query Field has not been set then then an error condition will be set.

SetResponseHeaderField

Sets the indicated Response Header Field with the indicated value. This can then be retrieved with a GetRequestHeaderField service call so that server processing can operate accordingly.

GetResponseHeaderFields

Returns all of the Response Header Field names and values. These are formatted as Name : <space> Value <crlf> with an extra <crlf> appended after the last field/value pair. This also returns the response status since the CGI specification uses the "Status" header field. This will be put into the response before the regular header field/values.

GetResponseHeaderField

Returns the value previously set for the indicated Response Header Field. The Name argument is case-insensitive but if the indicated Response Header Field has not been set then it an error condition will be set.

SetResponseStatus

Sets the HTTP status code to be used in the response. This can be set at any time. If unchanged by other routines this will be the status code used.

GetResponseStatus

Gets the current HTTP status code to be used in the response. If this has not yet been set then code 200 (OK) will be used as a default.

SetResponseBody

Sets the body content to be returned in the response.

GetResponseBody

Gets the current body to be returned in the response.

GetResponseBodyIsBinary

Gets the binary flag associated with the current body. This is normally set by the SetResponseBody service at the time the body content is also set.

GetResponse

Gets the full response, headers and body, to be returned to the HTTP request. This will build the response as needed by OECGI, especially regarding binary data handling.

GetErrorResponse

Creates and returns an error response. This is intended to be used when there is no response body to return to the client. This response will contain the current response status and any error information stored using Error_Services.

DecodePercentString

Decodes the string so that percent-encoded characters are restored to their regular form. This returns the decoded string.

ClearSettings

Clears all of the global common variables used to track header names, values, and the status settings. This will typically only be called within HTTP_MCP when the response is finished and sent back to the OECGI.

GetHomeURL

Returns the Home URL for the web site. It pulls this from SRP_HTTP_FRAMEWORK_SETUP <1>.

GetAPIRootURL

Returns the API Root URL for the web site. It pulls this from SRP_HTTP_FRAMEWORK_SETUP <2>.

GetCapturePath

Returns the capture path for the request and response content. It pulls this from SRP_HTTP_FRAMEWORK_SETUP <3>

GetEnableAuthenticationFlag

Returns the enable authentication flag setting. It pulls this from SRP_HTTP_FRAMEWORK_SETUP <4>. Note: Only an explicit setting of False (0) will turn this flag off.

GetRealmValue

Returns the realm value, which is used by the WWW-Authenticate response header. It pulls this from SRP_HTTP_FRAMEWORK_SETUP <5>.

GetEntryPointService

Returns the entry point service name. It pulls this from SRP_HTTP_FRAMEWORK_SETUP <6>. Default is entry_point.

GetVersion

A carriage-return/line-feed character will be used to separate the two pieces of information.

GetFullEndPointURL

Returns the full URL for the end point. This should correspond with the URL requested by the client.

Param1 - Param10

The proper use of the generic arguments are defined in the definition of each service above.

  • No labels