Yile Ku wrote:So all of the servlet examples show http://www.somehost.com:8080/ServletName. That works ok. but from outside users are going to type http://www.somehost.com/SomePage.html. I know that SomePage.html can invoke ServletName, but can an outside user invoke a serverlet directly by typing some non-8080 URL like http://www.somehost.com/Start where Start invokes my servlet?
Hi Yile, as far as I know, HTTP servlets are based on HTTP/HTTPS request/response semantics.. I have not seen examples where servlets can be invoked in non HTTP/HTTPS mode.
If you are asking if a servlet can be invoked in otherways instead of pointing to URL, Certainly yes. You can open a HTTPConnection to the servlet, but again 8080 is the protocol that is used underneath.
As you are aware HTTPServlet extends GenericServlet which is basically meant for protocol independent purpose. But I have not encountered any examples in real time. I hardly believe if they actually exist anymore.
So the question is how does the webserver figure out that 'servletapp' (the URL does not have the :8080 socket descriptor) is a servlet and not a regular html page?
A Java-based web server is aware of the Java servlets it has deployed in its Servlet Container. It is designed to call the servlet in the same way it serves up an HTML file from the filesystem.
Whether there is or is not a port number in the path has nothing to do with executing servlets or serving static HTML files.
You can certainly access a Java web application with http://www.domain.com/servletapp. If you are getting errors then you have not deployed the servlet correctly.
I know that SomePage.html can invoke ServletName, but can an outside user invoke a serverlet directly by typing some non-8080 URL like http://www.somehost.com/Start where Start invokes my servlet?
What happens when you try it?
If you have not set up or registered a domain name mapping via DNS to a web server, then you still have a ways to go before making a servlet call using a domain name.
If you are getting a 404 error while trying to execute a servlet using a local URI, then you either have not deployed the servlet properly or the URI is incorrect.
I suggest a good reading of a Java Servlet book. Asdide, you can map a web server to any one of thousands of numbers. There is nothing special about 8080 or 80, except for the fact that they are used as a common "default" setting. This is easily changed, and changing it is a standard good practice in commercial settings.