Re: Retrieve service name within an handler

From: Bobby Bissett <Robert.Bissett_at_Sun.COM>
Date: Tue, 04 Oct 2005 11:04:03 -0400

> I've wrote a set of services with jwsdp 1.5, which all use the same
> handler (same class, but not same instance I thought).
> This handler is execute each time the server receive a request
> ("handleRequest").
> I must retrieve the name of the service to which each request is
> intended to, but I don't know how to do this efficiently.

With jwsdp 1.5, the simplest way to do this is at deployment time. When
you specify the handler chains, you can pass in an init param with the
service name and then store it inside your handler during the init() method.

Or you could have other handler classes that extend the main class and
use a different one for each when specifying the handler chain. For example:

public class BaseHandler extends/implements... {
     String serviceName = null;
     // other methods

public class Service1Handler extends BaseHandler {
     serviceName = "service1";