• Post Reply Bookmark Topic Watch Topic
  • New Topic

deployment descriptor contents in servlet?  RSS feed

 
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?
 
Author and ninkuma
Marshal
Posts: 66307
152
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.
 
Saloon Keeper
Posts: 4038
94
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!