Hi,

Can't you just inject it?

@Inject
private ServletContext servletContext;

-- 
Chris

On Wed, Aug 24, 2011 at 3:25 PM, Barry Books <trs...@gmail.com> wrote:

> I just spent about 30 minutes looking for a way to get the
> ServletContext. I knew it was available but I could not remember which
> service provides it. So while I was searching I was thinking it might
> be nice to have a set of Interfaces/Services that define all the
> public services. For Tapestry core that might be TapestryCoreServices
> and TapestryCoreRequestServices to differentiate between global
> services and ones that are request specific. This would help with a
> few things. One I could just say
>
> @Inject
> private TapestryCoreServices coreServices;
>
> then just
> coreServices.getApplicationGlobals().getServletContext()
>
> This would cut down on the number of fields I need to create just to
> call a few methods. Secondly I think would make it more obvious which
> services are public and which are internal. I realize the package does
> that but who looks at the package name? Lastly I think it would be
> easier for new comers to learn what services are available. The last
> one is not a complaint about the documentation but more a comment
> about how useful code completion can be.
>
> So in short the Interface would give you a starting point to all the
> services available from a module. The naming convention could continue
> such as TapestryIOCServices etc.
>
> Thanks
> Barry
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: dev-h...@tapestry.apache.org
>
>

Reply via email to