Hi everyone!

I've got something strange going on: I've got an event returning a
Streamresponse that works well with Jetty but just don't in tomcat.

In page "Gestion" I call a method called "onDownload" which code is below,
It asks the DAO the object associated with the id(given in the context) and
returns either an XML with the object's data or a zip with every object's
data (if several).

        Object onDownload() throws IOException {

                String[] id = request.getParameterValues("id");
                if (id != null) {
                        if (id.length == 1) {
                                return new 
XMLDownload(historiqueManager.getHistorique(Long
                                                .parseLong(id[0])));
                        } else {
                                LinkedList<Historique> h = new 
LinkedList<Historique>();

                                for (int i = 0; i < id.length; i++) {
                                        
h.add(historiqueManager.getHistorique(Long.parseLong(id[i])));
                                }
                                return new Zip(h);
                        }
                }
The XMLDownload class is quite simple, and almost directly taken from the
tutorials, you can find the code below:
public class XMLDownload implements StreamResponse{
        private Historique h;
        /**
         * @param h the history object
         */
        public XMLDownload(Historique h) {
                super();                
                this.h = h;
        }
        @Override
        public String getContentType() {
                return "Content-type: application/octet-stream";
        }
        @Override
        public InputStream getStream() throws IOException {
                return new ByteArrayInputStream(h.getData().getBytes()); 
        }
        @Override
        public void prepareResponse(Response response) {
                response.setHeader("Content-Disposition", "attachment;
filename="+h.getFluxId()+"-"+h.getHistId()+".xml");
        }
}

It all runs smoothly with Jetty, but I get the following error with tomcat:
org.apache.tomcat.util.http.parser.TokenMgrError
Lexical error at line 1, column 13. Encountered: ":" (58), after : ""

The path for this call is gestion:download?id=3 

With log tools, I know that the XMLDownload object is created, I just don't
get a chance to download it.
Redirections to pages works well though, So I guess the issue comes from the
StreamResponse because a call (with an hyperlink, like before) to
gestion:cancel works well.

If you got any ideas/propositions, I would be in your debt ;)

Gep

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Streamresponse-with-Tomcat-tp5714475.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to