Thank you Oskar for your brisk response!
> Or, you roll your own that usually usually let's it's
> superclass pick the character encoding, but returns null on
> selected requests.
That is what I would like to avoid if possible. I do not want to hard-wire
action bean names/classes/binding urls in the locale picker's logic - hard
to maintain and keep in mind.
> Alternatively, as you describe that this will not work for
> you, you can implement your own StreamingResolution. You can
> reuse Stripes' version like
> this:
>
> StreamingResolution res = new StreamingResolution(
> "application/pdf", new ByteArrayInputStream( data ) ) {
> protected void stream(HttpServletResponse response)
> throws Exception
> {
> response.setCharacterEncoding(characterEncoding);
> super.stream(response);
> }
> }
> res.setCharacterEncoding( null );
> res.setFilename( "some file name.pdf");
> return res;
Upon investigation of StreamingResolution source I see that my
res.setCharacterEncoding( null ) cannot work and see what you wanted to
achieve by overriding the stream method. Unfortunatelly doing
response.setCharacterEncoding(null) in the stream method does not seem to
work. In the end I have to reset the response like so:
getContext().getResponse().reset();
StreamingResolution res = new StreamingResolution( ....)
...
I did not investigate this further to see why
response.setCharacterEncoding(null) executed in the stream() method does not
remove the charset from the Content-Type (could be a bug in Tomcat 6, or in
Stripes).
Anyway, I still feel there should really be two _separate_ methods for
obtaining the request and response character encoding in the LocalePicker
API - the rationale being that IMO nothing mandates that request charset
encoding always matches the response charset encoding (I admit it is very
offen the case, but not always as we see in this common "download some
generic octet stream data" case).
Cheers,
Jan
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users