users@jersey.java.net

not build a ressource at each request

From: guilhem legal <guilhem.legal_at_geomatys.fr>
Date: Wed, 19 Dec 2007 12:28:03 +0100

hi!

I am develloping a jersey web-service, and i have a little issue :

I have a ressource with a relative hight cost of build, and the
constructor is call at every request.
can we build a ressource only one time?

my resource is coded like this :

@UriTemplate("wms")
public class WMService {
   
    @HttpContext
    private UriInfo context;

 /**
     * Build a new instance of the webService and initialise the JAXB
marshaller.
     */
    public WMService() throws JAXBException, IOException,
WebServiceException {
        
        logger.severe("construteur");
    }

 @HttpMethod("GET")
    public Response treatGETrequest() throws JAXBException {
                               .....
    }

and so i have a print of "constructeur" each request i made.

please reply if you have a solution

regards,
Guilhem Legal