• 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

Entry Filter and Exit Customization

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks,
I have two questions.
1. We had a requirement to add a filter at the entry point of an application (just before the Main servlet) to modify the request. To implement this, I wrote a servlet which did the modification and dispatched it to the Main servlet. Is this the best way to do it? What flexibility would a Filter provide that a full-fledged Servlet does not possess?
2. The servlet I authored for 1 above takes the request from the HTTP Server (Weblogic), modifies it and hands it over to the application. We want to do something similar at the other end. When the application is done creating a web page and is about to push it off to the client; I want to insert my code which will look at the generated web page and make some custom modifications. How can we do this without messing with the application code?
Thanks in advance,
Musafir
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Filters definitely look like a good solution here. You can write filters are intercept both the request and the response.
Take a look at this pdf from Sun's site: Essentials of Filters
 
Sharad Agarwal
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Chris - excellent document.
The document mentions that until Servlet 2.3, many App Servers provided proprietary filter implementations. For the time being I am constrained to Servlet 2.2 (Weblogic5.1) and cannot use Servlet Filters.
I searched the WL5.1 API, but the only filter there is for security (weblogic.security.net.ConnectionFilterImpl). Does anyone know if WL5.1 provides a proprietary filter implementation?
Warm regards,
Musafir
 
reply
    Bookmark Topic Watch Topic
  • New Topic