I have an apache ISIS webapplication with several Objects and RestfulServices. For logging-purposes i need some information of the request itself, not only the parameters which should be send. How can I access these Request-Header information?
I tried to get the HttpServletRequest
via the RequestCycle
object. Here is the code-line:
HttpServletRequest req = (HttpServletRequest) RequestCycle.get().getRequest().getContainerRequest();
When I create the objects via apache wicket viewer I get access to the HttpServlerRequest
object and all the information of the request. But when I send the a request via the restful services I get a NullpointerException
when I try to access the RequestCycle
.
Do you have any idea how to access the request header in this domainservice?
Thanks for your help.
When you request with Restful services there is no Wicket RequestCycle at all because WicketFilter is not used for Restful requests.
I cannot help with the rest of the question. I have no experience with this.
If all you require is the Accept headers, then you can use the AcceptHeaderService .
If you need access to anything else then you'll have to roll-your-own. But doing so should be quite easy; take a look at the implementation of aforementioned AcceptHeaderService
along with where it is registered in RestfulObjectsApplication
; you could provide a custom subclass of RestfulObjectsApplication
in the web.xml .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.