aspose file tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Confusion about servlet path , context path and path info Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "Confusion about servlet path , context path and path info" Watch "Confusion about servlet path , context path and path info" New topic
Author

Confusion about servlet path , context path and path info

ani jadhao
Ranch Hand

Joined: Dec 23, 2008
Posts: 62
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


SCJP 1.4 : 91%
SCWCD 5: 96%
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

This topic discussed many time here. search here
ani jadhao
Ranch Hand

Joined: Dec 23, 2008
Posts: 62
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 .
Jonathan Elkharrat
Ranch Hand

Joined: Dec 31, 2008
Posts: 170

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??


SCJP 5, SCWCD 5, SCBCD 5
ani jadhao
Ranch Hand

Joined: Dec 23, 2008
Posts: 62
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

Joined: Dec 31, 2008
Posts: 170

you won't get such question...
ani jadhao
Ranch Hand

Joined: Dec 23, 2008
Posts: 62
..Lets hope the same ..

BTW thanks SIR.

Ani
Jonathan Elkharrat
Ranch Hand

Joined: Dec 31, 2008
Posts: 170

you're welcome..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Confusion about servlet path , context path and path info
 
Similar Threads
Doubt in Context,Servlet,Path info
doubt about javabeat mock exam
Servlet path, context path and path info.
context path, Servlet path and the path info doubt
Confusion about servlet path , context path and path info.[reposting as one of char converted to a s