Hi,
This may be a newbie question but I'm struggling
Trying to figure out how to do this or what the right
Way to do it is.
Basically, I have a web app configured for jetty
In my config xml files, as follows:
<Call name="addWebApplication">
<Arg>/</Arg>
<Arg>c:/formalogix/webapps/vfit</Arg>
<Set name="virtualHosts">
<Array type="java.lang.String">
<Item>localhost</Item>
</Array>
</Set>
</Call>
The structure of the "vfit" directory is as follows:
/html
index.html
...
/js
...
/images
...
Basically my problem is that when someone types
In "localhost" for the url (in this example), I want the webapp
To load the vfit/html/index.html page.
So, how do I get the web app to use that as the
Default page?
I can't point the web app root directory
To the c:/formalogix/webapps/vfit/html
and then use a "welcome-file-list" tag in the web.xml.
If I try to reference a file js or image file from the
Html file such as:
<javascript language="javascript" src="../js/common.js">,
that directory is out of the root context of the webapp,
And I get a HTTP 404 or forbidden error, something like that.
Can anyone clue me in on how to get Jetty to have
c:/formalogix/webapps/vfit be the root dir for the
webapp but use the html file in the subdir as the
welcome page?
Thanks,
Joe
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Jetty-support mailing list
Jetty-support@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/jetty-support
Thread at a glance:
Previous Message by Date:
click to view message preview
Question about contexts
I confugure Jetty as a web server with a servlet and several Handlers included
with jetty. This is Context "/".
I want my servlet to find several other servlets it needs to include when it
parses a <servlet> tag in a *.jhtml page (apache extension) or *.shtml page
(sun jws extension).
I set up a web application that adds all the servlets. The web application
is also Context "/". This is defined in a web.xlm file in a WEB-INF directory.
Example:
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Home context. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Call name="addContext">
<Arg>/</Arg>
<Set name="ResourceBase">C:\Draconis\test_site</Set>
<Set name="welcomeFiles">
<Array type="java.lang.String">
<Item>main.shtml</Item>
<Item>main.html</Item>
<Item>Main.shtml</Item>
<Item>Main.html</Item>
</Array>
</Set>
<Call name="addServlet">
<Arg>JSSSI</Arg>
<Arg>*.shtml</Arg>
<Arg>Draconis.Jetty.JSSIServlet</Arg>
</Call>
.....
more setup in d.xml passed on the command line to start.jar
......
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Add root context web applications. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Call name="addWebApplication">
<Arg>/</Arg>
<Arg><SystemProperty name="jetty.home" default="."/>/draconis</Arg>
</Call>
......
end of .xml setup
Then in the web app directory:
<web-app>
<display-name>Draconis Servlets</display-name>
<servlet>
<servlet-name>Draconis.servlets.Banners</servlet-name>
<servlet-class>Draconis.servlets.Banners</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
...
plus more servlets.
----------------
My servlet that is defined in the Jetty server xml configuration cannot access
the servlets loaded as a web app. They are both loaded as context "/" and this
is what is indicated in the log. The log also shows that the servlets are found
and loaded. However it seems that there are two contexts for root ("/"). The
server root is distrinct from the web app root.
When I add the servlets in the Jetty server configutation they are found and
everything works wonderfuly. I just have to add a lot of servlets in the
addContext for root "/". This is pretty messy. Also it appears that I will have
to do this for every virtual domain and I host several on one server.
-------------------
Why are there two different contexts one for the server and one for the web
app. Can the web app servlets be access from the server? It would be much
cleaner to load all the servlets as a web app. It would also be wonderful if
all virtual domains could access the servlets from the web app context.
I am not trying to access the servlets using url mapping. I am including the
servlets from another servlet. The servlets are not invoked with the Jetty
Invoker (o.m.j.s.Invoker) my servlet takes its place.
dispatcher = getServletContext().getRequestDispatcher( servlet_name );
// Add servlet parameters to request
sreq = new SSIHttpServletRequestWrapper( req, params );
sres = new HttpServletResponseWrapper( resp );
// Invoke servlet and include results
dispatcher.include( sreq, sres );
I am using Jetty 4.2.17 with JDK 1.4.1_02 on a Win 2K platform.
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Jetty-support mailing list
Jetty-support@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/jetty-support
Next Message by Date:
click to view message preview
configuring 404 and other page handlers with jetty xml
Hello. Is it possible to configure, with jetty.xml, handler pages for
404 or other errors? If so, can you provide a link to an example?
Thanks in advance,
Si Chen
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Jetty-support mailing list
Jetty-support@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/jetty-support
Previous Message by Thread:
click to view message preview
Question about contexts
I confugure Jetty as a web server with a servlet and several Handlers included
with jetty. This is Context "/".
I want my servlet to find several other servlets it needs to include when it
parses a <servlet> tag in a *.jhtml page (apache extension) or *.shtml page
(sun jws extension).
I set up a web application that adds all the servlets. The web application
is also Context "/". This is defined in a web.xlm file in a WEB-INF directory.
Example:
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Home context. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Call name="addContext">
<Arg>/</Arg>
<Set name="ResourceBase">C:\Draconis\test_site</Set>
<Set name="welcomeFiles">
<Array type="java.lang.String">
<Item>main.shtml</Item>
<Item>main.html</Item>
<Item>Main.shtml</Item>
<Item>Main.html</Item>
</Array>
</Set>
<Call name="addServlet">
<Arg>JSSSI</Arg>
<Arg>*.shtml</Arg>
<Arg>Draconis.Jetty.JSSIServlet</Arg>
</Call>
.....
more setup in d.xml passed on the command line to start.jar
......
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Add root context web applications. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Call name="addWebApplication">
<Arg>/</Arg>
<Arg><SystemProperty name="jetty.home" default="."/>/draconis</Arg>
</Call>
......
end of .xml setup
Then in the web app directory:
<web-app>
<display-name>Draconis Servlets</display-name>
<servlet>
<servlet-name>Draconis.servlets.Banners</servlet-name>
<servlet-class>Draconis.servlets.Banners</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
...
plus more servlets.
----------------
My servlet that is defined in the Jetty server xml configuration cannot access
the servlets loaded as a web app. They are both loaded as context "/" and this
is what is indicated in the log. The log also shows that the servlets are found
and loaded. However it seems that there are two contexts for root ("/"). The
server root is distrinct from the web app root.
When I add the servlets in the Jetty server configutation they are found and
everything works wonderfuly. I just have to add a lot of servlets in the
addContext for root "/". This is pretty messy. Also it appears that I will have
to do this for every virtual domain and I host several on one server.
-------------------
Why are there two different contexts one for the server and one for the web
app. Can the web app servlets be access from the server? It would be much
cleaner to load all the servlets as a web app. It would also be wonderful if
all virtual domains could access the servlets from the web app context.
I am not trying to access the servlets using url mapping. I am including the
servlets from another servlet. The servlets are not invoked with the Jetty
Invoker (o.m.j.s.Invoker) my servlet takes its place.
dispatcher = getServletContext().getRequestDispatcher( servlet_name );
// Add servlet parameters to request
sreq = new SSIHttpServletRequestWrapper( req, params );
sres = new HttpServletResponseWrapper( resp );
// Invoke servlet and include results
dispatcher.include( sreq, sres );
I am using Jetty 4.2.17 with JDK 1.4.1_02 on a Win 2K platform.
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Jetty-support mailing list
Jetty-support@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/jetty-support
Next Message by Thread:
click to view message preview
configuring 404 and other page handlers with jetty xml
Hello. Is it possible to configure, with jetty.xml, handler pages for
404 or other errors? If so, can you provide a link to an example?
Thanks in advance,
Si Chen
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Jetty-support mailing list
Jetty-support@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/jetty-support