Application service module that provides several core services to help with HTTP request and HTTP response management.
Syntax
Response = HTTP_Services(@Service, @Params)
Returns
The meaning of the response value depends on the service.
Parameters
Parameter | Description |
---|---|
@Service | The name of the service being requested. Required. |
@Params | Generic parameters. Refer to a specific service to determine the actual parameters used. |
Remarks
This service module contains the primarily 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 3.x - HTTP_MCP controller) so that the critical HTTP request details are accessible to the developer in a very convenient manner.
Services
Service | Description |
---|---|
3.x - RunHTTPService | Calls the indicated HTTP web service routine. |
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. | |
Returns the self URL for the current service. | |
3.x - SetSessionID | Creates and sets a unique Session ID for the current HTTP Request/Response. This is used to stamp various logs. |
3.x - GetSessionID | Returns the unique Session ID for the current HTTP Request/Response. This is used to stamp various logs. |
3.x - CreateLogFile | Creates a log file in the designated capture path. |
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. | |
Returns the original HTTP request that the OECGI creates. | |
3.x - SetOECGIProcErr | Sets the HTTP ProcErr 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. |
3.x - GetOECGIProcErr | Returns the original HTTP ProcErr that the OECGI creates. |
3.x - SetHTTPValue | Sets a specific HTTP request value. This is normally set within the 3.x - SetOECGIRequest service and done directly using 3.x - Memory_Services for efficiency, but some APIs might need to override an HTTP request value. |
Returns a specific HTTP request value. This is normally set within the 3.x - 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. | |
Sets all of the Request Header Fields based on the content of the HTTP request that the OECGI creates. This assumes the 3.x - SetOECGIRequest service has already been called so that the Request array is in memory. | |
Sets the indicated Request Header Field with the indicated value. This can then be retrieved with a 3.x - GetRequestHeaderField service call so that server processing can operate accordingly. | |
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. | |
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. | |
Sets all of the Query Fields based on the content of the HTTP request that the OECGI creates. This assumes the 3.x - SetOECGIRequest service has already been called so that the Request array is in memory. | |
3.x - SetQueryField | Sets the indicated Query field with the indicated value. This can then be retrieved with a 3.x - GetQueryField service call so that server processing can operate accordingly. |
3.x - 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. |
3.x - SetResponseHeaderField | Sets the indicated Response Header Field with the indicated value. This can then be retrieved with a 3.x - GetRequestHeaderField service call so that server processing can operate accordingly. |
3.x - 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. |
3.x - 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. |
3.x - 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. |
3.x - 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. |
3.x - SetResponseBody | Sets the body content to be returned in the response. |
3.x - GetResponseBody | Gets the current body to be returned in the response. |
3.x - GetResponseBodyIsBinary | Gets the binary flag associated with the current body. This is normally set by the 3.x - SetResponseBody service at the time the body content is also set. |
3.x - 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. |
3.x - 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 3.x - Error_Services. |
3.x - DecodePercentString | Decodes the string so that percent-encoded characters are restored to their regular form. This returns the decoded string. |
3.x - 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 3.x - HTTP_MCP when the response is finished and sent back to the OECGI. |
3.x - GetHomeURL | Returns the Home URL for the web site. It pulls this from 3.x - SRP_HTTP_FRAMEWORK_SETUP <1>. |
3.x - GetAPIRootURL | Returns the API Root URL for the web site. It pulls this from 3.x - SRP_HTTP_FRAMEWORK_SETUP <2>. |
3.x - GetCapturePath | Returns the capture path for the request and response content. It pulls this from 3.x - SRP_HTTP_FRAMEWORK_SETUP <3> |
3.x - GetEnableAuthenticationFlag | Returns the enable authentication flag setting. It pulls this from 3.x - SRP_HTTP_FRAMEWORK_SETUP <4>. Note: Only an explicit setting of False (0) will turn this flag off. |
3.x - GetRealmValue | Returns the realm value, which is used by the WWW-Authenticate response header. It pulls this from 3.x - SRP_HTTP_FRAMEWORK_SETUP <5>. |
3.x - GetEntryPointService | Returns the entry point service name. It pulls this from 3.x - SRP_HTTP_FRAMEWORK_SETUP <6>. Default is entry_point. |
3.x - GetVersion | A carriage-return/line-feed character will be used to separate the two pieces of information. |
3.x - GetFullEndPointURL | Returns the full URL for the end point. This should correspond with the URL requested by the client. |
Returns the flush cache flag setting. It pulls this from 3.x - SRP_HTTP_FRAMEWORK_SETUP <7>. | |
3.x - GetNonAuthenticatedURLs | Returns the list of non-authenticated URLs. It pulls this from 3.x - SRP_HTTP_FRAMEWORK_SETUP <8>. |
3.x - URLRequiresAuthentication | Returns a boolean flag whether the indicated URL requires authentication or not. |
3.x - GetBestContentNegotiation | Returns the best content negotiation match based on the options the server is able to support and the options the client requested in one of the header request fields that supports content negotiation. |
3.x - GetAbortedService | Returns the service handler for aborted HTTP Requests. It pulls this from 3.x - SRP_HTTP_FRAMEWORK_SETUP <9>. |
3.x - GetEnableLoggingFlag | Returns the enable logging flag setting. It pulls this from 3.x - SRP_HTTP_FRAMEWORK_SETUP <10>. Note: Only an explicit setting of False (0) will turn this flag off. |
3.x - GetDebuggerSetting | Returns the value that will be passed into the RTI_Debugger_Setting subroutine. It pulls this from 3.x - SRP_HTTP_FRAMEWORK_SETUP <11>. If no value has been set then a 0 (disabled) is returned as the default. |
3.x - GetDebuggerService | Returns the service handler for aborted HTTP Requests due to runtime errors. It pulls this from 3.x - SRP_HTTP_FRAMEWORK_SETUP <12>. |
Params
The proper use of the generic arguments are defined in the definition of each service above.