Re: TextStreamResponse and XML and UTF-8

2008-01-10 Thread 陆惠国
FIX TextStreamResponse public InputStream getStream() throws IOException { ContentType ct = new ContentType(_contentType); String charset = ct.getParameter("charset"); if (StringUtils.isNotBlank(charset)) { return new ByteArrayInputStream(_text.getBytes(charse

Re: TextStreamResponse and XML and UTF-8

2007-11-14 Thread thanos
Yes, forcing the encoding to "UTF-8" inside a ByteArrayInputStream did the trick. It works now! I will soon make some tests to compare the two approaches (Template based XML vs StreamResponse), since perfomance was the main reason I switched to Tapestry. Will keep you posted. Many thanks to all

Re: TextStreamResponse and XML and UTF-8

2007-11-13 Thread Nick Westgate
> The problem is the that I can't make TextStreamResponse to show UTF-8 (greek > in my case) characters. > Dont know if it's related with this post: > > http://www.nabble.com/T5-confused-about-Services-and-XmlHttpResponse-tf4160459.html#a11839004 Yes, my previous post pointed out a solution. Her

Re: TextStreamResponse and XML and UTF-8

2007-11-13 Thread Ezra Epstein
This is another way to do it. Look at the code for TextStreamResponse. Write your own StreamResponse impl that's backed by a ByteArrayInputStream. (The reason I avoid that approach is (a) you create an InputStream to write a response, so under the covers Tap5 is reading from it and writing to

Re: TextStreamResponse and XML and UTF-8

2007-11-13 Thread Fernando Padilla
Essentially, you gave it a string (UTF16 in memory), and it is being converted into bytes ( string.getBytes() within TextStreamResponse ). And the contentType of the response is set also from TextStreamResponse. I would double check what the string.getBytes() is returning, maybe it's actually putt

Re: TextStreamResponse and XML and UTF-8

2007-11-13 Thread thanos
I used boolean beforeRenderTemplate(){ return false; } but couldn't skip rendering check I will currently return xml using a template with the help of Fernando's patch - TAPESTRY-1600. This patch allows the generation of xml, from an xml-based description by fixing the "cutting" of

Re: TextStreamResponse and XML and UTF-8

2007-11-13 Thread Ezra Epstein
You can override one of the page render methods (I think onactivate is one of those, but check the Tap5 website) and return false to tell Tap to skip the other steps of page rendering. thanos <[EMAIL PROTECTED]> wrote: thank you. I tried that but I get a mix of xml and html erro String (i

Re: TextStreamResponse and XML and UTF-8

2007-11-13 Thread thanos
thank you. I tried that but I get a mix of xml and html erro String (insteαd of clean xml document) as a response. Seems that it looks for a template (I dont have one cause I didnt need it with textStreamResponse) Inside onActivate I obtain a PrintWriter from the injected Response, using "applic

Re: TextStreamResponse and XML and UTF-8

2007-11-13 Thread Ezra Epstein
If you're just returning an RSS feed you probably don't want any page wrapping, etc. In that case you can: @Inject private Response _response; You can then do things like setting headers and even write directly to the container-provided OutputStream - bypassing the whole TextStreamResponse --