• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

html processing

 
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks bob
I will try to use HttpServletRequestWrapper
and see if its answering my problem .

 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bob
how do i use HttpServletRequestWrapper to execute other servlet ?
i cannot find the correct way ,
10000 thanks ,
sharon
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://java.sun.com/j2ee/1.3/docs/tutorial/doc/Servlets8.html
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pradeep Bhat:
http://java.sun.com/j2ee/1.3/docs/tutorial/doc/Servlets8.html

 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic