Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

deployment descriptor contents in servlet?  RSS feed

 
mi go
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to ask  general question regarding deployment descriptor (web.xml) file?
Can we specify communication endpoint in this file ?
for example I m using HTTPUrlConnection class in Servlet1. This Servlet1 then send GET reqest to Servlet2 which is running in VM and which processes the requst and prints something. By communication endpoint i mean the URL of Servlet2 which i have to specify in Servlet1 code. I want to access this URL somehow from web.xml of Servlet1. So in cases when Servlet2 moves to some other URL, i dont have to modify the Servlet1 code but web.xml of Servlet1.

Also can we specify somehow which HTTP methods are being used in which servlet by web.xml?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66041
140
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe what you are looking for are initialization parameters or context parameters.
 
Tim Moores
Saloon Keeper
Posts: 3755
78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also can we specify somehow which HTTP methods are being used in which servlet by web.xml?

No, that depends on the method being passed by the client request (and, obviously, by which doXYZ methods are implemented by the servlet). But as per the HTTP specification, methods shouldn't be used interchangeably, as they serve different purposes. So it's not clear what would be gained from determining this dynamically.
 
It's just a flesh wound! Or a tiny ad:
Thoughts on deprecation in Java
https://coderanch.com/t/683016/java/Deprecation-Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!