There is no "tapestry.globals.HttpServlet" service point. However, there is a "tapestry.globals.ServletContext" service point. You can inject the ServletContext into any service object automatically by providing a "setter" for a property of that type. Then, you call your service and it can do whatever you want with the ServletRequest.
-----Original Message----- From: Asim Khaja [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 12:58 PM To: Tapestry users Subject: Re: Getting HTTPServletRequest and HTTPServletResponse 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.Se rvicePropertyFactory.html > >" > > model="singleton< > http://jakarta.apache.org/tapestry/tapestry/hivedocs/config/hivemind.Service Models.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]