Jetty Web Root Configuration?

1,784 views
Skip to first unread message

MillionMunkeys

unread,
Oct 11, 2010, 8:53:37 PM10/11/10
to Railo
I'm trying to test my apps so that they are compatible with Adobe CF
and Railo. Is it possible to change the web context for the Jetty
Webserver? I've successfully changed the Application server context
to match the Adobe CF web root, so cfm pages are served up correctly,
but links to images and CSS files are trying to fetch them from the
Jetty web root. Thanks.

Lyle Karstensen

unread,
Oct 11, 2010, 9:20:59 PM10/11/10
to ra...@googlegroups.com
This is done by adding an xml file in the context folder in your jetty install. Below is the file I call global.xml. this is the virtual directory called /global and points to c:/realistiQ/WWWContent/_Global

I have mine in the c:/railo-jetty/contexts

If you want it only available from certain hosts then that is what the vhosts section is for. In mine I did it for all my sites.


Then you need to add the following to your server.xml config

<Call name="addLifeCycle">
<Arg>
<New class="org.mortbay.jetty.deployer.ContextDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/contexts</Set>
<Set name="scanInterval">5</Set>
</New>
</Arg>
</Call>

Sample:global.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">

<!-- ==================================================================
Configure and deploy the test web application in $(jetty.home)/webapps/test

Note. If this file did not exist or used a context path other that /test
then the default configuration of jetty.xml would discover the test
webapplication with a WebAppDeployer. By specifying a context in this
directory, additional configuration may be specified and hot deployments
detected.
===================================================================== -->


<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="contextPath">/global</Set>
<Set name="resourceBase">C:/realistiQ/WWWContent/_Global</Set>
<Set name="welcomeFiles">
<Array type="String">
<Item>default.cfm</Item>
</Array>
</Set>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Optional context configuration -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<Set name="extractWAR">false</Set>
<Set name="copyWebDir">false</Set> -->
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/conf/jetty-default.xml</Set>
<Set name="extraClasspath"><SystemProperty name="jetty.home" default="."/>/lib/memcached</Set>

<!-- <Set name="virtualHosts">
<Array type="String">
<Item>*.iqweb.railo-dev.realistiq.net</Item>
<Item>iqweb.railo-dev.realistiq.net</Item>
</Array>
</Set>-->

<Get name="sessionHandler">
<Get name="sessionManager">
<Set name="usingCookies" type="boolean">false</Set>
</Get>
</Get>
</Configure>


Lyle Karstensen Jr.
Chief Executive Officer  (CEO)

Phone: 702.940.4200
Fax: 702.940.4201
Direct: 702.932.8200
Cell: 702.683.3666
Email: ly...@realistiq.com
Website: http://www.realistiq.com

Pete Oliver-Krueger

unread,
Oct 12, 2010, 6:02:53 PM10/12/10
to Railo
Thanks for the reply. For a little more clarification, I'm trying to
do this for the default context, and on a Mac. I've made the
following changes to railo.xml in the "contexts/" folder of the Railo
application. I was hoping it would have the same effect for the main
context, "/", but alas it does not, and Railo won't start now. I'm
going to put it back, but is there a way to do this same thing with an
absolute path (to someplace outside the Railo app folder) for the root
context "/", without creating a new context? Thanks.


<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd">

<!--
==================================================================
Configure and deploy the test web application in $(jetty.home)/webapps/
test

Note. If this file did not exist or used a context path other that /
test
then the default configuration of jetty.xml would discover the test
webapplication with a WebAppDeployer. By specifying a context in this
directory, additional configuration may be specified and hot
deployments
detected.
=====================================================================
-->


<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<Set name="resourceBase">/Applications/ColdFusion8/wwwroot/</Set>
<Set name="welcomeFiles">
<Array type="String">
<Item>index.cfm</Item>
<Item>index.cfml</Item>
<Item>index.htm</Item>
<Item>index.html</Item>
</Array>
</Set>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --
>
<!-- Optional context configuration
-->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<Set name="extractWAR">false</Set>
<Set name="copyWebDir">false</Set> -->
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home"
default="."/>/etc/webdefault.xml</Set>

<!-- virtual hosts
<Set name="virtualHosts">
<Array type="String">
<Item>www.myVirtualDomain.com</Item>
<Item>localhost</Item>
<Item>127.0.0.1</Item>
</Array>
</Set>
-->


</Configure>
Reply all
Reply to author
Forward
0 new messages