• 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

Confusion about servlet path , context path and path info

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
while being through mocks , I came across through couple of path related question from javabeat mock.
In below question , the answers are differing. Specially with reference to a query string . I far as I know , query string isnt a part of path info.
Req URI = Contextpath+servletpath+pathinfo
Can any one please help me in getting this confusion clear.

Pick out the context path, Servlet path and path information from the request
path '/books/Find/abcd?query=Java' (assuming that the context is 'books')?
a. '/books', '/Find' and '/abcd'
b. '/books', '/Find/abcd' and 'query=Java'
c. '/books/Find', '/abcd' and 'query=Java'
d. None of the above.
ANS : A


What will be the value of the context path, Servlet path and the path info
elements, if the request path is music/Play/album1234?name='xyz' (assuming
that the context of the Web Application is 'music')?
a. Play, album1234 and name='xyz'
b. music, Play and album1234?name='xyz'
c. music, Play and album1234
d. music, Play/ album1234 and name='xyz'
ANS
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This topic discussed many time here. search here
 
ani jadhao
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After being through seaching the posts on java ranch , I had posted my question here. Actually I foung couple of post on javaranch discussing the same thing, and I got a help from those too.
But my concern is , in exam question , the web.xml mapping hasnt been provided .So what could we do to get the correct answer, after all evntual result matters .
 
Ranch Hand
Posts: 170
Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i think you are right.

it completely differ if the mapping is "/Find/abcd" or "Find/*".
for the first it gives:
servlet path="/Find/abcd" path info="".
for the second it gives:
servlet path="/Find" path info="/abcd".

am i right??
 
ani jadhao
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Exactly . Thats what I just wanted to ask. What if in exam question , web.xml mapping hasnt been provided , how could one comes to an answer , it would be a blind game then for path info question.
 
Jonathan Elkharrat
Ranch Hand
Posts: 170
Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you won't get such question...
 
ani jadhao
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
..Lets hope the same ..

BTW thanks SIR.

Ani
 
Jonathan Elkharrat
Ranch Hand
Posts: 170
Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you're welcome..
reply
    Bookmark Topic Watch Topic
  • New Topic