Dec 2nd, 2008, 10:19 AM
Working with the servlet output stream directly
I have created a number of Views that manage the response stream themselves. The data i have is not html and is constructed dynamically so i don't need any templates, jsps, etc. Can someone comment on the best practice for doing this.
I am extending AbstractView and overriding renderMergedOutputModel. I set the content type and character encoding and write the data out. Should i now flush and close the output stream? Is this something that the spring framework and/or application server takes care off?
Dec 2nd, 2008, 04:25 PM
The application server takes care of flush and close. You can work with the stream using more specialized spring view classes as well, i.e if a view and a model is expected as a return you simply return null.
Dec 3rd, 2008, 03:28 AM
Which view classes would be best? To give you an idea of what i am doing, I need to output X<L generated by JAXB, and text/plain messages. Is there and spring support for any of these?
Dec 3rd, 2008, 07:42 AM
I think that u dont need any more layers of abstraction. You can use direct OOP in conjunction with the controller, in the case of JAXB.