axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ron Reynolds" <...@RonReynolds.com>
Subject Re: Application/Server/Service scope objects
Date Mon, 07 Nov 2005 22:33:34 GMT
well, within a web-app you can use the servlet context - you can get to it via
the MessageContext:
  MessageContext ctx = MessageContext.getCurrentContext();
  Servlet servlet = (Servlet)ctx.getProperty(HTTPConstants.MC_HTTP_SERVLET);
  ServletConfig config = servlet.getServletConfig();
  ServletContext context = config.getServletContext();

since the servlet context is a web-app-wide Map which is good for the life of
the web-app that sounds similar to what you're describing.  not as kewl as
JNDI, but not as expensive either. :)  not too different from a global
singleton HashMap, really...

> Thanks for the reply Ron.
>
>
>
>>
>> MyObject myobj =3D (MyObject))getApplicationScope ().getObject(
>> "MyDefinedObject" );
>>
>> looks a whole lot like a JNDI lookup to me.
>
>
> I didn't mean JNDI lookup, I really just meant like J2EE application,
> servlet, page, session scopes, thought there might be something similar in
> Axis/SOAP (like the runtime classes available).
>
>
>
> if this is all within a single VM, tho, can't you just address this with a
>> basic singleton?
>
>
> I want it application-wide, not just available to one class etc...
>
> Thanks for the reply, does this explain a little more?
>



Mime
View raw message