JavaGian java tutorial and java interview question and answer

JavaGian , Free Online Tutorials, JavaGian provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, ajax, core java, sql, python, php, c language etc. for beginners and professionals.

Showing posts with label tomcat. Show all posts
Showing posts with label tomcat. Show all posts

How to run tomcat in default HTTP port 80

11:46 PM
By default, tomcat is configured to run on port 8080. That’s why all your deployed web applications are accessible though URLs like  http://localhost:8080/yourapp . If you want to run your applications on URL like  http://localhost/yourapp , then you will need to change the default port 8080 to 80, which is default port for HTTP connectors. To make this port change, open  server.xml  and find below entry : <Connector           port= "8080"           //Change this                  protocol= "HTTP/1.1"                  connectionTimeout= "20000"                  redirectPort= "8443" /> and change it to below entry: <Connector           port= "80"         //Changed                  protocol= "HTTP/1.1"                  connectionTimeout= "20000"                  redirectPort= "8443" /> You are all set to access your applications using root path “ http:

Tomcat – Enable/disable directory listing

11:45 PM
When your application is deployed in  tomcat  webserver and you request a URL which refers to a directory instead of a file, e.g.,  http://host:port/helloWorldApp/ , you can  configure Tomcat to serve the directory listing , or a welcome file, or issue error “404 Page Not Found”. Let’s see how you can  enable or disable directory listing in tomcat server . Table of Contents Enabling Directory Listing for ALL Webapps Enabling Directory Listing for any particular Webapp Enabling Directory Listing for ALL Webapps To enable directory listing for all the web applications, you could modify the  <CATALINA_HOME>\conf\web.xml , by changing “ listings ” from “ false ” to “ true ” for the “ default ” servlet, as follows: <!-- The default servlet for all web applications, that serves static     --> <!-- resources.  It processes all requests that are not mapped to other   --> <!-- servlets with servlet mappings.                                      -->

.