Player APIs (BrightScript & Ja...
...
Object Reference
Networking Objects

roHttpEvent

11min
this event object is used to handle requests generated by the rohttpserver object ifhttpevent getfailurereason() as string yields additional useful information if a function return indicates an error getmethod() as string returns the type of http method that triggered the event on the rohttpserver instance setresponsebodystring(body as string) sets the response body for an event generated via the addgetfromevent() or addmethodtostring() method on the rohttpserver object this call is ignored with any other event setresponsebodyfile(filename as string) as boolean specifies the name of a file to use as the source response body for an event generated via the addgetfromevent() or addmethodtostring() method on the rohttpserver object this call is ignored with any other event this function will return false if the file cannot be opened or another failure occurs the specified file is read gradually as it is sent to the client getrequestbodystring() as string returns the string received if the event was generated via rohttpserver addposttostring() an empty string is returned with any other event getrequestbodyfile() as string returns the name of the temporary file created if the event is generated via rohttpserver addgetfromevent this call is ignored with any other event getrequestheader(header name as string) as string returns the value of the specified http request header if the header does not exist, an empty string is returned getrequestheaders() as object returns an roassociativearray containing all the http request headers getrequestparam(uri parameter as string) as string returns the value of the specified uri parameter if the parameter does not exist, an empty string is returned getrequestparams() as object returns an roassociativearray containing all the uri parameters addresponseheader(header as string, value as string) as boolean adds the specified http header and value to the response this function returns true upon success addresponseheaders(a as object) as boolean adds the specified http header/value pairs to the response this method expects an roassociativearray of header names mapped to header values, which can be of type rostring , roint , or rofloat any other value types will cause the request to fail, though a subset of headers to might be set before the failure occurs this function returns true upon success sendresponse(http status code as integer) as boolean sends the http response using the specified http status code to ensure that the response is sent, this function needs to be called once the script has finished handling the event this function returns false upon failure getformdata() as object returns an roassociativearray containing all the form data see the entry on rohttpserver addposttoformdata() for more information geturl() as string ifuserdata setuserdata(user data as object) sets the user data that will be returned when events are raised getuserdata() as object returns the user data that has previously been set via setuserdata() it will return invalid if no data has been set