Modules.override is the best way to override bindings, but you probably
don't want to do that here given that other internals will depend on an
injection of httprequest (and also I'm not sure if it's possible to use
this technique to override httprequest in the first place).

As potential alternatives here, you could:

1) bind your wrapper to a provider that itself has an injection of the
original HttpRequest, and inject the wrapper to the class that need it
2) decompose the benefits of the wrapper to see if you can substitute its
use by means of injecting derived values from the original request

On Sun, Nov 27, 2011 at 9:21 PM, Alexander Urmuzov <[email protected]>wrote:

> I've got a filter that wraps HttpServletResponse like this:
>
>         HttpServletRequest httpRequest = (HttpServletRequest)
> servletRequest;
>         HttpServletResponse httpResponse = (HttpServletResponse)
> servletResponse;
>         ...
>         OutputStream out = httpResponse.getOutputStream();
>         GenericResponseWrapper wrapper = new
> GenericResponseWrapper(httpResponse);
>
>         filterChain.doFilter(servletRequest, wrapper);
>
>         String content = new String(wrapper.getData(),
> httpResponse.getCharacterEncoding());
>         String designedContent = design.process(content, features);
>         out.write(designedContent.getBytes());
>
>         out.close();
>
> The problem comes when I try to inject Provider<HttpServletResponse>.
> Injected HttpServletResponse is not an instance of GenericResponseWrapper,
> it is a original HttpServletResponse. So it breaks my application.
> Maybe it is a correct behavior, but i need to override 
> HttpServletResponsebinding. How can I achieve it?
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-guice/-/rmiLj9x_ws0J.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to