*
The moose likes Servlets and the fly likes Specifying a PORT number when accessing a Servlet problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Specifying a PORT number when accessing a Servlet problem?" Watch "Specifying a PORT number when accessing a Servlet problem?" New topic
Author

Specifying a PORT number when accessing a Servlet problem?

Siphiwe Madi
Ranch Hand

Joined: Aug 16, 2007
Posts: 70
Hi,

I have created a Servlet that allows users to Download and/or save a File through the File/Save Dialog box.
The problem is that when I access the Servlet
(e.g. http://<ServerName>:9081/Download/filedownloaderservlet/)

i specify the PORT number,
and If I omit the port number:
http://<ServerName>/Download/filedownloaderservlet/

I get a Page NOT Found error.

My Questions are:
1. How can I allow the Servlet to be accessed without specifying the PORT number?
2. Are there any Security RISKS in specifying the PORT number?

Thanks in advance.

Regards,
Siphiwe Madi
[ October 16, 2008: Message edited by: Bear Bibeault ]

Regards, Siphiwe Madi
[SCJP, SCWCD, __] Next ... scjwsd
Rahul Noel
Ranch Hand

Joined: Jul 18, 2008
Posts: 51
According to my knowledge,with out giving port no. we can't access resources(our application) in server.
There is no risk at all mentioning port no. of the server.
[ October 16, 2008: Message edited by: Reddy Naidu Chowdhary ]

Thanks in Advance.
Phani Raju
Greenhorn

Joined: Aug 03, 2007
Posts: 19
Based on the url given I see that you are using http protocol and default port for this protocol is 80. So if you can run your webserver on this port, you can access the required page without giving the port.
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

Port number are like gates to enter into the system. So to connect to any computer you do have to provide the address of the computer called IP address with the gates number called PORT number.

Moreover there is no threat in exposing your port number as far it is for HTTP which can only listen to the Request coming and serving them as defined by the user.


My Blog SCJP 5 SCWCD 5
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42912
    
  68
The default port for HTTP is 80, so that's what it will use if you don't specify the port number (conversely, that's where the servlet needs to run if you don't want the URL to contain a port number).

There are no particular risks in specifying the port number, and -as stated above- not having one in the URL still specifies which port to use.
Siphiwe Madi
Ranch Hand

Joined: Aug 16, 2007
Posts: 70
Hi,

Thanks a lot for the responses. I think i'm clear as you have answered my questions and concerns.

Once again Thank you.
Regards,
Siphiwe Madi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Specifying a PORT number when accessing a Servlet problem?