updated to patch from 20091210

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1145 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2009-12-11 03:27:18 +00:00
parent 1b8913e75e
commit 219c9dd740
40 changed files with 979 additions and 335 deletions

View File

@ -1,13 +1,13 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Jetty :: OSGi :: Boot JSP
Bundle-Name: Jetty-OSGi-Jasper integration
Fragment-Host: org.eclipse.jetty.osgi.boot
Bundle-SymbolicName: org.eclipse.jetty.osgi.boot.jsp;singleton:=true
Bundle-Version: 7.0.1.qualifier
Bundle-Vendor: Mort Bay Consulting
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.mortbay.jetty.jsp-2.1;bundle-version="[7.0,8)",
org.mortbay.jetty.jsp-2.1-glassfish;bundle-version="[9.1.1, 10.0)"
Require-Bundle: org.mortbay.jetty.jsp-2.1-glassfish,
org.mortbay.jetty.jsp-api-2.1-glassfish
Import-Package: javax.el;version="2.1",
javax.servlet.jsp;version="2.1",
javax.servlet.jsp.el;version="2.1",

View File

@ -0,0 +1,5 @@
source.. = src/main/java/
output.. = target/classes/
bin.includes = META-INF/,\
.
src.includes = META-INF/

View File

@ -33,6 +33,10 @@
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-api-2.1-glassfish</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>jetty-osgi</artifactId>
<version>7.0.1-SNAPSHOT</version>
<groupId>org.eclipse.jetty.osgi</groupId>
</parent>
<artifactId>org.eclipse.jetty.osgi.boot.jsp</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View File

@ -0,0 +1,39 @@
// ========================================================================
// Copyright (c) 2009 Intalio, Inc.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.osgi.boot.jasper;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
/**
* Pseudo fragment activator.
* Called by the main org.eclipse.jetty.osgi.boot bundle.
* Please note: this is not a real BundleActivator. Simply something called back by
* the host bundle.
*/
public class FragmentActivator implements BundleActivator
{
/**
*
*/
public void start(BundleContext context) throws Exception {
System.err.println("hello from jasper boot fragment");
}
/**
*
*/
public void stop(BundleContext context) throws Exception {
}
}

View File

