Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about path prefix mappings, default mappings

 
rick collette
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Could anyone explain path prefix mappings and default mappings by giving some examples? Thanks in advance.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please specify a context in which you encountered this. Would make it easy for me to come up with an example, to relate to what you are looking for.
regds.
- madhav
 
rick collette
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

For the above case, now we can use: http://localhost/sth.html
to map to myServlet.
If we want to use path prefix mapping, we
have to do sth like this:

Does that mean we can map to myServlet like this now?
http://localhost/sth/whatever
If we want to use default mapping, we have to do sth like this:

The above code will ID the default servlet for web-app. How do we define our default servlet? and how to use url to locate myServlet in this case?
Thanks in advance.
rick
[ April 11, 2002: Message edited by: Peter den Haan ]
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does that mean we can map to myServlet like this now?
http://localhost/sth/whatever
Yes. This facility is used a lot to implement virtual directories: e.g. a request for http://localhost/sth/secret/mydocument.doc would fire the "sth" servlet. This servlet then examines the extra path info ("/secret/mydocument.doc") and can for example retrieve the document from a database. That way, you can make the contents of a database (or a JNDI tree or an XML file or...) look like a set of directories and documents on a web server.

[...] How do we define our default servlet? and how to use url to locate myServlet in this case?
I don't quite understand the question? You define the default servlet as usual - by defining a servlet called "myServlet". Any request to the server will invoke the default servlet, unless there is a more specific servlet mapping for that request.
- Peter
[Yuk. I don't know what happened to the quoting - hopefully this will be better]
[ April 11, 2002: Message edited by: Peter den Haan ]
 
rick collette
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gracias, Peter:
We depend on gurus like Peter, Clark, Carl, Alex, madhav, etc (sorry that I cannot remember all).
Folks, never take it for granted. I have not passed the exam yet, but I know these good folks have saved my time in my slow world. Merci.
[ April 11, 2002: Message edited by: rick collette ]
 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Peter den Haan:
Yes. This facility is used a lot to implement virtual directories: e.g. a request for http://localhost/sth/secret/mydocument.doc would fire the "sth" servlet. This servlet then examines the extra path info ("/secret/mydocument.doc") and can for example retrieve the document from a database. That way, you can make the contents of a database (or a JNDI tree or an XML file or...) look like a set of directories and documents on a web server.
[/qb]

Don't miss this one.
[ April 11, 2002: Message edited by: Axel Janssen ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic