Java Reference
In-Depth Information;
public void filter(ContainerRequestContext
requestContext) throws IOException { + " on " +
As you can see, we implement two pretty straightforward interfaces: Container-
RequestFilter and ContainerResponseFilter . We simply log some informa-
tion about the HTTP request and response. To activate the filter, we use the @Provider
annotation; without additional configuration, the filter will work for every REST resource
in our application. Additionally, if we would like to reject a request in the filter, there is a
requestContext.abortWith method.
The client side has two corresponding interfaces: ClientRequestFilter and Cli-
entResponseFilter . The implementations, however, must be registered manually.
Now the REST service is complete and we can start deploying it in the usual way:
mvn package wildfly:deploy
If you followed all the steps so far, the http://localhost:8080/ticket-
agency-ws/rest/seat GET method issued by your browser should print out the list
of available seats:
. . . . . .
Going to http://localhost:8080/ticket-agency-ws/rest/account will
result in:
You should also see some log statements from our filter in the console, for instance:
Search WWH ::

Custom Search