There are many ways of doing that. For the static files we serve up, we've created a bundle that contains this header in the MANIFEST.MF:
Web-ContextPath: / We also have a WEB-INF-folder containing a standard web.xml. Our files are placed relative to the root of the bundle, so immediately inside the bundle you'll find WEB-INF and index.html (and the other files) A web.xml might look like this: <?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>Webthing</display-name> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app> The osgi boot bundle will pick this up automagically. See http://wiki.eclipse.org/Jetty/Feature/Jetty_OSGi#Deployment_of_web-applications_via_OSGi for details. // Henrik On Feb 17, 2011, at 16:40 , Mitul Adhia wrote: > Hi Henrick, > > Yes that was the issue i tried the putting below xml snippet under the > Handler class difinition > > <Item> > <New class="org.eclipse.jetty.server.handler.ResourceHandler"> > <Set name="directoriesListed">true</Set> > <Set name="welcomeFiles"> > <Array type="String"><Item>index.html</Item></Array> > </Set> > <Set name="resourceBase">.</Set> > </New> > </Item> > > Now my index.html file is located in different bundle not in the one were my > jetty.xml file is located . how do i have access to that html file using > following url > http://localhost:8080/flexui/index.html .... > > Do i need to add any specific handler which would extend the resource handle > and take the html file from that bundle ...??? > > Best Regards, > mitul > > > On Thu, Feb 17, 2011 at 8:58 PM, Henrik Gustafsson > <[email protected]> wrote: > I think you are overwriting the old handler attribute. > > Say, do you perhaps have two <Set name="handler"></Set>-sections in your > jetty.xml? If so you should probably merge contents of the <Array>-tags > instead. > > // Henrik > > On Feb 17, 2011, at 16:12 , Mitul Adhia wrote: > >> Hi Henrik, >> >> Was trying to append the content of jetty.filserver.xml in jetty.xml so >> default configuration for resource file can also be added along with the >> context . But after adding this i again started getting the exception given >> below .. yes after adding the xml snippet the Server class was configure >> file resource value . >> >> jettyetc=etc/jetty.xml >> 2011-02-17 18:09:10.315:INFO::Configuring the default jetty server with >> bundleentry://68.fwk25567987/etc/jetty.xml >> java.lang.IllegalStateException: ERROR: No ContextHandlerCollection or >> OSGiAppProvider configured >> at >> org.eclipse.jetty.osgi.boot.internal.serverfactory.ServerInstanceWrapper.init(ServerInstanceWrapper.java:333) >> >> >> Content from jetty.resource.xml file >> >> <Set name="handler"> >> <New class="org.eclipse.jetty.server.handler.HandlerList"> >> <Set name="handlers"> >> <Array type="org.eclipse.jetty.server.Handler"> >> <Item> >> <New class="org.eclipse.jetty.server.handler.ResourceHandler"> >> <Set name="directoriesListed">true</Set> >> <Set name="welcomeFiles"> >> <Array type="String"><Item>index.html</Item></Array> >> </Set> >> <Set name="resourceBase">.</Set> >> </New> >> </Item> >> <Item> >> <New class="org.eclipse.jetty.server.handler.DefaultHandler"> >> </New> >> </Item> >> </Array> >> </Set> >> </New> >> </Set> >> >> >> Now the question is how do i do the configuration for fileresource . The >> index.html file is located in bunlde where WebThing.java which extends >> ServletContexthandler is located .. >> >> Best Regards, >> mitul >> >> On Thu, Feb 17, 2011 at 8:06 PM, Henrik Gustafsson >> <[email protected]> wrote: >> >> On Feb 17, 2011, at 15:28 , Mitul Adhia wrote: >> >> > Hi Henrik, >> > >> > Thanks a ton it works now !!!!! >> > >> > I have one more question to configure ssl or resource file there are >> > corresponding xml files i.e jetty-ssl.xml & jetty-fileserver.xml do i need >> > to add them in the same location where my jetty.xml is available or i can >> > append the data which are available in both the xml's in single >> > jetty.xml.... ? What is your suggestion ? >> >> I just added an ssl connector into jetty.xml: >> >> <Call name="addConnector"> >> <Arg> >> <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector"> >> <Set name="host"> >> <SystemProperty name="jetty.ssl.host" default="0.0.0.0" /> >> </Set> >> <Set name="Port"> >> <SystemProperty name="jetty.ssl.port" default="8443" /> >> </Set> >> <Set name="maxIdleTime">30000</Set> >> <Set name="Acceptors">2</Set> >> <Set name="AcceptQueueSize">100</Set> >> <Set name="Password"> >> <SystemProperty name="jetty.ssl.password" default="..." /> >> </Set> >> <Set name="Keystore"> >> <SystemProperty name="jetty.ssl.keystore" default="..." /> >> </Set> >> <Set name="KeystoreType"> >> <SystemProperty name="jetty.ssl.keystoretype" default="..." /> >> </Set> >> <Set name="KeyPassword"> >> <SystemProperty name="jetty.ssl.keypassword" default="..." /> >> </Set> >> <Set name="Truststore"> >> <SystemProperty name="jetty.ssl.keystore" default="..." /> >> </Set> >> <Set name="TrustPassword"> >> <SystemProperty name="jetty.ssl.password" default="..." /> >> </Set> >> <Set name="TruststoreType"> >> <SystemProperty name="jetty.ssl.keystoretype" default="..." /> >> </Set> >> </New> >> </Arg> >> </Call> >> >> We use the jetty.ssl.* properties to override the default values when we >> develop. The values used in deployment are set as defaults. Note that we >> reuse the jetty.ssl.keystore* stuff, which you might or might not want to do. >> >> > If answer is yes do i need to create customize handler for resourcefile >> > handler / ssl connector the way it was develop for servlet context handler >> > ? >> > Something like this >> > >> > MyFileHandlet extends >> > MySSLConnector extends SslSelectChannelConnector . >> >> Nope, shouldn't be necessary. >> >> // Henrik >> _______________________________________________ >> jetty-users mailing list >> [email protected] >> https://dev.eclipse.org/mailman/listinfo/jetty-users >> >> _______________________________________________ >> jetty-users mailing list >> [email protected] >> https://dev.eclipse.org/mailman/listinfo/jetty-users > > > _______________________________________________ > jetty-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/jetty-users > > > _______________________________________________ > jetty-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/jetty-users _______________________________________________ jetty-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/jetty-users
