• 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

ServletMapping (not solved yet)

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody,
I'm programming a webpage, and I currently have some problems, of which I would like to share one with you
The problem is that I'd like to have one servlet which processes all requests. Not really a problem, but I wanted to use a servlet mapping for this. The web.xml looks something like this (btw, I'm using Jrun 3.1):

Now if I type http://localhost/index.html, my servlet grabs this request, and if I do a System.out on request.getRequestURI(), it prints out: /index.html. Exactly what I expected, and exactly according to plan.
Now, the problem is, I'm (almost) not working with html, but with jsp. But if I access (e.g.) index.jsp on my localhost (so I type: http://localhost/index.jsp) my servlet does NOT grab the request. No system.out, nothing.
I have really no idea why this happens, and now my head hurts, and the only smart thing I could come up with was posting my question here. So if you please could help me, it would really save me on the medication.
Thanks for your help,
Greetings, Erik
[ November 14, 2002: Message edited by: Erik Pragt ]
[ November 14, 2002: Message edited by: Erik Pragt ]
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've never used JRun, so I can't help you find *where* it is... but there is probably a more 'global' mapping of *.jsp that JRun must use to invoke the JSP compiler.
 
Erik Pragt
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Mike,
I found out the same thing, so you are right. But do you know how to bypass this?
What my real question is, is how do I execute a servlet for every server request?
I hope someone can help me?
Greetings, Erik
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Erik,
Does specifying a url mapping of <url-pattern>/*.jsp </url-pattern> invoke your servlet?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To execute a servlet with EVERY service request you will have to substitute your own version of whatever JRun uses. This would be possible on Tomcat because there is a configuration option and you can get the source of the various parts.
Bill
 
Erik Pragt
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, thanks for your answers and suggestions.
Putting *.jsp in the web.xml doesn't solve it, unfortunately. Neither is 'hacking' into JRun really an option, cause it also has to run on iPlanet 4.1 and Tomcat..
What I did was changeing the web.xml a little. Now, not the whole webserver ('/') but a part ('/admin') is protected. But that construction also doesn't work 100%. I posted a new thread here, please have a look. Thanks
https://coderanch.com/t/355511/Servlets/java/Authentication-again-not-solved-yet
Erik
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic