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

when the url-pattern equal "/*"

 
JohnWilliam Fitz
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

Through experimentation I think I've found that if I add a section such as below to my DD...

<servlet-mapping>
<servlet-name>pagawaga</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

...all of my direct requests to retrieve jsp and html files are blocked, and instead I receive the servlet referred to in servlet-name. (By direct request I mean that I enter the full path of the file for the URL like this http://myserver/myapp/myfile.jsp.) The only resources I can reach are those that have an explicit servlet-mapping in the DD.

Is my discovery correct?

Thanks,
John
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by JohnWilliam Fitz:
Is my discovery correct?


Exactly,you are correct. typically this type of url pattern is used to intercept your request and response through Filter
 
JohnWilliam Fitz
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Seetharaman.

It gets interesting if I change the url-pattern just a little bit. If I make it the following...

<servlet-mapping>
<servlet-name>pagawaga</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

...now I can access my jsp files directly from the browser, but html files are still not accesible directly, and instead the servlet in servlet-name is invoked.

Is that normal behaviour?

Thanks again!
John
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by JohnWilliam Fitz:

<servlet-mapping>
<servlet-name>pagawaga</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>



"/" ---->default servlet mapping . if no matching is found then pagawaga servlet will call. for example if you give http://localhost:8081/webapp/[B]abcdef or anything.. now the above servlet only call. but the intresting part is static page is not getting called as you said
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic