2

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.

riedelinho
  • 404
  • 1
  • 5
  • 15

2 Answers2

2

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.

martin-g
  • 17,243
  • 2
  • 23
  • 35
2

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.

Dan Haywood
  • 2,215
  • 2
  • 17
  • 23