#1 2014-11-19 15:32:44

marcosfilho
Member
Registered: 2014-08-04

How to get HttpRequest in a script

Hey guys,

How can I get HttpServletRequest, HttpServletResponse and Session in a rs script?

Thanks

Offline

#2 2014-11-20 23:31:39

Thorsten J. Krause
Guest

Re: How to get HttpRequest in a script

Hi Marcos,

you can access these objects (if available) like this:

def requestProvider = GLOBALS.getProvider(HttpServletRequest.class)
HttpServletRequest req = requestProvider.get()

Instead of getProvider() you might need to use getRsServiceProvider() depending on your version.
You can also use GLOBALS.getInstance() (or getRsService() in older versions) to directly retrieve an instance instead of a provider.

Cheers,
Thorsten

#3 2014-11-21 22:45:57

marcosfilho
Member
Registered: 2014-08-04

Re: How to get HttpRequest in a script

Thanks a lot Thorsten.

Offline

Board footer

Powered by FluxBB