aragornol
asked on
Define alias for servlet
I would like to define path under which servlet is available.
Usually servlet is available under http://host/servlet/mapping
where
servlet is name of servlet
mapping done in web.xml
my servlet name is MyApp
web.xml
then this servler is avilable as http://localhost/MyApp/test?one=one&two=two ...
I would like to make alias for that (not Apache) which will make servlet available as a
http://localhost/MyApp/test?one=one&two=two
http://localhost/HisApp/test?one=one&two=two
http://localhost/HerApp/test?one=one&two=two
I`ve done that through server.xml
it works but this seems to double memory consumption as the servlet has been deployed twice. Is there any other way ???? Thank you
Usually servlet is available under http://host/servlet/mapping
where
servlet is name of servlet
mapping done in web.xml
my servlet name is MyApp
web.xml
<servlet-mapping>
<servlet-name>MyApp</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
then this servler is avilable as http://localhost/MyApp/test?one=one&two=two ...
I would like to make alias for that (not Apache) which will make servlet available as a
http://localhost/MyApp/test?one=one&two=two
http://localhost/HisApp/test?one=one&two=two
http://localhost/HerApp/test?one=one&two=two
I`ve done that through server.xml
<Context path="/HisApp" docBase="./MyApp privileged="false" override="false" swallowOutput="false">
it works but this seems to double memory consumption as the servlet has been deployed twice. Is there any other way ???? Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I've requested that this question be deleted for the following reason:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned and is now flagged for deletion.
If there is a valid solution, please OBJECT and indicate the comments that are, or would otherwise lead to, a solution.
Use the specific format http:#axxxxxxxx for comment ID(s).
Also, please don't object simply because the author did not respond to your comment. While we understand this is frustrating, unfortunately we cannot force the author to return to the question. Unless you feel you have presented a valid, verifiable solution we'll simply delete the question.
Experts-Exchange Auto Deleter
No comment has been added to this question in more than 21 days, so it is now classified as abandoned and is now flagged for deletion.
If there is a valid solution, please OBJECT and indicate the comments that are, or would otherwise lead to, a solution.
Use the specific format http:#axxxxxxxx for comment ID(s).
Also, please don't object simply because the author did not respond to your comment. While we understand this is frustrating, unfortunately we cannot force the author to return to the question. Unless you feel you have presented a valid, verifiable solution we'll simply delete the question.
Experts-Exchange Auto Deleter
Although the question body was confusing, the question title was good. I think my answer at http:#a33092727 could be useful to someone.
If you want to use same servlet with different names, then follow his suggestion. It will deploy only one servlet (or application) but url will be different as specified in the mappings. And, same servlet will be invoked for all name (or alias)
When you use context (in server.xml), you are actually deploying your servlet (or application) more than once. That is obviously consume resources in multiplication of no of deployments.
So, choose the approach as per your needs.
Hope it explains.