[progress Communities] [progress Openedge Abl] Forum Post: Re: Pas4oe + Webspeed + Cookie

Status
Not open for further replies.
P

Peter Judge

Guest
I can give a very quick outline Your HandleGet() method will (in 11.6.2 and beyond) be generated to look something like the below. In there you can change the oResponse object y adding cookies. You can also read them off the poRequest object. API doc for the response is at documentation.progress.com/.../OpenEdge.Net.HTTP.IHttpResponse.html METHOD OVERRIDE PROTECTED INTEGER HandleGet( INPUT poRequest AS OpenEdge.Web.IWebRequest ): DEFINE VARIABLE oResponse AS OpenEdge.Net.HTTP.IHttpResponse NO-UNDO . DEFINE VARIABLE oWriter AS OpenEdge.Web.WebResponseWriter NO-UNDO . DEFINE VARIABLE oBody AS OpenEdge.Core.String NO-UNDO . /* The WebResponse body is a wrapper around an entire HTTP response message. It contains a status code and reason; headers; cookies and a message body. API-level doc for this and related classes can be found at documentation.progress.com/.../ */ ASSIGN oResponse = NEW OpenEdge.Web.WebResponse() oResponse:StatusCode = INTEGER (StatusCodeEnum: OK ) . /* This body object can be a string or something else (JsonObject for instance) */ ASSIGN oBody = NEW OpenEdge.Core.String( 'Hello pjudge' + '~r~n' :u /*CRLF */ + 'This message was returned by HandleGet in starnovaHandler.' ). ASSIGN oResponse:Entity = oBody /* HTTP messages require a content type */ oResponse:ContentType = 'text/plain' :u /* ContentLength is good too */ oResponse:ContentLength = oBody: Size . /* The WebResponseWriter ensures that the status line and all headers are writted out before the message body/entity. */ ASSIGN oWriter = NEW WebResponseWriter(oResponse). oWriter: Open (). /** HTTP MESSAGE ENTITY APPROACH **/ /* The Progress.IO.OutputStream Write() methods take multiple overloads, for a variety of data types. See the doc for more information. */ oWriter: Write (oBody: Value ). /* Finish writing the response message */ oWriter: Close (). /* A response of 0 means that this handler will build the entire response; a non-zero value is mapped to a static handler in the webapp's /static/error folder. The mappings are maintained in the webapps's WEB-INF/web.xml A predefined set of HTTP status codes is provided in the OpenEdge.Net.HTTP.StatusCodeEnum enumeration */ RETURN 0 . END METHOD . po

Continue reading...
 
Status
Not open for further replies.
Top