cdugga
cdugga

Reputation: 3859

Aspectj - intercept HTTP request

Is it possible, using aspectj or other features in spring to intercept a HTTP request and then based on some logic return without executing the target method? I'm trying to create a wrapper around my web service for additional control, the web service is using the Jersey rest API so i cant use spring interceptors and a filter may not be able access the features i need.

Thanks

Upvotes: 1

Views: 1191

Answers (1)

Reimeus
Reimeus

Reputation: 159844

AspectJ is intended for the cross-cutting of bytecode rather than for interception of HTTP requests.

A servlet filter is more appropriate for the interception of Jersey REST requests, in particular, one that implements ContainerRequestFilter. The following segment will be required in the web.xml:

<init-param>
  <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
  <param-value>my.package.to.MyFilterClass</param-value>
</init-param>

See here for more information

Upvotes: 3

Related Questions