java - tomcat 7.0.56 windows (eclipse) trailing slash appended; tomcat 7.0.28 linux (deployed war) trailing slash not appended -
i new configuring tomcat server, mapping java web application paths.
i got apache cxf web service using following web.xml file.
<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0"> <display-name>kiiktatservices webszolgáltatás (apache cxf)</display-name> <servlet> <description>apache cxf endpoint</description> <display-name>cxf</display-name> <servlet-name>cxf</servlet-name> <servlet-class>org.apache.cxf.transport.servlet.cxfservlet</servlet-class> <init-param> <param-name>static-welcome-file</param-name> <param-value>/services.html</param-value> </init-param> <init-param> <param-name>static-resources-list</param-name> <param-value>/services.html</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>cxf</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> <!-- <servlet-mapping> --> <!-- <servlet-name>cxf</servlet-name> --> <!-- <url-pattern>/services/*</url-pattern> --> <!-- </servlet-mapping> --> <!-- <servlet-mapping> --> <!-- <servlet-name>default</servlet-name> --> <!-- <url-pattern>/*</url-pattern> --> <!-- </servlet-mapping> --> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/css/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/js/*</url-pattern> </servlet-mapping> <session-config> <session-timeout>60</session-timeout> </session-config> <!-- <welcome-file-list> --> <!-- <welcome-file>services.html</welcome-file> --> <!-- </welcome-file-list> --> </web-app>
by default apache cxf webservice provides uniform webservices description page need change more informative, styled page. there possibility provide az init-param cxf takes static-welcome-file. mapped cxf servlet <tomcat context path>/*
above web.xml
code section shows.
i have static css, js resources had map default
servlet make work, when mapped cxf
servlet not worked.
when start combination on localhost windows tomcat 7.0.56 server in eclipse, appends trailing slash end of contextpath , services.html
shows css, js perfectly.
after create war project. there (webcontent/)meta-inf/context.xml
bundled war, got separate context.xml (named war's name) in conf/catalina/localhost/{war.name}.xml
takes precedence on bundled-in context.xml reference database connections, purpose of virtual hosting. not defined docbase, nor path in <context>
's, not relevant.
when deploy war tomcat-7.0.28 on debian, not put trailing slash @ end of path. services.html
static-html-page still shows js, css broken. after manually put trailing slash page shows properly.
there commented sections in web.xml, part of solution. there mapping webservice /services/*
cxf
servlet, , not using built in static-welcome-file
init-parameter. also, using welcome-file
default
servlet , map default servlet /*
instead. result same, puts trailing slash on local dev machine, , works not puts trailing slash after deployment war on linux tomcat.
i have been struggling problem several days now. know there similar problems, have searched here , elsewhere not found solution.
here stated if got /*
mapping, tomcat won't redirect, redirecting on localhost windows... tomcat: not appending trailing "/" when finding directory
do have ideas?
you break whole server if map /*
, change mapping of defaultservlet
other /
. defaultservlet
handles things adding trailing slashes when there directory involved, resolving welcome-files, etc. have eclipsed configuration having cxf
servlet handle everything.
i think want use more care when mapping cxf
servlet.
Comments
Post a Comment