Map Using handlers to enhance request and response processing

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

About this task

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. You 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.




In this information ...


(Index)

IBM Redbooks, demos, education, and more


Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.



Terms and conditions for product documentation | Feedback

Last updated: Apr 22, 2018 11:08:28 AM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=v800webmob&product=was-nd-mp&topic=twbs_jaxrs_handlers
File name: twbs_jaxrs_handlers.html