You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beehive.apache.org by Jongjin Choi <gu...@hotmail.com> on 2004/10/29 07:04:49 UTC

Using ServiceLifecycle in petstore.jws

Hi, Jonathan.

How about implementing javax.xml.rpc.server.SeviceLifecycle in petstore.jws.

In obtainImage(), I see the following code.

ServletEndpointContext sec = (ServletEndpointContext)
   MessageContext.getCurrentContext()
   .getProperty(Constants.MC_SERVLET_ENDPOINT_CONTEXT);

There is a standard way to achive this.

If we use ServletLifecycle, the petstore.jws may look like:

import javax.xml.rpc.server.ServiceLifecycle;

public class petstore implements ServiceLifecycle {
    private ServletEndpointContext sec;

    public void init(Object context) {
       sec = (ServletEndpointContext) context;
    }

    public void destroy() {
    }
     
     ...
}

After that, the obtainImage() can be simpler and we need not import axis's classes from 
petstore.jws (more portable sample).

/Jongjin.

PS. Another question. Is there is any reason that the class is named 'petstore' instead of 'Petstore'?
What about following Java naming convention?

=======================================
Jongjin Choi

Java Webservices team, Tmax Soft.
company homepage : 
   http://www.tmax.co.kr
   http://www.tmaxsoft.com                   
email : jjchoe at tmax dot co dot kr
        gunsnroz at hotmail dot com
=======================================