Compile insert HTTP_Service_Setup /*********************************************************************************************************************** This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written permission from SRP Computer Solutions, Inc. Name : HTTP_Service_Setup Description : Sets up the current HTTP service by parsing the current URL as needed. Notes : See the comments added below. History : (Date, Initials, Notes) 02/25/15 dmb Original programmer. - [SRPFW-84] 02/22/16 dmb Swap hardcoded URL equates with Xlates from SYSENV\SRP_HTTP_FRAMEWORK_SETUP configuration record. - [SRPFW-103] 02/23/16 dmb Add a work-around fix for IIS web server requests. - [SRPFW-102] 02/25/16 dmb Replace Xlates into SYSENV\SRP_HTTP_FRAMEWORK_SETUP with GetHomeURL and GetAPIRootURL services. - [SRPFW-108] 03/09/16 dmb Refactor code to be more streamlined. Remove several lines of code and optimize for changes to the RunHTTPService service. - [SRPFW-112] ***********************************************************************************************************************/ Common /Debugging/ DebugFlag@ // Utility services. Declare function Error_Services, HTTP_Services, HTTP_Resource_Services, RetStack Declare subroutine Error_Services, HTTP_Services, HTTP_Resource_Services // The API URL is fixed for any application but should be customized for the application itself. This is not always // passed into the request correctly, especially if a proxy service or rewrite rules are being used. APIURL = HTTP_Services('GetAPIRootURL', True$) // The Full End Point URL indicates the URL submitted by the client. FullEndPointURL = HTTP_Services('GetFullEndPointURL') // The HTTP method (or verb) submitted by the client. HTTPMethod = HTTP_Services('GetHTTPRequestMethod') // The Self URL represents the Full End Point URL up to the current segment. This often used in hypermedia responses // so clients know how to trace back. LenRemainingURL = Len(RemainingURL) LenFullEndPointURL = Len(FullEndPointURL) SelfURL = FullEndPointURL[1, (LenFullEndPointURL - LenRemainingURL)] If SelfURL[-1, 1] = '/' then SelfURL[-1, 1] = '' HTTP_Services('SetSelfURL', SelfURL) // The Next Segment is the segment in the URL path that will come immediately after the current segment. This could // represent another service or it could represent an Item ID for the current service/resource. NextSegment = RemainingURL[1, '/'] // Get the name of the current service handler in case it needs to be used for error management. CurrentServiceHandler = RetStack()<1>