Thursday, February 11, 2010

Getting hold of the http request object (ServletRequest) in ADF

Anyhow, this piece of java code can be used to access the http request object, if needed:

((ServletRequest)ADFContext.getCurrent().getEnvironment().getRequest())
 
Normally, i'm not in favour of jumping through hoops to do things that the framework doesn't provide. If it's a framework shortcoming, by all means, go with a good lightweight workaround. But report it, get it fixed!

If the restriction is by design, then look for better ways to achieve the same outcome with the framework's capability (rather than going with pre-concieved notions of what should have been)
In ADF, there are a set of implicit objects that allow declarative, EL access to the most commonly needed data/operations.
The closest to the good old ServletRequest is the requestScope, but somehow, it doesn't seem to contain all the information that the full fledged http request has - this might be by design but I have no evidence either way (I speak as of 11.1.1.1.0).

1 comment:

Anonymous said...

It really is a small world out there JV!!! Im now working on ADF designs, and was googling for this exact topic, when what comes up??? Your blog buddy!!

Steve Macleod