You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ivano Luberti <lu...@archicoop.it> on 2009/05/27 17:49:26 UTC
[Tapestry 4.1] how to get ServletContext inside a service
I have implemented a class that Implements IEngineService interface.
I need to get the ServletContext to finally get the realPath.
Anyone can tell me how to do that?
I have searched for a while without success
--
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [Tapestry 4.1] how to get ServletContext inside a service
Posted by Ivano Luberti <lu...@archicoop.it>.
Thanks Norman, but I guess you use that inside a class that extends
BasePage as I do.
But here I have a concrete class that implements IEngineService.
I use it to return a PDF on the response output stream.
So either I cannot use an abstract class that extends BasePage and
therefore I cannot use the inject/abstract method approach or I'm
missing something in your answer.
Norman Franke ha scritto:
> Here is how I do it:
>
> @InjectObject("service:tapestry.globals.HttpServletRequest")
> public abstract HttpServletRequest getRequest();
>
> public ServletContext getServletContext() {
> return getRequest().getSession().getServletContext();
> }
>
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
>
> On May 27, 2009, at 11:49 AM, Ivano Luberti wrote:
>
>> I have implemented a class that Implements IEngineService interface.
>>
>> I need to get the ServletContext to finally get the realPath.
>>
>> Anyone can tell me how to do that?
>>
>> I have searched for a while without success
>>
>>
>> --
>> ==================================================
>> dott. Ivano Mario Luberti
>> Archimede Informatica societa' cooperativa a r. l.
>> Sede Operativa
>> Via Gereschi 36 - 56126- Pisa
>> tel.: +39-050- 580959
>> tel/fax: +39-050-9711344
>> web: www.archicoop.it
>> ==================================================
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [Tapestry 4.1] how to get ServletContext inside a service
Posted by Norman Franke <no...@myasd.com>.
Here is how I do it:
@InjectObject("service:tapestry.globals.HttpServletRequest")
public abstract HttpServletRequest getRequest();
public ServletContext getServletContext() {
return getRequest().getSession().getServletContext();
}
Norman Franke
Answering Service for Directors, Inc.
www.myasd.com
On May 27, 2009, at 11:49 AM, Ivano Luberti wrote:
> I have implemented a class that Implements IEngineService interface.
>
> I need to get the ServletContext to finally get the realPath.
>
> Anyone can tell me how to do that?
>
> I have searched for a while without success
>
>
> --
> ==================================================
> dott. Ivano Mario Luberti
> Archimede Informatica societa' cooperativa a r. l.
> Sede Operativa
> Via Gereschi 36 - 56126- Pisa
> tel.: +39-050- 580959
> tel/fax: +39-050-9711344
> web: www.archicoop.it
> ==================================================
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
solved: [Tapestry 4.1] how to get ServletContext inside a service
Posted by Ivano Luberti <lu...@archicoop.it>.
in the service point configuration of my service in hivemodule.xml I
hvae put the following:
<set-object property="context" value="infrastructure:context"/>
Then in the java code of the service:
protected WebContext context;
public void setContext(WebContext context) {
this.context = context;
}
I have come to this conlcusion by similarity with
<set-object property="response" value="infrastructure:response"/>
that I have found on the net as an example to get the WebResponse Object.
BUT: how can I find a list of the available entry points ?
Ivano Luberti ha scritto:
> I have implemented a class that Implements IEngineService interface.
>
> I need to get the ServletContext to finally get the realPath.
>
> Anyone can tell me how to do that?
>
> I have searched for a while without success
>
>
>
--
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org