@ -9,8 +9,6 @@
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
// You may elect to redistribute this code under either of these licenses.
// Contributors:
// Hugues Malphettes - initial API and implementation
// ========================================================================
package org.eclipse.jetty.osgi.boot.jasper;
@ -19,6 +17,7 @@ import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import javax.servlet.Servlet;
import javax.servlet.jsp.JspContext;
import org.apache.jasper.Constants;
@ -44,8 +43,7 @@ public class WebappRegistrationCustomizerImpl implements WebappRegistrationCusto
fixupDtdResolution();
try
{
Class<?> cl = getClass().getClassLoader().loadClass(
"org.apache.jasper.servlet.JspServlet");
Class cl = getClass().getClassLoader().loadClass("org.apache.jasper.servlet.JspServlet");
System.err.println("found the jsp servlet: " + cl.getName());
}
catch (ClassNotFoundException e)
@ -164,12 +162,16 @@ public class WebappRegistrationCustomizerImpl implements WebappRegistrationCusto
{
String resourcePath = CACHED_DTD_RESOURCE_PATHS[i];
InputStream input = null;
input = JspContext.class.getResourceAsStream(resourcePath);
input = Servlet.class.getResourceAsStream(resourcePath);
if (input == null)
{
// if that failed try again with the original code:
// although it is likely not changed.
input = this.getClass().getResourceAsStream(resourcePath);
input = JspContext.class.getResourceAsStream(resourcePath);
if (input == null)
{
// if that failed try again with the original code:
// although it is likely not changed.
input = this.getClass().getResourceAsStream(resourcePath);
}
}
if (input == null)
{

View File

@ -1,6 +1,6 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Jetty :: OSGi :: Boot :: Warurl
Bundle-Name: Support for rfc66 war url scheme
Bundle-SymbolicName: org.eclipse.jetty.osgi.boot.warurl;singleton:=true
Bundle-Version: 7.0.1.qualifier
Bundle-Activator: org.eclipse.jetty.osgi.boot.warurl.WarUrlActivator

View File

@ -0,0 +1,5 @@
source.. = src/main/java/
output.. = target/classes/
bin.includes = META-INF/,\
.
src.includes = META-INF/

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>jetty-osgi</artifactId>
<version>7.0.1-SNAPSHOT</version>
<groupId>org.eclipse.jetty.osgi</groupId>
</parent>
<groupId>org.eclipse.jetty.osgi</groupId>
<artifactId>org.eclipse.jetty.osgi.boot.warurl</artifactId>
<version>7.0.1.qualifier</version>
<packaging>eclipse-plugin</packaging>
</project>

View File

@ -1,7 +1,8 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Jetty :: OSGi :: Boot
Bundle-Name: Jetty OSGi bootstrap
Bundle-SymbolicName: org.eclipse.jetty.osgi.boot;singleton:=true
Bundle-Vendor: Mort Bay Consulting
Bundle-Version: 7.0.1.qualifier
Bundle-Activator: org.eclipse.jetty.osgi.boot.JettyBootstrapActivator
Import-Package: javax.mail;resolution:=optional,
@ -23,7 +24,12 @@ Import-Package: javax.mail;resolution:=optional,
org.osgi.service.cm;version="1.2.0",
org.osgi.service.packageadmin,
org.osgi.service.startlevel;version="1.0",
org.xml.sax
org.osgi.service.url;version="1.0.0",
org.osgi.util.tracker;version="1.3.0",
org.xml.sax,
org.slf4j;resolution:=optional,
org.slf4j.spi;resolution:=optional,
org.slf4j.helpers;resolution:=optional
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.jetty.ajp;bundle-version="[7.0,8)";resolution:=optional,
org.eclipse.jetty.annotations;bundle-version="[7.0,8)";resolution:=optional,
@ -42,6 +48,7 @@ Require-Bundle: org.eclipse.jetty.ajp;bundle-version="[7.0,8)";resolution:=optio
org.eclipse.jetty.servlets;bundle-version="[7.0,8)";resolution:=optional,
org.eclipse.jetty.util;bundle-version="[7.0,8)",
org.eclipse.jetty.webapp;bundle-version="[7.0,8)",
org.eclipse.jetty.websocket;bundle-version="[7.0,8)";resolution:=optional,
org.eclipse.jetty.xml;bundle-version="[7.0,8)"
Export-Package: org.eclipse.jetty.osgi.boot,
org.eclipse.jetty.osgi.boot.utils

View File

@ -0,0 +1,15 @@
source.. = src/main/java/
output.. = target/classes/
bin.includes = META-INF/,\
.,\
jettyhome/
bin.excludes = jettyhome/logs/2009_09_21.request.log,\
jettyhome/lib/atomikos-util-3.5.8.jar,\
jettyhome/lib/transactions-3.5.8.jar,\
jettyhome/lib/transactions-api-3.5.8.jar,\
jettyhome/lib/transactions-jdbc-3.5.8.jar,\
jettyhome/lib/transactions-jta-3.5.8.jar,\
jettyhome/lib/ext/derby-10.4.1.3.jar,\
jettyhome/lib/ext/derbytools-10.4.1.3.jar
src.includes = META-INF/,\
jettyhome/

View File

@ -1,5 +1,5 @@
#
# This is a sample properties file for the org.mortbay.jetty.security.JDBCUserRealm
# This is a sample properties file for the org.eclipse.jetty.security.JDBCLoginService
# implemtation of the UserRealm interface. This allows Jetty users authentication
# to work from a database.
#

View File

@ -1,14 +1,14 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="Server" class="org.mortbay.jetty.Server">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Add a AJP listener on port 8009 -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.ajp.Ajp13SocketConnector">
<New class="org.eclipse.jetty.ajp.Ajp13SocketConnector">
<Set name="port">8009</Set>
</New>
</Arg>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Configure SSL for the Jetty Server -->
<!-- this configuration file should be used in combination with -->
<!-- other configuration files. e.g. -->
<!-- java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ssl.SslSocketConnector">
<Set name="Port">9443</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Keystore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
<Set name="Password">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
<Set name="KeyPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
<Set name="truststore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
<Set name="trustPassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
</New>
</Arg>
</Call>
</Configure>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Mixin configuration for Block socket connector -->
@ -7,12 +7,12 @@
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.jetty.Server">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- Use this connector if NIO is not available. -->
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.bio.SocketConnector">
<New class="org.eclipse.jetty.server.bio.SocketConnector">
<Set name="port"><SystemProperty name="jetty.bio.port" default="8081"/></Set>
<Set name="maxIdleTime">50000</Set>
<Set name="lowResourceMaxIdleTime">1500</Set>

View File

@ -0,0 +1,23 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!-- =============================================================== -->
<!-- Mixin the DebugHandler -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Get id="oldhandler" name="handler"/>
<Set name="handler">
<New id="DebugHandler" class="org.eclipse.jetty.server.handler.DebugHandler">
<Set name="handler"><Ref id="oldhandler"/></Set>
<Set name="outputStream">
<New class="org.eclipse.jetty.util.RolloverFileOutputStream">
<Arg type="String"><SystemProperty name="jetty.logs" default="./logs"/>/yyyy_mm_dd.debug.log</Arg>
<Arg type="boolean">true</Arg> <!-- append -->
<Arg type="int">90</Arg> <!-- retain days -->
</New>
</Set>
</New>
</Set>
</Configure>

View File

@ -0,0 +1,37 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="FileServer" class="org.eclipse.jetty.server.Server">
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="port">8080</Set>
</New>
</Arg>
</Call>
<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>
</Configure>

View File

@ -1,42 +1,47 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Configure the JVM JMX Server -->
<!-- this configuration file should be used in combination with -->
<!-- other configuration files. e.g. -->
<!-- java -jar start.jar etc/jetty-jmx.xml etc/jetty.xml -->
<!-- See jetty-jmx-mx4j.xml for a non JVM server solution -->
<!-- java -DOPTIONS=jmx -jar start.jar etc/jetty-jmx.xml etc/jetty.xml -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.jetty.Server">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Initialize an mbean server -->
<!-- =========================================================== -->
<!-- Use the jdk 1.5 platformMBeanServer -->
<Call id="MBeanServer" class="java.lang.management.ManagementFactory" name="getPlatformMBeanServer"/>
<!-- Use an mx4j mbean server - use this if running with jdk<1.5
<Call id="MBeanServer" class="javax.management.MBeanServerFactory" name="createMBeanServer"/>
-->
<!-- =========================================================== -->
<!-- Initialize the Jetty MBean container -->
<!-- =========================================================== -->
<New id="MBeanContainer" class="org.eclipse.jetty.jmx.MBeanContainer">
<Arg><Ref id="MBeanServer"/></Arg>
</New>
<!-- Add to the Server to listen for object events -->
<Get id="Container" name="container">
<Call name="addEventListener">
<Arg>
<New class="org.mortbay.management.MBeanContainer">
<Arg><Ref id="MBeanServer"/></Arg>
<!-- If using < jdk1.5 uncomment to start http adaptor -->
<!-- Set name="managementPort">8082</Set -->
<Call name="start" />
</New>
</Arg>
<Arg><Ref id="MBeanContainer"/></Arg>
</Call>
</Get>
<!-- Add to the Server as a lifecycle -->
<!-- Only do this if you know you will only have a single jetty server -->
<Call name="addBean">
<Arg><Ref id="MBeanContainer"/></Arg>
</Call>
<!-- Add the static log -->
<Get id="Logger" class="org.eclipse.jetty.util.log.Log" name="log"/>
<Ref id="MBeanContainer">
<Call name="addBean">
<Arg><Ref id="Logger"/></Arg>
</Call>
</Ref>
<!-- optionally add a remote JMX connector
<Call id="jmxConnector" class="javax.management.remote.JMXConnectorServerFactory" name="newJMXConnectorServer">
<Arg>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
@ -8,11 +8,11 @@
<!-- other configuration files. e.g. -->
<!-- java -jar start.jar etc/jetty-logging.xml etc/jetty.xml -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.jetty.Server">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<New id="ServerLog" class="java.io.PrintStream">
<Arg>
<New class="org.mortbay.util.RolloverFileOutputStream">
<New class="org.eclipse.jetty.util.RolloverFileOutputStream">
<Arg><SystemProperty name="jetty.home" default="."/>/logs/yyyy_mm_dd.stderrout.log</Arg>
<Arg type="boolean">false</Arg>
<Arg type="int">90</Arg>
@ -22,7 +22,7 @@
</Arg>
</New>
<Call class="org.mortbay.log.Log" name="info"><Arg>Redirecting stderr/stdout to <Ref id="ServerLogName"/></Arg></Call>
<Call class="org.eclipse.jetty.util.log.Log" name="info"><Arg>Redirecting stderr/stdout to <Ref id="ServerLogName"/></Arg></Call>
<Call class="java.lang.System" name="setErr"><Arg><Ref id="ServerLog"/></Arg></Call>
<Call class="java.lang.System" name="setOut"><Arg><Ref id="ServerLog"/></Arg></Call>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Configure Jetty Plus features -->
@ -17,7 +17,7 @@
<!-- For more information about Jetty Plus, see the Jetty wiki at -->
<!-- http://docs.codehaus.org/display/JETTY/Jetty+Wiki -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.jetty.Server">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Example JAAS realm setup. -->
@ -26,9 +26,9 @@
<!-- the web.xml file. -->
<!-- =========================================================== -->
<!--
<Call name="addUserRealm">
<Call name="addLoginService">
<Arg>
<New class="org.mortbay.jetty.plus.jaas.JAASUserRealm">
<New class="org.eclipse.jetty.plus.jaas.JAASLoginService">
<Set name="name">xyzrealm</Set>
<Set name="LoginModuleName">xyz</Set>
</New>
@ -41,11 +41,14 @@
<!-- Sequence of configurations to enable Plus features. -->
<!-- =========================================================== -->
<Array id="plusConfig" type="java.lang.String">
<Item>org.mortbay.jetty.webapp.WebInfConfiguration</Item>
<Item>org.mortbay.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.mortbay.jetty.plus.webapp.Configuration</Item>
<Item>org.mortbay.jetty.webapp.JettyWebXmlConfiguration</Item>
<Item>org.mortbay.jetty.webapp.TagLibConfiguration</Item>
<Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item>
<Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item>
<Item>org.eclipse.jetty.webapp.MetaInfConfiguration</Item>
<Item>org.eclipse.jetty.webapp.FragmentConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.Configuration</Item>
<Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item>
<Item>org.eclipse.jetty.webapp.TagLibConfiguration</Item>
</Array>
<!-- =========================================================== -->
@ -57,7 +60,7 @@
<!--
<Call name="addLifeCycle">
<Arg>
<New class="org.mortbay.jetty.deployer.WebAppDeployer">
<New class="org.eclipse.jetty.deploy.WebAppDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps-plus</Set>
<Set name="parentLoaderPriority">false</Set>
@ -65,6 +68,10 @@
<Set name="allowDuplicates">false</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="configurationClasses"><Ref id="plusConfig"/></Set>
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/jsp-api-[^/]*\.jar$|.*/jsp-[^/]*\.jar$</Arg>
</Call>
</New>
</Arg>
</Call>

View File

@ -0,0 +1,64 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Configure the Jetty Server -->
<!-- -->
<!-- Documentation of this file format can be found at: -->
<!-- http://docs.codehaus.org/display/JETTY/jetty.xml -->
<!-- -->
<!-- =============================================================== -->
<Configure id="Proxy" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Server Thread Pool -->
<!-- =========================================================== -->
<Set name="ThreadPool">
<!-- Default queued blocking threadpool
-->
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">50</Set>
</New>
</Set>
<!-- =========================================================== -->
<!-- Set connectors -->
<!-- =========================================================== -->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8888"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<Set name="handler">
<New id="Servlets" class="org.eclipse.jetty.servlet.ServletHandler">
<Call name="addServletWithMapping">
<Arg>org.eclipse.jetty.servlets.ProxyServlet</Arg>
<Arg>/</Arg>
</Call>
</New>
</Set>
<!-- =========================================================== -->
<!-- extra options -->
<!-- =========================================================== -->
<Set name="stopAtShutdown">true</Set>
<Set name="sendServerVersion">true</Set>
<Set name="sendDateHeader">true</Set>
<Set name="gracefulShutdown">1000</Set>
</Configure>

View File

@ -1,149 +1,77 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Mixin the RewriteHandler -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.jetty.Server">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Configure Rewrite Handler -->
<!-- configure rewrite handler -->
<!-- =========================================================== -->
<Get id="oldhandler" name="handler"/>
<Set name="handler">
<New id="Rewrite" class="org.mortbay.jetty.handler.rewrite.RewriteHandler">
<New id="Rewrite" class="org.eclipse.jetty.rewrite.handler.RewriteHandler">
<Set name="handler"><Ref id="oldhandler"/></Set>
<Set name="rewriteRequestURI">true</Set>
<Set name="rewritePathInfo">false</Set>
<Set name="originalPathAttribute">requestedPath</Set>
<Set name="rules">
<Array type="org.mortbay.jetty.handler.rewrite.Rule">
<!-- Add rule to protect against IE ssl bug -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.MsieSslRule"/>
</Arg>
</Call>
<!-- return an error message if low on threads; put this at the top so it will be processed first -->
<Item>
<New id="lowThreads" class="org.mortbay.jetty.handler.rewrite.LowThreadsRuleContainer">
<!-- set the trigger for low threads ridiculously low
uncomment the block below to see it in action -->
<!--Ref id="Server">
<Get id="serverThreadPool" name="threadPool">
<Set name="minThreads">3</Set>
<Set name="maxThreads">4</Set>
<Set name="lowThreads">0</Set>
</Get>
</Ref>
<Set name="threadPool"><Ref id="serverThreadPool"/></Set-->
<Call name="addRule">
<Arg>
<New id="busyresponse" class="org.mortbay.jetty.handler.rewrite.ResponsePatternRule">
<Set name="pattern">/*</Set>
<Set name="code">500</Set>
<Set name="reason">Server busy</Set>
</New>
</Arg>
</Call>
</New>
</Item>
<!-- Add rule to protect against IE ssl bug -->
<Item>
<New class="org.mortbay.jetty.handler.rewrite.MsieSslRule"/>
</Item>
<!-- protect favicon handling -->
<Item>
<New class="org.mortbay.jetty.handler.rewrite.HeaderPatternRule">
<Set name="pattern">/favicon.ico</Set>
<Set name="name">Cache-Control</Set>
<Set name="value">Max-Age=3600,public</Set>
<Set name="terminating">true</Set>
</New>
</Item>
<!-- protect favicon handling -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.HeaderPatternRule">
<Set name="pattern">/favicon.ico</Set>
<Set name="name">Cache-Control</Set>
<Set name="value">Max-Age=3600,public</Set>
<Set name="terminating">true</Set>
</New>
</Arg>
</Call>
<!-- add a regex rule -->
<Item>
<New class="org.mortbay.jetty.handler.rewrite.RewriteRegexRule">
<Set name="regex">/rewrite/dump/regex/([^/]*)/(.*)</Set>
<Set name="replacement">/test/dump/$2/$1</Set>
</New>
</Item>
<!-- use legacy API for some rewrites -->
<Call name="addRewriteRule">
<Arg>/some/old/context/*</Arg>
<Arg>/test/dump/newcontext</Arg>
</Call>
<Call name="addRewriteRule">
<Arg>/test/dump/rewrite/*</Arg>
<Arg>/test/dump/rewritten</Arg>
</Call>
<Call name="addRewriteRule">
<Arg>/test/dump/rewrite/protect/*</Arg>
<Arg/>
</Call>
<Call name="addRewriteRule">
<Arg>/test/*</Arg>
<Arg/>
</Call>
<Call name="addRewriteRule">
<Arg>/*</Arg>
<Arg>/test</Arg>
</Call>
<!-- add a rewrite rule -->
<Item>
<New id="" class="org.mortbay.jetty.handler.rewrite.RewritePatternRule">
<Set name="pattern">/rewrite</Set>
<Set name="replacement">/rewrittento</Set>
</New>
</Item>
<!-- add a response rule -->
<Item>
<New id="response" class="org.mortbay.jetty.handler.rewrite.ResponsePatternRule">
<Set name="pattern">/rewrite/session/</Set>
<Set name="code">401</Set>
<Set name="reason">Setting error code 401</Set>
</New>
</Item>
<!-- add a header pattern rule -->
<Item>
<New id="header" class="org.mortbay.jetty.handler.rewrite.HeaderPatternRule">
<Set name="pattern">*.jsp</Set>
<Set name="name">Server</Set>
<Set name="value">Server for JSP</Set>
</New>
</Item>
<!-- add a redirect -->
<Item>
<New id="redirect" class="org.mortbay.jetty.handler.rewrite.RedirectPatternRule">
<Set name="pattern">/rewrite/dispatch</Set>
<Set name="location">http://jetty.mortbay.org</Set>
</New>
</Item>
<Item>
<New id="forwardedHttps" class="org.mortbay.jetty.handler.rewrite.ForwardedSchemeHeaderRule">
<Set name="header">X-Forwarded-Scheme</Set>
<Set name="headerValue">https</Set>
<Set name="scheme">https</Set>
</New>
</Item>
<Item>
<New id="virtualHost" class="org.mortbay.jetty.handler.rewrite.VirtualHostRuleContainer">
<Set name="virtualHosts">
<Array type="java.lang.String">
<Item>mortbay.com</Item>
<Item>www.mortbay.com</Item>
<Item>mortbay.org</Item>
<Item>www.mortbay.org</Item>
</Array>
</Set>
<Call name="addRule">
<Arg>
<New class="org.mortbay.jetty.handler.rewrite.CookiePatternRule">
<Set name="pattern">/*</Set>
<Set name="name">CookiePatternRule</Set>
<Set name="value">1</Set>
</New>
</Arg>
</Call>
</New>
</Item>
</Array>
</Set>
</New>
<!-- add a regex rule -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RewriteRegexRule">
<Set name="regex">/test/dump/regex/([^/]*)/(.*)</Set>
<Set name="replacement">/test/dump/$2/$1</Set>
</New>
</Arg>
</Call>
</New>
</Set>
</Configure>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Configure SSL for the Jetty Server -->
@ -7,28 +7,22 @@
<!-- other configuration files. e.g. -->
<!-- java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.jetty.Server">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- if NIO is not available, use org.eclipse.jetty.server.ssl.SslSocketConnector -->
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.security.SslSocketConnector">
<Set name="Port">8443</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="handshakeTimeout">2000</Set>
<Set name="keystore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
<Set name="password">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
<Set name="keyPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
<Set name="truststore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
<Set name="Port"><Property name="jetty.port.ssl" default="8443" /></Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="AcceptQueueSize">100</Set>
<Set name="Keystore"><Property name="jetty.home" default="." />/etc/keystore</Set>
<Set name="Password">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
<Set name="KeyPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
<Set name="truststore"><Property name="jetty.home" default="." />/etc/keystore</Set>
<Set name="trustPassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
<Set name="handshakeTimeout">2000</Set>
<!-- Set name="ThreadPool">
<New class="org.mortbay.thread.BoundedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">250</Set>
</New>
</Set -->
</New>
</Arg>
</Call>

View File

@ -1,19 +1,19 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Mixin the Statistics Handler -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.jetty.Server">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Get id="oldhandler" name="handler"/>
<Set name="handler">
<New id="StatsHandler" class="org.mortbay.jetty.handler.AtomicStatisticsHandler">
<!-- Use non-atomic for jdk 1.4 -->
<!-- New id="StatsHandler" class="org.mortbay.jetty.handler.StatisticsHandler" -->
<New id="StatsHandler" class="org.eclipse.jetty.server.handler.StatisticsHandler">
<Set name="handler"><Ref id="oldhandler"/></Set>
</New>
</Set>
</Configure>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Configuration for starting up Jetty using inetd/xinetd -->
@ -32,11 +32,11 @@ service jetty
-->
<Configure id="Server" class="org.mortbay.jetty.Server">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call name="addConnector">
<Arg>
<!-- Inherited channel (from inetd/xinetd) -->
<New class="org.mortbay.jetty.nio.InheritedChannelConnector">
<New class="org.eclipse.jetty.server.nio.InheritedChannelConnector">
<!-- Optional. Fallback in case System.inheritedChannel() does not give a ServerSocketChannel

View File

@ -31,20 +31,24 @@
-->
</Set>
<!-- Added from jetty-plus.xml but is this really necessary? -->
<!-- Taken from jetty-plus.xml-->
<!-- =========================================================== -->
<!-- Configurations for WebAppContexts -->
<!-- Sequence of configurations to enable Plus features. -->
<!-- =========================================================== -->
<!-- TODO: test that indeed the corresponding jetty plus jars are available
in this classloader. -->
<Array id="plusConfig" type="java.lang.String">
<Item>org.mortbay.jetty.webapp.WebInfConfiguration</Item>
<Item>org.mortbay.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.mortbay.jetty.plus.webapp.Configuration</Item>
<Item>org.mortbay.jetty.webapp.JettyWebXmlConfiguration</Item>
<Item>org.mortbay.jetty.webapp.TagLibConfiguration</Item>
<Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item>
<Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item>
<Item>org.eclipse.jetty.webapp.MetaInfConfiguration</Item>
<Item>org.eclipse.jetty.webapp.FragmentConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.Configuration</Item>
<Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item>
<Item>org.eclipse.jetty.webapp.TagLibConfiguration</Item>
</Array>
<!-- =========================================================== -->
<!-- Set connectors -->
<!-- =========================================================== -->
@ -52,8 +56,8 @@
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="8080"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
@ -120,7 +124,7 @@
<Arg>
<New class="org.eclipse.jetty.deploy.ContextDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/contexts</Set>
<Set name="configurationDir"><Property name="jetty.home" default="."/>/contexts</Set>
<Set name="scanInterval">5</Set>
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
@ -147,11 +151,11 @@
<Arg>
<New class="org.eclipse.jetty.deploy.WebAppDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps</Set>
<Set name="webAppDir"><Property name="jetty.home" default="."/>/webapps</Set>
<Set name="parentLoaderPriority">false</Set>
<Set name="extract">true</Set>
<Set name="allowDuplicates">false</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/jsp-api-[^/]*\.jar$|.*/jsp-[^/]*\.jar$</Arg>
@ -171,7 +175,7 @@
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Test Realm</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
<Set name="config"><Property name="jetty.home" default="."/>/etc/realm.properties</Set>
<Set name="refreshInterval">0</Set>
</New>
</Arg>
@ -187,7 +191,7 @@
<Ref id="RequestLog">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
<Set name="filename"><SystemProperty name="jetty.home" default="."/>/logs/yyyy_mm_dd.request.log</Set>
<Set name="filename"><Property name="jetty.home" default="."/>/logs/yyyy_mm_dd.request.log</Set>
<Set name="filenameDateFormat">yyyy_MM_dd</Set>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>

View File

@ -5,17 +5,17 @@
# <username>: <password>[,<rolename> ...]
#
# Passwords may be clear text, obfuscated or checksummed. The class
# org.mortbay.util.Password should be used to generate obfuscated
# org.eclipse.util.Password should be used to generate obfuscated
# passwords or password checksums
#
# If DIGEST Authentication is used, the password must be in a recoverable
# format, either plain text or OBF:.
#
jetty: MD5:164c88b302622e17050af52c89945d44,user
admin: CRYPT:ad1ks..kc.1Ug,server-administrator,content-administrator,admin
other: OBF:1xmk1w261u9r1w1c1xmq
plain: plain
user: password
admin: CRYPT:adpexzg3FUZAk,server-administrator,content-administrator,admin
other: OBF:1xmk1w261u9r1w1c1xmq,user
plain: plain,user
user: password,user
# This entry is for digest auth. The credential is a MD5 hash of username:realmname:password
digest: MD5:6e120743ad67abfbc385bc2bb754e297
digest: MD5:6e120743ad67abfbc385bc2bb754e297,user

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>jetty-osgi</artifactId>
<groupId>org.eclipse.jetty.osgi</groupId>
<version>7.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jetty.osgi.boot</artifactId>
<packaging>eclipse-plugin</packaging>
<!--build>
<resources>
<resource>
<excludes>
<exclude>jettyhome/lib/ext/*.jar</exclude>
<exclude>jettyhome/logs/*.log</exclude>
</excludes>
</resource>
</resources>
</build-->
</project>

View File

@ -28,6 +28,9 @@ public class OSGiWebappConstants
/** Name of the header that defines the path to the folder where the jsp files are extracted. */
public static final String RFC66_JSP_EXTRACT_LOCATION = "Jsp-ExtractLocation";
/** Name of the servlet context attribute that points to the bundle context. */
public static final String RFC66_OSGI_BUNDLE_CONTEXT = "osgi-bundlecontext";
/** List of relative pathes within the bundle to the jetty context files. */
public static final String JETTY_CONTEXT_FILE_PATH = "Jetty-ContextFilePath";
@ -47,7 +50,20 @@ public class OSGiWebappConstants
/** jetty context file path */
public static final String SERVICE_PROP_CONTEXT_FILE_PATH = "contextFilePath";
/** web.xml file path */
public static final String SERVICE_PROP_WEB_XML_PATH = "webXmlFilePath";
/** defaultweb.xml file path */
public static final String SERVICE_PROP_DEFAULT_WEB_XML_PATH = "defaultWebXmlFilePath";
/** path to the base folder that overrides the computed bundle installation location if not null
* useful to install webapps or jetty context files that are in fact not embedded in a bundle */
public static final String SERVICE_PROP_BUNDLE_INSTALL_LOCATION_OVERRIDE = "thisBundleInstall";
// sys prop config of jetty:
/** contains a comma separated list of pathes to the etc/jetty-*.xml files
* used to configure jetty. By default the value is 'etc/jetty.xml'
* when the path is relative the file is resolved relatively to jettyhome. */
public static final String SYS_PROP_JETTY_ETC_FILES = "jetty.etc.files";
}

View File

@ -19,6 +19,7 @@ import java.net.URL;
/**
* Add a classloader to the org.apache.jasper.compiler.TldLocatableURLClassloader.
* Hopefuly not necessary: still experimenting.
*
* @see TldLocatableURLClassloader
*/
public class TldLocatableURLClassloaderWithInsertedJettyClassloader extends TldLocatableURLClassloader
@ -26,10 +27,16 @@ public class TldLocatableURLClassloaderWithInsertedJettyClassloader extends TldL
private ClassLoader _internalClassLoader;
public TldLocatableURLClassloaderWithInsertedJettyClassloader(ClassLoader osgiClassLoader,
/**
*
* @param osgiClassLoader The parent classloader
* @param internalClassLoader The classloader that will be at the same level than the jarsWithTldsInside
* @param jarsWithTldsInside jars that are scanned for tld files.
*/
public TldLocatableURLClassloaderWithInsertedJettyClassloader(ClassLoader osgiClassLoaderParent,
ClassLoader internalClassLoader, URL[] jarsWithTldsInside)
{
super(osgiClassLoader, jarsWithTldsInside);
super(osgiClassLoaderParent, jarsWithTldsInside);
_internalClassLoader = internalClassLoader;
}

View File

@ -165,17 +165,28 @@ public class JettyContextHandlerServiceTracker implements ServiceListener
if (contextHandler instanceof WebAppContext)
{
WebAppContext webapp = (WebAppContext)contextHandler;
String contextPath = (String)sr.getProperty("contextPath");
String contextPath = (String)sr.getProperty(OSGiWebappConstants.SERVICE_PROP_CONTEXT_PATH);
if (contextPath == null)
{
contextPath = webapp.getContextPath();
}
String webXmlPath = (String)sr.getProperty(OSGiWebappConstants.SERVICE_PROP_WEB_XML_PATH);
if (webXmlPath == null)
{
webXmlPath = webapp.getDescriptor();
}
String defaultWebXmlPath = (String)sr.getProperty(OSGiWebappConstants.SERVICE_PROP_DEFAULT_WEB_XML_PATH);
if (defaultWebXmlPath == null)
{
defaultWebXmlPath = webapp.getDefaultsDescriptor();
}
String war = (String)sr.getProperty("war");
try
try
{
ContextHandler handler = _helper.registerWebapplication(contributor, war, contextPath,
(String)sr.getProperty(OSGiWebappConstants.SERVICE_PROP_EXTRA_CLASSPATH),
(String)sr.getProperty(OSGiWebappConstants.SERVICE_PROP_BUNDLE_INSTALL_LOCATION_OVERRIDE));
(String)sr.getProperty(OSGiWebappConstants.SERVICE_PROP_BUNDLE_INSTALL_LOCATION_OVERRIDE),
webXmlPath, defaultWebXmlPath);
if (handler != null)
{
registerInIndex(handler, sr);
@ -183,7 +194,6 @@ public class JettyContextHandlerServiceTracker implements ServiceListener
}
catch (Throwable e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}

View File

@ -103,14 +103,6 @@ class JettyHomeHelper
|| eclipseCommands.indexOf("-dev ") != -1);
}
// /**
// * @return
// */
// private static File getEclipseInstallationDir() {
// return getFile(System.getProperty("eclipse.home.location",
// System.getProperty("osgi.install.area")));
// }
/**
* @return
*/

View File

@ -17,6 +17,10 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.eclipse.jetty.server.Server;
@ -28,6 +32,12 @@ import org.eclipse.jetty.server.Server;
* OSGi environment, we support inserting the jars in the usual jetty/lib/ext
* folders in the proper classpath for the webapps.
* <p>
* Also the folder resources typically contains central configuration files
* for things like: log config and others.
* We enable fragments to register classes that are called back and passed those resources
* to do what they need to do.
* </p>
* <p>
* For example the test-jndi webapplication depends on derby, derbytools, atomikos
* none of them are osgi bundles.
* we can either re-package them or we can place them in the usual lib/ext.
@ -61,28 +71,44 @@ import org.eclipse.jetty.server.Server;
* </p>
*/
public class LibExtClassLoaderHelper {
/**
* Class called back
*/
public interface IFilesInJettyHomeResourcesProcessor
{
void processFilesInResourcesFolder(File jettyHome, Map<String,File> filesInResourcesFolder);
}
public static Set<IFilesInJettyHomeResourcesProcessor> registeredFilesInJettyHomeResourcesProcessors =
new HashSet<IFilesInJettyHomeResourcesProcessor>();
/**
* @param server
* @return a url classloader with the jars of lib/ext. The parent classloader
* usuall is the JettyBootStrapper.
* @return a url classloader with the jars of resources, lib/ext and the jars passed in the other argument.
* The parent classloader usually is the JettyBootStrapper (an osgi classloader.
* @throws MalformedURLException
*/
public static ClassLoader createLibEtcClassLoaderHelper(File jettyHome, Server server,
public static URLClassLoader createLibEtcClassLoaderHelper(File jettyHome, Server server,
ClassLoader parentClassLoader)
throws MalformedURLException {
ArrayList<URL> urls = new ArrayList<URL>();
File jettyResources = new File(jettyHome, "resources");
if (jettyResources.exists()) {
//make sure it contains something else than README:
Map<String,File> jettyResFiles = new HashMap<String, File>();
for (File f : jettyResources.listFiles()) {
jettyResFiles.put(f.getName(),f);
if (f.getName().toLowerCase().startsWith("readme")) {
continue;
} else {
urls.add(jettyResources.toURI().toURL());
break;
if (urls.isEmpty())
{
urls.add(jettyResources.toURI().toURL());
}
}
}
processFilesInResourcesFolder(jettyHome, jettyResFiles);
}
File libEtc = new File(jettyHome, "lib/ext");
for (File f : libEtc.listFiles()) {
@ -95,12 +121,35 @@ public class LibExtClassLoaderHelper {
urls.add(url);
}
}
if (urls.isEmpty()) {
return parentClassLoader;
}
return new URLClassLoader(urls.toArray(new URL[urls.size()]),
parentClassLoader);
// if (urls.isEmpty()) {
// return parentClassLoader;
// }
return new URLClassLoader(urls.toArray(new URL[urls.size()]), parentClassLoader);
}
/**
* When we find files typically used for central logging configuration
* we do what it takes in this method to do what the user expects.
* Without depending too much directly on a particular logging framework.
* <p>
* We can afford to do some implementation specific code for a logging framework
* only in a fragment.
* <br/>
* Trying to configure log4j and logback in here.
* </p>
* <p>
* We recommend that slf4j jars are all placed in the osgi framework.
* And a single implementation if possible packaged as an osgi bundle is there.
* </p>
*/
protected static void processFilesInResourcesFolder(File jettyHome, Map<String,File> childrenFiles)
{
for (IFilesInJettyHomeResourcesProcessor processor : registeredFilesInJettyHomeResourcesProcessors)
{
processor.processFilesInResourcesFolder(jettyHome, childrenFiles);
}
}
}

View File

@ -0,0 +1,213 @@
// ========================================================================
// Copyright (c) 2009 Intalio, Inc.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
// You may elect to redistribute this code under either of these licenses.
// Contributors:
// Hugues Malphettes - initial API and implementation
// ========================================================================
package org.eclipse.jetty.osgi.boot.internal.webapp;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.jar.JarFile;
import javax.servlet.http.HttpServlet;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.WebAppClassLoader;
import org.eclipse.jetty.webapp.WebAppContext;
import org.osgi.framework.Bundle;
/**
* Extends the webappclassloader to insert the classloader provided by
* the osgi bundle at the same level than any other jars palced in the webappclassloader.
*/
public class WebappClassLoaderForOSGi extends WebAppClassLoader {
private Logger __logger = Log.getLogger(WebappClassLoaderForOSGi.class.getName().toString());
/** when a logging framework is
* setup in the osgi classloaders, it can access this and register
* the classes that must not be found in the jar. */
public static Set<String> JAR_WITH_SUCH_CLASS_MUST_BE_EXCLUDED = new HashSet<String>();
public static void addClassThatIdentifiesAJarThatMustBeRejected(Class<?> zclass)
{
JAR_WITH_SUCH_CLASS_MUST_BE_EXCLUDED.add(zclass.getName().replace('.', '/') + ".class");
}
public static void addClassThatIdentifiesAJarThatMustBeRejected(String zclassName)
{
JAR_WITH_SUCH_CLASS_MUST_BE_EXCLUDED.add(zclassName.replace('.', '/') + ".class");
}
static
{
addClassThatIdentifiesAJarThatMustBeRejected(HttpServlet.class);
//addClassThatIdentifiesAJarThatMustBeRejected(HttpServlet.class);
}
private ClassLoader _osgiBundleClassLoader;
private boolean _lookInOsgiFirst = true;
private Set<String> _libsAlreadyInManifest = new HashSet<String>();
public WebappClassLoaderForOSGi(ClassLoader parent, WebAppContext context,
Bundle contributor) throws IOException
{
super(parent, context);
_osgiBundleClassLoader = WebappRegistrationHelper
.BUNDLE_CLASS_LOADER_HELPER.getBundleClassLoader(contributor);
}
/**
* Reads the manifest.
* If the manifest is already configured to loads a few libs
* we should not add them to the classpath of the webapp.
* Not really important as we resolve classes through the osgi classloader first
* and then default on the libs of the webapp.
*/
private void computeLibsAlreadyInOSGiClassLoader()
{
//TODO
}
/**
*
*/
protected Class<?> findClass(String name) throws ClassNotFoundException
{
try
{
return _lookInOsgiFirst ? _osgiBundleClassLoader.loadClass(name)
: super.findClass(name);
}
catch (ClassNotFoundException cne)
{
try
{
return _lookInOsgiFirst ? super.findClass(name)
: _osgiBundleClassLoader.loadClass(name);
} catch (ClassNotFoundException cne2)
{
throw cne;
}
}
}
/**
* Parse the classpath ourselves to be able to filter things.
* This is a derivative work of the super class
*/
@Override
public void addClassPath(String classPath) throws IOException {
StringTokenizer tokenizer= new StringTokenizer(classPath, ",;");
while (tokenizer.hasMoreTokens())
{
String path = tokenizer.nextToken();
Resource resource= getContext().newResource(path);
// Resolve file path if possible
File file= resource.getFile();
if (file != null && isAcceptableLibrary(file, JAR_WITH_SUCH_CLASS_MUST_BE_EXCLUDED))
{
super.addClassPath(path);
}
else
{
__logger.info("Did not add " + path +
" to the classloader of the webapp " + getContext().getContextPath());
}
}
}
/**
* @param lib
* @return true if the lib should be included in the webapp classloader.
*/
private boolean isAcceptableLibrary(File file, Set<String> pathToClassFiles)
{
try {
if (file.isDirectory())
{
for (String criteria : pathToClassFiles)
{
if (new File(file, criteria).exists())
{
return false;
}
}
}
else
{
JarFile jar = null;
try
{
jar = new JarFile(file);
for (String criteria : pathToClassFiles)
{
if (jar.getEntry(criteria) != null)
{
return false;
}
}
}
finally
{
if (jar != null) try { jar.close(); } catch (IOException ioe) {}
}
}
} catch (IOException e) {
// nevermind. just trying our best
e.printStackTrace();
}
return true;
}
private static Field _contextField;
/**
* In the case of the generation of a webapp via a jetty context file
* we need a proper classloader to setup the app before we have the WebappContext
* So we place a fake one there to start with.
* We replace it with the actual webapp context with this method.
* We also apply the extraclasspath there at the same time.
*/
public void setWebappContext(WebAppContext webappContext)
{
try
{
if (_contextField == null)
{
_contextField = WebAppClassLoader.class.getDeclaredField("_context");
_contextField.setAccessible(true);
}
_contextField.set(this, webappContext);
if (webappContext.getExtraClasspath()!=null)
{
addClassPath(webappContext.getExtraClasspath());
}
}
catch (Throwable t)
{
//humf that will hurt if it does not work.
t.printStackTrace();
}
}
}

View File

@ -23,9 +23,11 @@ import java.io.InputStream;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
@ -33,8 +35,8 @@ import org.eclipse.jetty.deploy.ConfigurationManager;
import org.eclipse.jetty.deploy.ContextDeployer;
import org.eclipse.jetty.deploy.WebAppDeployer;
import org.eclipse.jetty.osgi.boot.JettyBootstrapActivator;
import org.eclipse.jetty.osgi.boot.OSGiWebappConstants;
import org.eclipse.jetty.osgi.boot.internal.jsp.TldLocatableURLClassloader;
import org.eclipse.jetty.osgi.boot.internal.jsp.TldLocatableURLClassloaderWithInsertedJettyClassloader;
import org.eclipse.jetty.osgi.boot.utils.BundleClassLoaderHelper;
import org.eclipse.jetty.osgi.boot.utils.BundleFileLocatorHelper;
import org.eclipse.jetty.osgi.boot.utils.WebappRegistrationCustomizer;
@ -44,15 +46,17 @@ import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.util.AttributesMap;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.JettyWebXmlConfiguration;
import org.eclipse.jetty.webapp.WebAppClassLoader;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.webapp.WebXmlConfiguration;
import org.eclipse.jetty.xml.XmlConfiguration;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/**
* Bridges the traditional web-application deployers: {@link WebAppDeployer} and
@ -75,6 +79,8 @@ import org.xml.sax.SAXException;
class WebappRegistrationHelper
{
private static Logger __logger = Log.getLogger(WebappRegistrationHelper.class.getName());
private static boolean INITIALIZED = false;
/** By default set to: {@link DefaultBundleClassLoaderHelper}. It supports equinox and apache-felix
@ -94,10 +100,19 @@ class WebappRegistrationHelper
private ContextHandlerCollection _ctxtHandler;
/**
* this class loader loads the jars inside {$jetty.home}/lib/ext it is meant as a migration path and for jars that are not OSGi ready.
* this class loader loads the jars inside {$jetty.home}/lib/ext it is meant
* as a migration path and for jars that are not OSGi ready.
* also gives access to the jsp jars.
*/
private ClassLoader _libEtcClassLoader;
//private URLClassLoader _libEtcClassLoader;
/**
* This is the class loader that should be the parent classloader
* of any webapp classloader. It is in fact the _libEtcClassLoader
* with a trick to let the TldScanner find the jars where the tld files are.
*/
private URLClassLoader _commonParentClassLoaderForWebapps;
public WebappRegistrationHelper(Server server)
{
_server = server;
@ -229,31 +244,57 @@ class WebappRegistrationHelper
try
{
XmlConfiguration config = new XmlConfiguration(
new FileInputStream(jettyHome + "/etc/jetty.xml"));
config.getProperties().put("jetty.home", jettyHome);
// passing this bundle's classloader as the context classlaoder
// makes sure there is access to all the jetty's bundles
File jettyHomeF = new File(jettyHome);
try
{
_libEtcClassLoader = LibExtClassLoaderHelper.createLibEtcClassLoaderHelper(
jettyHomeF,_server,JettyBootstrapActivator.class.getClassLoader());
URLClassLoader libEtcClassLoader = LibExtClassLoaderHelper.createLibEtcClassLoaderHelper(
jettyHomeF, _server, JettyBootstrapActivator.class.getClassLoader());
URL[] jarsWithTlds = getJarsWithTlds();
_commonParentClassLoaderForWebapps = jarsWithTlds == null
? libEtcClassLoader
: new TldLocatableURLClassloader(libEtcClassLoader, getJarsWithTlds());
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
Thread.currentThread().setContextClassLoader(_libEtcClassLoader);
config.configure(_server);
Thread.currentThread().setContextClassLoader(_commonParentClassLoaderForWebapps);
String jettyetc = System.getProperty(OSGiWebappConstants.SYS_PROP_JETTY_ETC_FILES, "etc/jetty.xml");
StringTokenizer tokenizer = new StringTokenizer(jettyetc, ";,");
while (tokenizer.hasMoreTokens())
{
String etcFile = tokenizer.nextToken().trim();
File conffile = etcFile.startsWith("/") ? new File(etcFile) : new File(jettyHomeF, etcFile);
if (!conffile.exists())
{
__logger.warn("Unable to resolve the jetty/etc file " + etcFile);
}
try
{
XmlConfiguration config = new XmlConfiguration(
new FileInputStream(conffile));
config.getProperties().put("jetty.home", jettyHome);
config.getProperties().put("jetty.host", System.getProperty("jetty.host", ""));
config.getProperties().put("jetty.port", System.getProperty("jetty.port", "8080"));
config.getProperties().put("jetty.port.ssl", System.getProperty("jetty.port.ssl", "8443"));
config.configure(_server);
}
catch (SAXParseException saxparse)
{
Log.getLogger(WebappRegistrationHelper.class.getName())
.warn("Unable to configure the jetty/etc file " + etcFile, saxparse);
throw saxparse;
}
}
init();
_server.start();
// _server.join();
}
catch (Throwable t)
{
@ -342,7 +383,8 @@ class WebappRegistrationHelper
* @throws Exception
*/
public ContextHandler registerWebapplication(Bundle bundle, String webappFolderPath,
String contextPath, String extraClasspath, String overrideBundleInstallLocation) throws Exception
String contextPath, String extraClasspath, String overrideBundleInstallLocation,
String webXmlPath, String defaultWebXmlPath) throws Exception
{
File bundleInstall = overrideBundleInstallLocation == null
? BUNDLE_FILE_LOCATOR_HELPER.getBundleInstallLocation(bundle)
@ -372,7 +414,7 @@ class WebappRegistrationHelper
? bundleInstall.getAbsolutePath()
: "unlocated bundle '" + bundle.getSymbolicName() + "'"));
}
return registerWebapplication(bundle,webapp,contextPath,extraClasspath);
return registerWebapplication(bundle,webapp,contextPath,extraClasspath, bundleInstall, webXmlPath, defaultWebXmlPath);
}
/**
@ -385,7 +427,8 @@ class WebappRegistrationHelper
* @throws Exception
*/
public ContextHandler registerWebapplication(Bundle contributor, File webapp,
String contextPath, String extraClasspath) throws Exception
String contextPath, String extraClasspath,
File bundleInstall, String webXmlPath, String defaultWebXmlPath) throws Exception
{
ClassLoader contextCl = Thread.currentThread().getContextClassLoader();
@ -394,27 +437,131 @@ class WebappRegistrationHelper
try
{
// make sure we provide access to all the jetty bundles by going through this bundle.
TldLocatableURLClassloader composite = createContextClassLoader(contributor);
WebappClassLoaderForOSGi composite = createWebappClassLoader(contributor);
// configure with access to all jetty classes and also all the classes
// that the contributor gives access to.
Thread.currentThread().setContextClassLoader(composite);
context = new WebAppContext(webapp.getAbsolutePath(),contextPath);
// final WebXmlConfiguration webXml = new WebXmlConfiguration();
// webXml.configure(context);
final JettyWebXmlConfiguration jettyXml = new JettyWebXmlConfiguration() {
//workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=294799
//remove it when it is fixed.
/**
* Configure
* Apply web-jetty.xml configuration
* @see Configuration#configure(WebAppContext)
*/
public void configure (WebAppContext context) throws Exception
{
//cannot configure if the _context is already started
if (context.isStarted())
{
if (Log.isDebugEnabled()){Log.debug("Cannot configure webapp after it is started");}
return;
}
if(Log.isDebugEnabled())
Log.debug("Configuring web-jetty.xml");
Resource web_inf = context.getWebInf();
// handle any WEB-INF descriptors
if(web_inf!=null&&web_inf.isDirectory())
{
// do jetty.xml file
Resource jetty=web_inf.addPath("jetty7-web.xml");
if(!jetty.exists())
jetty=web_inf.addPath("jetty-web.xml");
if(!jetty.exists())
jetty=web_inf.addPath("web-jetty.xml");
if(jetty.exists())
{
// No server classes while configuring
String[] old_server_classes = context.getServerClasses();
try
{
context.setServerClasses(null);
if(Log.isDebugEnabled())
Log.debug("Configure: "+jetty);
XmlConfiguration jetty_config=new XmlConfiguration(jetty.getURL());
jetty_config.configure(context);
}
finally
{
if (context.getServerClasses()==null)
context.setServerClasses(old_server_classes);
}
}
}
}
};
// jettyXml.configure(context);
context = new WebAppContext(webapp.getAbsolutePath(),contextPath)
{
@Override
protected void loadConfigurations() throws Exception
{
super.loadConfigurations();
//now replace the default JettyWebXmlConfiguration by our own.
for (int i = 0; i < getConfigurations().length; i++)
{
if (getConfigurations()[i] instanceof JettyWebXmlConfiguration)
{
getConfigurations()[i] = jettyXml;
}
}
}
};
context.setExtraClasspath(extraClasspath);
WebXmlConfiguration webXml = new WebXmlConfiguration();
webXml.configure(context);
if (webXmlPath != null && webXmlPath.length() != 0)
{
File webXml = null;
if (webXmlPath.startsWith("/") || webXmlPath.startsWith("file:/"))
{
webXml = new File(webXmlPath);
}
else
{
webXml = new File(bundleInstall, webXmlPath);
}
if (webXml.exists())
{
context.setDescriptor(webXml.getAbsolutePath());
}
}
if (defaultWebXmlPath != null && defaultWebXmlPath.length() != 0)
{
File defaultWebXml = null;
if (defaultWebXmlPath.startsWith("/") || defaultWebXmlPath.startsWith("file:/"))
{
defaultWebXml = new File(webXmlPath);
}
else
{
defaultWebXml = new File(bundleInstall, defaultWebXmlPath);
}
if (defaultWebXml.exists())
{
context.setDescriptor(defaultWebXml.getAbsolutePath());
}
}
JettyWebXmlConfiguration jettyXml = new JettyWebXmlConfiguration();
jettyXml.configure(context);
configureWebAppContext(context, contributor);
configureWebAppContext(context);
// ok now register this webapp. we checked when we started jetty that there
// was at least one such handler for webapps.
_ctxtHandler.addHandler(context);
configureContextClassLoader(contributor,context,composite);
configureWebappClassLoader(contributor,context,composite);
// @see org.eclipse.jetty.webapp.JettyWebXmlConfiguration#configure(WebAppContext)
// during initialization of the webapp all the jetty packages are visible
@ -596,7 +743,7 @@ class WebappRegistrationHelper
try
{
// make sure we provide access to all the jetty bundles by going through this bundle.
TldLocatableURLClassloader composite = createContextClassLoader(contributor);
WebappClassLoaderForOSGi composite = createWebappClassLoader(contributor);
// configure with access to all jetty classes and also all the classes
// that the contributor gives access to.
Thread.currentThread().setContextClassLoader(composite);
@ -610,7 +757,7 @@ class WebappRegistrationHelper
// was at least one such handler for webapps.
_ctxtHandler.addHandler(context);
configureContextClassLoader(contributor,context,composite);
configureWebappClassLoader(contributor,context,composite);
if (context instanceof WebAppContext)
{
webAppContext = (WebAppContext)context;
@ -666,7 +813,7 @@ class WebappRegistrationHelper
*
* @see {WebAppDeployer#scan} around the comment <code>// configure it</code>
*/
protected void configureWebAppContext(WebAppContext wah)
protected void configureWebAppContext(WebAppContext wah, Bundle contributor)
{
// configure it
// wah.setContextPath(context);
@ -685,6 +832,10 @@ class WebappRegistrationHelper
// set up any contextAttributes
wah.setAttributes(new AttributesMap(_contextAttributes));
//rfc66
wah.setAttribute(OSGiWebappConstants.RFC66_OSGI_BUNDLE_CONTEXT,
contributor.getBundleContext());
}
@ -731,7 +882,7 @@ class WebappRegistrationHelper
try
{
XmlConfiguration xmlConfiguration = new XmlConfiguration(contextInputStream);
HashMap<String, Object> properties = new HashMap<String, Object>();
HashMap properties = new HashMap();
properties.put("Server",_server);
if (_configMgr != null)
{
@ -749,7 +900,8 @@ class WebappRegistrationHelper
context.setAttributes(new AttributesMap(_contextAttributes));
// rfc-66:
context.setAttribute("osgi-bundlecontext",bundle.getBundleContext());
context.setAttribute(OSGiWebappConstants.RFC66_OSGI_BUNDLE_CONTEXT,
bundle.getBundleContext());
return context;
}
@ -808,63 +960,32 @@ class WebappRegistrationHelper
* @param classInBundle
* @throws Exception
*/
protected void configureContextClassLoader(
protected void configureWebappClassLoader(
Bundle contributor, ContextHandler context,
TldLocatableURLClassloader composite) throws Exception
WebappClassLoaderForOSGi webappClassLoader) throws Exception
{
if (context instanceof WebAppContext)
{
WebAppContext webappCtxt = (WebAppContext)context;
// updateServerClasses(webappCtxt);
WebAppClassLoader wcl = new WebAppClassLoader(composite,webappCtxt) {
@Override
public void addJars(Resource lib)
{
//TODO: look in the Bundle-Classpath header
//of the contributor bundle and don't add a lib that is already
//there.
super.addJars(lib);
}
};
// addJarsWithTlds(wcl);
context.setClassLoader(wcl);
context.setClassLoader(webappClassLoader);
webappClassLoader.setWebappContext(webappCtxt);
}
else
{
context.setClassLoader(composite);
context.setClassLoader(webappClassLoader);
}
}
protected TldLocatableURLClassloader createContextClassLoader(Bundle contributor) throws Exception
/**
* No matter what the type of webapp, we create a WebappClassLoader.
*/
protected WebappClassLoaderForOSGi createWebappClassLoader(Bundle contributor) throws Exception
{
ClassLoader osgiCl = BUNDLE_CLASS_LOADER_HELPER.getBundleClassLoader(contributor);
if (osgiCl != null)
{
// this solution does not insert all the jetty related classes in the webapp's classloader:
// WebAppClassLoader cl = new WebAppClassLoader(classInBundle.getClassLoader(), context);
// context.setClassLoader(cl);
// Make all of the jetty's classes available to the webapplication classloader
// also add the contributing bundle's classloader to give access to osgi to
// the contributed webapp.
TldLocatableURLClassloader composite =
new TldLocatableURLClassloaderWithInsertedJettyClassloader(
_libEtcClassLoader, osgiCl, getJarsWithTlds());
return composite;
}
else
{
// Make all of the jetty's classes available to the webapplication classloader
TldLocatableURLClassloader composite = new TldLocatableURLClassloader(
_libEtcClassLoader,getJarsWithTlds());
return composite;
}
//we use a temporary WebAppContext object.
//if this is a real webapp we will set it on it a bit later: once we know.
WebappClassLoaderForOSGi webappClassLoader = new WebappClassLoaderForOSGi(
_commonParentClassLoaderForWebapps, new WebAppContext(), contributor);
return webappClassLoader;
}
/**

View File

@ -82,7 +82,12 @@ public class PackageAdminServiceTracker implements ServiceListener
private void invokeFragmentActivators(ServiceReference sr) {
PackageAdmin admin = (PackageAdmin) _context.getService(sr);
for (Bundle frag : admin.getFragments(_context.getBundle())) {
Bundle[] fragments = admin.getFragments(_context.getBundle());
if (fragments == null)
{
return;
}
for (Bundle frag : fragments) {
//find a convention to look for a class inside the fragment.
try
{

View File

@ -1,8 +1,8 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Jetty :: OSGi :: HttpService
Bundle-SymbolicName: org.eclipse.jetty.osgi.httpservice;singleton:=true
Bundle-Version: 7.0.1.SNAPSHOT
Bundle-Name: OSGi HttpService provided by equinox HttpServiceServlet deployed on jetty
Bundle-SymbolicName: org.eclipse.jetty.osgi.httpservice
Bundle-Version: 7.0.1.qualifier
Bundle-Vendor: Mort Bay Consulting
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: javax.servlet;version="2.5.0",

View File

@ -0,0 +1,4 @@
source.. = src/main/java/
output.. = target/classes/
bin.includes = META-INF/,\
.

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>jetty-osgi</artifactId>
<groupId>org.eclipse.jetty.osgi</groupId>
<version>7.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jetty.osgi.httpservice</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View File

@ -14,13 +14,13 @@
<osgi-version>3.5.0.v20090520</osgi-version>
<osgi-services-version>3.1.200-v20070605</osgi-services-version>
<equinox-http-servlet-version>1.0.0-v20070606</equinox-http-servlet-version>
<jsp-2.1-glassfish-version>9.1.1.B60.25.p2</jsp-2.1-glassfish-version>
<jsp-2.1-glassfish-version>2.1.v20091210</jsp-2.1-glassfish-version>
</properties>
<modules>
<module>jetty-osgi-boot</module>
<!-- once the latest version of jsp-2.1-glassfish is available in maven central
we will be able to compile and package this module too. -->
<!-- module>jetty-osgi-boot-jsp</module -->
<module>jetty-osgi-boot-jsp</module>
<!-- once logback is ready for eclipse -->
<!-- module>jetty-osgi-boot-logback</module -->
<module>jetty-osgi-boot-warurl</module>
<module>jetty-osgi-httpservice</module>
</modules>