aspose file tools*
The moose likes Servlets and the fly likes html processing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "html processing" Watch "html processing" New topic
Author

html processing

Sharon whipple
Ranch Hand

Joined: Jul 31, 2003
Posts: 294
i was wondering , is there any other way to process the output html of servlet beside filters ?
I am trying to avoid changing the source servlets.
using :

will sent the servlet html output directly to the client ,
any ideas ?!?!?
[ August 10, 2003: Message edited by: sharon pl ]
Bob Kerfoot
Ranch Hand

Joined: Oct 01, 2000
Posts: 47
sharon,
You can use the HttpServletRequestWrapper and HttpServletResponseWrapper classes with RequestDispatcher.include(request,response).
Per the Javadocs for RequestDispatcher.include:
"The request and response parameters must be either the same objects as were passed to the calling servlet's service method or be subclasses of the ServletRequestWrapper or ServletResponseWrapper classes that wrap them. "
Let me know if you need more details.
Bob Kerfoot
bkerfoot@wideopenwest.com
Sharon whipple
Ranch Hand

Joined: Jul 31, 2003
Posts: 294
thanks bob
I will try to use HttpServletRequestWrapper
and see if its answering my problem .

Sharon whipple
Ranch Hand

Joined: Jul 31, 2003
Posts: 294
Hi Bob
how do i use HttpServletRequestWrapper to execute other servlet ?
i cannot find the correct way ,
10000 thanks ,
sharon
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

http://java.sun.com/j2ee/1.3/docs/tutorial/doc/Servlets8.html


Groovy
aney thomas
Greenhorn

Joined: Sep 04, 2003
Posts: 1
Sharon whipple
Ranch Hand

Joined: Jul 31, 2003
Posts: 294
i see ,
so i use HttpServletRequestWrapper in the exact same way :
charArrayWriter.write(wrapper.toString().substring(0,wrapper.toString().indexOf("</body>")-1));
and the wrapper.toString() method will give me the HTML code .

thank you vary much !
i will try to run this code .
Sharon
Eelco den Heijer
Ranch Hand

Joined: Jan 17, 2002
Posts: 61
i was wondering , is there any other way to process the output html of servlet beside filters ?
I am trying to avoid changing the source servlets.

Actually, filters act as a decorator pattern; you can place them before or after the service method. You have to write the filter, and change the deployment descriptor (so you do have to alter the descriptor); you never have to change the actual servlet code.
Hope this helps.


== <br />Rgrds,<br />Eelco<br /> <br />SCJP, SCJD, SCBCD, SCWD, SCEA
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html processing