Network Deployment (Distributed operating systems), v8.0 > End-to-end paths > Web services - RESTful services


 Using handlers to enhance request and response processing

We can implement handlers on the server-side of a Java API for RESTful Web Services (JAX-RS) application to enhance request and response processing. JAX-WS

To perform additional operations on messages, you can create a handler that is applied during the processing of a request and a response. Handlers are invoked on every request and response. Custom server-side request handlers are applied after the resource method is found. Custom server-side response handlers are applied before the response is sent back to the client.

There are three distinct handler chains: a request handler chain, a response handler chain, and an error handler chain. Normal requests invoke the request handler chain to find the resource and invoke the resource method. After, the response handler chain then populates the response headers and content. If an error occurs, the error handler chain is invoked. The error handler chain invokes the proper JAX-RS error handling mechanism and then populates the response headers and content.

There are system handlers and user handlers. System handlers implement the core runtime environment for IBM JAX-RS. We can write user handlers to customize the behavior of the handler chain for your JAX-RS application and to add unique functionality to the handler.


Procedure

  1. Configure the development environment.

  2. Define the resources in JAX-RS web applications.

  3. Configure the JAX-RS application.

  4. Implement user handlers for your JAX-RS application.

  5. Assemble JAX-RS web applications.

  6. Deploy JAX-RS web applications.


Results

You have implemented user handlers on the server-side of your JAX-RS application to enhance request and response processing.



Related tasks

Implement user handlers for JAX-RS applications

Related reference

Web services specifications and APIs









+

Search Tips   |   Advanced Search