|
High-Level Language SWSRESP (SWCPRE) FunctionRelated Topics
SWSRESP (entry point "SWCPRE") is a high level function used to buffer customized outbound HTTP response headers for subsequent transmission to Web client browsers. SWSRESP may be used to buffer an HTTP response header at any time during the life of a Web transaction. Using SWSRESP to buffer HTTP response headers differs from merely writing these headers using SWSSEND:
The Server merges the HTTP response headers which have been buffered using SWSRESP with any other data generated by the Web transaction. This merge processing takes place when the Web transaction ends and causes the complete output stream to be assembled and transmitted to the client. SWSRESP is only valid when a Web transaction procedure is operating in server-parsed header mode since the merging/assembly, described above, is disabled in non-parsed-header mode. A call to SWSRESP will return an error if the Web transaction is not operating in server-parsed header mode.
CALL ArgumentsThe SWSRESP (entry point "SWCPRE") function takes five arguments. All five arguments must be specified on the call.
Return ValuesSWSRESP always sets a signed numeric return code value. Possible values are:
The SWSRESP operation is not logged to the Server's wrap-around trace file unless an error occurs. If you need to trace information sent using SWSRESP, use the SENDTRACE keyword of the /*WWW rule header.
PL/I ExampleDCL SCONN PTR; /* Connection Handle */ DCL HDATA CHAR(256); /* Header area */ DCL HSIZE FIXED BIN(31); /* Header length */ DCL BDATA CHAR(256); /* Body area */ DCL BSIZE FIXED BIN(31); /* Body length */ DCL DMHX FIXED BIN(31) BASED; /* Dummy Handle field */ ADDR(SCONN)->DMHX=0; /* Zero connection handle */ HDATA="Pragma"; /* Set header data */ HSIZE=6; /* Set header length */ BDATA="no-cache"; /* Set body data */ BSIZE=8; /* Set body length */ CALL SWSRESP(SCONN /* Send the response */ SWS_RESPONSE_ADD, HDATA, HSIZE, BDATA, BSIZE); RC=PLIRETV(); /* Get return code */ IF RC ^=SWS_SUCCESS THEN /* exit if bad RC */ EXIT;
C ExampleHDBC sConn = NULL; /* Connection Handle */ char hData[] = "Pragma"; /* Header text */ char bData[] = "no-cache"; /* body text */ long RC; /* return code */ rc = SWSResp(&sConn, /* send the response */ SWS_RESPONSE_ADD, hData, SWS_NTS, bData, SWS_NTS); If(rc ^=SWS_SUCCESS) return; /* exit if bad rc */
COBOL Example77 SCONN USAGE IS POINTER. 77 HDATA PIC X(80). 77 HSIZE PIC S9(5) COMP. 77 BDATA PIC X(80). 77 BSIZE PIC S9(5) COMP. MOVE 'Pragma' TO HDATA. MOVE 6 TO HSIZE. MOVE 'no-cache' TO BDATA. MOVE 8 TO BSIZE. CALL 'SWCPRE' USING SCONN, SWS-RESPONSE-ADD, HDATA, HSIZE, BDATA, BSIZE. MOVE RETURN CODE TO WS-SWSAPI-RETURN-CODE. IF NOT SWS-SUCCESS GOBACK.
|