File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Servlet Aliasing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Aliasing" Watch "Servlet Aliasing" New topic
Author

Servlet Aliasing

Kumar Vinay
Greenhorn

Joined: Sep 29, 2000
Posts: 23
Hi folks,
What exactly is servlet aliasing...can anybody explain me in detail....
Thanx in advance for ur effort and time
Bye
Vinay
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12682
    
    5
Wit servlet aliasing the web server maps a request for a particular resource to the servlet class you create. In the servlet 2.2 API this is accomplished in the web.xml file for a particular applications.
For example, the following maps a request for "saynumb.au" to the NumberSoundServ servlet - as qualified by the full package. It also creates an initialization parameter that will be passed to the servlet init method.
<servlet><servlet-name>saynumb.au</servlet-name> <servlet-class>com.JSPbook.Chap04.NumberSoundServ</servlet-class>
<init-param>
<param-name>basepath</param-name> <param-value>c:/tomcat/webapps/Root/JSPbook/Chap04/sounds
</param-value>
</init-param>
</servlet>
Bill

------------------
author of:


Java Resources at www.wbrogden.com
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Kumar,
Servlet alias means you are calling a servlet with another name of your choice at the URL.
It is always good idea to keep the servlets inside packages and deploy. Assuming you have a LoginServlet kept like this.
com.company.dept.project.LoginServlet.
It need not have this much depth level. What I use is one level depth like MISApp.LoginServlet.
So when we make a request from a url we write like this.
Instead of calling the Servlet with its package name like above everytime, we may choose to have a simple name like this

This means we made an alias for MISApp.LoginServlet as just 'LoginServlet'. For this we have to edit web.xml file and add entries for LoginServlet as Bill stated above. If the servlet container supports Servlet 2.2 API web.xml is the place to write all aliases for servlets.
regds
maha anna
[This message has been edited by maha anna (edited December 09, 2000).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Aliasing
 
Similar Threads
Question on Aliases
difference between registered and unregistered servlets
Aliasing in Spring
But you don't look straight!
My SCEA Part 1Study Notes