Last night I was able to find the following code online which works great in JBoss and Tomcat (same containers I believe), however it will not work with WebLogic. This code wraps the response and buffers it so the calling Servlet can then view the rendered content of the JSP.
The one thing I do notice is that the ByteArrayOutputSteam is not explicity written to... is this handled by JBoss' container implicitly? (I made note of it in the code below lines 52 - 58) If anyone has any ideas, can you let me know...
Do you get the content even when the jsp contains struts tags. I am experiencing problems in getting the contents of JSP having the struts tags. What happens is i do get the content but it throws an exception on the browser like ..
I finally figured out how to get the content of the JSP from my servlet code. I used a ResponseWrapper object. I am running into an issue now though when I try and change the responses content type to "text/plain". The JSP still renders as HTML and not as plain text.
Below is the pseudo code as the real code is at work and I dont have access to it:
The following does not work as the content type is ultimately now changed. The only thing I can think of is that there are other filters (which there are) that are setting the content type. I thought this wouldnt be an issue since I placed my filter at the end of the filter section within the web.xml file. Since the web.xml file calls the filters in the order in which they are placed, I figured my filter would be called last and the response would be able to set the content type.
Does anyone have any ideas on how I might fix this?
Your mind is under my control .... your will is now mine .... read this tiny ad