Static files with default servlet in tomcat 8.0.9
Hello, I am trying to configure static files with default servlet in tomcat 8.0.9 but could not succeed. My directory structure in deployed webapp is: - WEB-INF - static -css -images -js - META-INF and* web.xml* configuration using default servlet is : !-- static URLs -- servlet-mapping servlet-namedefault/servlet-name url-pattern/res/*/url-pattern /servlet-mapping But when i make request from my page with URL it fails with 404. http://SUB.DOMAIN.COM/myapp/*res/static/*js/imports/jquerymin.js What could be the problem? How can i make it work? I tried to find information from web, but could not help. Thanks.
Static files with default servlet in tomcat 8.0.9
Please see my comments inline below. On 1/12/2015 8:55 AM, Srikanth Hugar wrote: Hello, I am trying to configure static files with default servlet in tomcat 8.0.9 but could not succeed. My directory structure in deployed webapp is: - WEB-INF - static -css -images -js - META-INF and* web.xml* configuration using default servlet is : !-- static URLs -- servlet-mapping servlet-namedefault/servlet-name url-pattern/res/*/url-pattern /servlet-mapping Mappings for the default servlet should already be defined - check conf/web.xml. But when i make request from my page with URL it fails with 404. http://SUB.DOMAIN.COM/myapp/*res/static/*js/imports/jquerymin.js Based on the directory structure above and assuming a context path of myapp, the URL should be something like: http://SUB.DOMAIN.COM/myapp/static/js/imports/jquerymin.js The folder res does not exist. -Terence Bandoian What could be the problem? How can i make it work? I tried to find information from web, but could not help. Thanks. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Static files with default servlet in tomcat 8.0.9
On Mon, Jan 12, 2015 at 9:55 AM, Srikanth Hugar srikanth.hu...@gmail.com wrote: Hello, I am trying to configure static files with default servlet in tomcat 8.0.9 but could not succeed. My directory structure in deployed webapp is: - WEB-INF - static -css -images -js - META-INF and* web.xml* configuration using default servlet is : !-- static URLs -- servlet-mapping servlet-namedefault/servlet-name url-pattern/res/*/url-pattern /servlet-mapping Have you tried removing this and just accessing your files at /myapp/static/...? But when i make request from my page with URL it fails with 404. http://SUB.DOMAIN.COM/myapp/*res/static/*js/imports/jquerymin.js What could be the problem? No idea, but you could try one of these steps to debug further. - enable more logging, like for `org.apache.catalina.servlets.DefaultServlet` - step into it with a debugger Dan How can i make it work? I tried to find information from web, but could not help. Thanks.
Re: Static files with default servlet in tomcat 8.0.9
On Mon, Jan 12, 2015 at 6:55 AM, Srikanth Hugar srikanth.hu...@gmail.com wrote: I am trying to configure static files with default servlet in tomcat 8.0.9 but could not succeed. My directory structure in deployed webapp is: - WEB-INF - static -css -images -js - META-INF and* web.xml* configuration using default servlet is : !-- static URLs -- servlet-mapping servlet-namedefault/servlet-name url-pattern/res/*/url-pattern /servlet-mapping The default servlet will handle your static resources out of the box. Get rid of the above (/res/*) mapping and access as e.g. /myapp/static/js/imports/jquerymin.js -- Hassan Schroeder hassan.schroe...@gmail.com http://about.me/hassanschroeder twitter: @hassan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org