tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Gooding <josh.good...@gmail.com>
Subject Question on Contexts and resource pathing
Date Tue, 02 Oct 2012 18:55:50 GMT
Hey group,

I managed to get our company upgraded from Tomcat 5.5 to Tomcat 7, so now
we are on the right track, mostly.  Interesting enough I've been fighting
with some pathing issues here, and I am getting frustrated beyond just
losing more hair.  The application that I have has an extremely antiquated
deployment method of zipping, rsyncing, unzipping, and restarting the
tomcat server.  Another team member and I are trying to fix this issue, and
have gotten war files building, but something interesting happens during
the deployment of the war file.  It expands perfectly, and serves almost
like it is supposed to, however when the application is zipped up and
deployed out under $CATALINA_HOME/webapps/ROOT all links to all css /
styles / links to graphics work.  (i.e. - all referenced as
/graphics/foo.png or /styles.bar.css).  The problem is that the minute I
change the webapp's deploying location by changing the war name, none of
the links work unless I prepend a " .. " or use the JSP EL to the beginning
of the path, so the references are then ../graphics/foo.png or
/warName/graphics/foo.png, etc.

I should be able to build the war to any name I want and still have all of
the links work, even if they are referenced like:

<link rel="stylesheet" type="text/css" href="/default.css" /> NOT ~> <link
rel="stylesheet" type="text/css"
href="${pageContext.request.getContext}/default.css" /> or ../default.css

Obviously there is something that I am missing, but I am not sure as to
what.  I shouldn't have to do a S&R on code each time I want to deploy this
code base as a different application someplace else.

Any help or ideas would be greatly appreciated.

As always, warmest regards,

- Josh


Here is my context.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <Realm className="org.apache.catalina.realm.JDBCRealm"
           driverName="com.mysql.jdbc.Driver"
           connectionURL="jdbc:mysql://connection/DBName"
           connectionName="shhhh"
           connectionPassword="1ts4S3cr3T!!!"
           userTable="TomcatUsers"
           userNameCol="UserID"
           userCredCol="Password"
           userRoleTable="TomcatUserRoles"
           roleNameCol="RoleID"
           digest="MD5"/>

    <Manager className="org.apache.catalina.session.PersistentManager"
             saveOnRestart="true"
             distributable="true">
        <Store className="org.apache.catalina.session.FileStore"
               directory="/tmp/tc_sessions/"/>
    </Manager>

</Context>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message