• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

contextpath,servlet path and full path

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can anyone give me a link for understanding these..please
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Generally people are confused between servlet path and path info. Anyways, context path is the path on which your application is deployed. Its normally the same as the name of the war file which you deploy. You can get it using request.getContextPath. You can find information about servlet path and path info here and here. I don't know what full path you are talking about...
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Imagine request: http://localhost:8080/myApp/reports/get.do and url-pattern /reports/*
We have:
- contextPath: /myApp (your app name with / at the begining)
- servletPath: /reports (it's the one defined in url-pattern with / at the begining and without *)
- pathInfo: /get.do (start with / everything in url after sevletPath)

But for url-pattern *.do you have:
- contextPath - the same
- servletPath - /reports/get.do (because it was matched to the url-pattern)
- pathInfo - null (because there is nothing left after servlet path)
 
An elephant? An actual elephant. Into the apartment. How is the floor still here. Hold this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic