Hi Asim,

I am not sure that you can inject entire HttpServlet. The reason I say
that is because of what HiveDoc shows. On tapestry home page, if you
expand "Framework" and then "Reports", you will have option to view
some interesting documentation. In this case you're interested in
HiveDoc which documents what is available to you from the
microkernel's globals:

http://jakarta.apache.org/tapestry/tapestry/hivedocs/module/tapestry.globals.html

If you're ultimately after ServletContext, then you can inject that
also (see above documentation).

Good Luck
Adam

On 3/21/06, Asim Khaja <[EMAIL PROTECTED]> wrote:
> Thanks Adam,
> I am not sure if this is related, but would i do the same technquie if i
> wanted to get the HttpServet so that i can do something like
>
> String filePath = cycle.getRequestContext
> ().getServlet().getServletContext().getInitParameter("documentFileRootPath");
>
> That code was valid for tapestry 3, but i guess the getServlet() method has
> been removed.  Would i just do
>
> @InjectObject("service:tapestry.globals.HttpServlet")
>   public abstract HttpServlett getServlet();
>
> Is there a way w/o using the Inject annotation, because I'ld like to be able
> to do this in a Global object that wont be declared as abstract.
>
> Thx,
> Asim
>
>
> On 3/21/06, Adam Zimowski <[EMAIL PROTECTED]> wrote:
> >
> >         @InjectObject("service:tapestry.globals.HttpServletRequest")
> >         public abstract HttpServletRequest getServletRequest();
> >
> > Tapestry will do the magic and give you a valid reference.
> >
> > On 3/21/06, Asim Khaja <[EMAIL PROTECTED]> wrote:
> > > I'd like to get the HTTPServletRequest and HTTPServletResponse, so that
> > i
> > > can use the RequestDispatcher to forward my application to another
> > servlet.
> > > I found that I can do
> > >         HttpServletRequest req = cycle.getRequestContext().getRequest();
> > >         HttpServletResponse res = cycle.getRequestContext
> > ().getResponse()
> > > but, this way results in a warning, becuase getRequestContext() has been
> > > deprecated, what is the best way to accomplish the same thing using
> > tapestry
> > > 4.0?
> > >
> > >
> > > Should I add
> > >
> > > <invoke-factory
> > > service-id="hivemind.lib.ServicePropertyFactory<
> > http://jakarta.apache.org/tapestry/tapestry/hivedocs/service/hivemind.lib.ServicePropertyFactory.html
> > >"
> > > model="singleton<
> > http://jakarta.apache.org/tapestry/tapestry/hivedocs/config/hivemind.ServiceModels.html
> > >"
> > > >
> > >
> > >    - <construct property="request" service-id="RequestGlobals" />
> > >
> > > </invoke-factory>
> > >
> > > to my hivemodule.xml and then do
> > >
> > > <page-specification class=". . .">
> > >
> > >   <inject property="request" object="service:RequestGlobals"/>
> > >
> > > </page-specification>
> > >
> > >
> > > ?
> > >
> > > Thanks,
> > > Asim
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to