Solved

Tomcat: mapping or aliasing a directory path

Posted on 2006-06-26
6
417 Views
Last Modified: 2012-06-27
I use several tools (like FCKeditor) in web applications. For every web application I have to copy the code of this tool, and for every update I have to update the tool in all the applications. This is not very efficient. Is there a way to map/alias the tool in every web application to one directory? See the following example:

Tool path: C:\www\tools\FCKeditor\

Application ABC: C:\www\localhost\webapps\abc\
http://localhost:8080/abc/FCKeditor/_samples/default.html

Application XYZ: C:\www\localhost\webapps\xyz\
http://localhost:8080/xyz/FCKeditor/_samples/default.html

There is no directory FCKeditor in either C:\www\localhost\webapps\abc\ or C:\www\localhost\webapps\xyz\.
0
Comment
Question by:grexx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 2

Accepted Solution

by:
Mr_Lenehan earned 250 total points
ID: 16983484
I see you are trying to do it as: http://localhost:8080/appName/FCKeditor/...

This is fine, it will just mean that for every app name you'll need to make a new alias, so you'd add: appName1/FCK and appName2/FCK to the server.xml as oppose to just once... does that make sense?

If not post back, you'd basically need somthing like this added in the <host>:
<Context path="/appName_1/FCKeditor/_samples/defauls"
     docBase="C:/path/to/the/tool"
     defaultSessionTimeOut="30"
     crossContext="false"
     debug="0"
     reloadable="true">
</Context>
<Context path="/appName_2/FCKeditor/_samples/defauls"
     docBase="C:/path/to/the/tool"
     defaultSessionTimeOut="30"
     crossContext="false"
     debug="0"
     reloadable="true">
</Context>

Hope this helps
0
 
LVL 1

Author Comment

by:grexx
ID: 16983983
Thanks. I got it working in server.xml, but read somewhere that I should put this in context.xml. I wonder what the syntax is, because I can't find anything about this. Should I use the context.xml from the server or the META-INF?
0
 
LVL 4

Expert Comment

by:pablomorales
ID: 16984273
You have several options. Take a look at this page:

http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:grexx
ID: 16987235
Okay, I should be more clear. What I'm confused about is how the context.xml is setup. When I open the file in my editor, I see a <context> root. Following xml-guidelines, I may not add another <context> element in the root. So I've tried to add the extra context elements (more than one) inside the context-element, but that didn't work.

This is the context.xml file that comes with the installation:

<!-- The contents of this file will be loaded for each web application -->
<Context>

      <!-- Default set of monitored resources -->
      <WatchedResource>WEB-INF/web.xml</WatchedResource>

      <!-- Uncomment this to disable session persistence across Tomcat restarts -->
      <!--
      <Manager pathname="" />
      -->

</Context>

Where do I add your code? The following doesn't work:

<!-- The contents of this file will be loaded for each web application -->
<Context>

      <!-- Default set of monitored resources -->
      <WatchedResource>WEB-INF/web.xml</WatchedResource>

      <!-- Uncomment this to disable session persistence across Tomcat restarts -->
      <!--
      <Manager pathname="" />
      -->
      <Context path="/appName_2/FCKeditor/_samples/defauls"
            docBase="C:/path/to/the/tool"
            defaultSessionTimeOut="30"
            crossContext="false"
            debug="0"
            reloadable="true">
      </Context>

</Context>

Even using the root-context only, adding the docBase attributes etc, doesn't work.
0
 
LVL 2

Expert Comment

by:Mr_Lenehan
ID: 16987319
make a new file in your conf dir called whateveryoulike.xml the in that file put something like:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Server>
<Host name="yourhost.com" >
<Context path="/applicationname/thatTool"
docBase="c:\some\path"
debug="0" >
<LogSetter name="applicationname_tc.log" path="c:\some\path\applicationname.log" />
<LogSetter name="applicationname_servlet_log"
path="c:\some\path\servlet_applicationname.log"
servletLogger="true"/>
</Context>
</Host>
</Server>

This tells Tomcat to map requests for http://yourhost.com/applicationname/thatTool to the application in the c:\some\path directory.

Give it a whirl and let me know what happens.
0
 
LVL 2

Expert Comment

by:Mr_Lenehan
ID: 16987340
Oh, and when you make that new file, restart Tomcat or it won't go looking for new conf files.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
J2SE 5.0 metadata 1 71
constructor overloading 2 96
AlarmClock Challenge 35 157
How can I   ajax html table  rows? 20 88
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question