You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Pierre-Alain RIVIERE <pa...@ippon.fr> on 2008/10/07 17:37:54 UTC
Re: Problem injecting ApplicationStateManager
into service implementing commons-upload ProgressListener
Using your method do not solve my NPE calling ApplicationStateManager.
BUT! now I can inject HttpServletRequest in my ProgressListenerImpl
(instead of ApplicationStateManager) and get my state object using
-----------------------------------------------------------------
(UserData) request.getSession().getAttribute(
"aso:" + UserData.class.getName())
-----------------------------------------------------------------
It's not a definitive, just a workaround but I can keep working on other
functionality now. Thanks :D
Note : This code doesn't work without the contribution to
RequestHandler.
On Tue, 2008-10-07 at 16:42 +0200, Francois Armand wrote:
> Francois Armand wrote:
> [...].
>
> So, I have no idea why the bug is not always here.
>
> But it happens that the problem was that I try to use (tapestry) Request
> before the call to requestGlobals.storeRequestResponse(request,
> response); was done : I'm in a RequestHandler, and this is done in the
> terminator of requesthandler pipeline.
>
> So, I just did :
>
> public static RequestFilter buildSetRequestResponse(final
> RequestGlobals requestGlobals) {
> return new RequestFilter(){
> public boolean service(Request request, Response response,
> RequestHandler handler) throws IOException {
> requestGlobals.storeRequestResponse(request, response);
> return handler.service(request, response);
> }
> };
> }
>
> public static void
> contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration,
> @InjectService("setRequestResponse") RequestFilter
> setRequestResponse,
> .... (other handlers)) {
> configuration.add("setRequestResponse", setRequestResponse,
> "before:*");
> ...
> }
>
>
> And now, everything works.
>
> I believe it could need a bugreport, as it seems quite ok to want to use
> the Request object (and not only the HttpRequest's one) in RequestHandler.
>
> Hope it's really that, and that is may help other people.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org