294154 Patched jetty-osgi

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1039 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2009-11-09 01:20:48 +00:00
parent 0ae5e31585
commit 7e74c61989
39 changed files with 2513 additions and 0 deletions

View File

@ -0,0 +1,19 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Jetty :: OSGi :: Boot JSP
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)"
Import-Package: javax.el;version="2.1",
javax.servlet.jsp;version="2.1",
javax.servlet.jsp.el;version="2.1",
javax.servlet.jsp.jstl.core;version="2.1",
javax.servlet.jsp.jstl.fmt;version="2.1",
javax.servlet.jsp.jstl.sql;version="2.1",
javax.servlet.jsp.jstl.tlv;version="2.1",
javax.servlet.jsp.resources;version="2.1",
javax.servlet.jsp.tagext;version="2.1"

View File

@ -0,0 +1,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Jetty :: OSGi :: Boot :: Warurl
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
Bundle-Vendor: Mort Bay Consulting
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.eclipse.jetty.util,
org.osgi.framework,
org.osgi.service.url

View File

@ -0,0 +1,71 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty.osgi</groupId>
<artifactId>jetty-osgi-project</artifactId>
<version>7.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jetty.osgi</groupId>
<artifactId>jetty-osgi-boot-warurl</artifactId>
<name>Jetty :: OSGi :: Boot :: Warurl</name>
<description>Jetty OSGi Boot-Warurl bundle</description>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>osgi</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<tasks>
<replace file="target/classes/META-INF/MANIFEST.MF"
token="Bundle-Version: 7.0.1.qualifier"
value="Bundle-Version: ${parsedVersion.osgiVersion}"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>artifact-jar</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
<execution>
<id>test-jar</id>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifestFile>target/classes/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,69 @@
// ========================================================================
// 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.warurl;
import java.util.Dictionary;
import java.util.Hashtable;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.url.URLConstants;
import org.osgi.service.url.URLStreamHandlerService;
/**
* Register the factory to handle the war scheme specified by rfc66
* when the bundle is activated.
*/
public class WarUrlActivator implements BundleActivator
{
private ServiceRegistration _reg;
/**
* Register the url stream handler factory.
*
* @param context
*/
@SuppressWarnings("unchecked")
public void start(BundleContext context) throws Exception
{
Dictionary props = new Hashtable();
props.put(URLConstants.URL_HANDLER_PROTOCOL,new String[] {"war"});
context.registerService(URLStreamHandlerService.class.getName(),
new WarUrlStreamHandler(), props);
}
/**
* Remove the url stream handler. (probably not required,
* as osgi might shutdown every registered service
* by default: need test)
*/
public void stop(BundleContext context) throws Exception
{
try
{
if (_reg != null)
{
_reg.unregister();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,85 @@
// ========================================================================
// 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.warurl;
import java.io.File;
import java.io.IOException;
import java.net.JarURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.jar.Manifest;
import org.eclipse.jetty.osgi.boot.warurl.internal.WarBundleManifestGenerator;
import org.eclipse.jetty.osgi.boot.warurl.internal.WarURLConnection;
import org.eclipse.jetty.util.URIUtil;
import org.osgi.service.url.AbstractURLStreamHandlerService;
/**
* RFC-66: support for the "war" protocol
* We are reusing the parsing of the query string from jetty.
* If we wanted to not depend on jetty at all we could duplicate that method here
*/
public class WarUrlStreamHandler extends AbstractURLStreamHandlerService
{
/**
* @param url The url with a war scheme
*/
@Override
public URLConnection openConnection(URL url) throws IOException
{
//remove the war scheme.
URL actual = new URL(url.toString().substring("war:".length()));
//let's do some basic tests: see if this is a folder or not.
//if it is a folder. we will try to support it.
if (actual.getProtocol().equals("file"))
{
File file = new File(URIUtil.encodePath(actual.getPath()));
if (file.exists())
{
if (file.isDirectory())
{
//TODO (not mandatory for rfc66 though)
}
}
}
// if (actual.toString().startsWith("file:/") && ! actual.to)
URLConnection ori = (URLConnection) actual.openConnection();
JarURLConnection jarOri = null;
try {
if (ori instanceof JarURLConnection)
{
jarOri = (JarURLConnection)ori;
}
else
{
jarOri = (JarURLConnection) new URL("jar:"+actual.toString() + "!/").openConnection();
}
Manifest mf = WarBundleManifestGenerator.createBundleManifest(
jarOri.getManifest(), url, jarOri.getJarFile());
try { jarOri.getJarFile().close(); jarOri = null; } catch (Throwable t) {}
return new WarURLConnection(actual,mf);
}
finally
{
if (jarOri != null) try { jarOri.getJarFile().close(); } catch (Throwable t) {}
}
}
}

View File

@ -0,0 +1,279 @@
// ========================================================================
// 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.warurl.internal;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import org.eclipse.jetty.util.MultiMap;
import org.eclipse.jetty.util.UrlEncoded;
import org.osgi.framework.Constants;
public class WarBundleManifestGenerator
{
/** missing version in the url and in the manifest
* use this one. */
private static final String MISSING_VERSION = "0.0.1.unknown";
private static final String MISSING_MANIFEST_VERSION = "2";
public static Manifest createBundleManifest(Manifest originalManifest, URL url, JarFile jarFile)
{
Manifest res = new Manifest();
res.getMainAttributes().putAll(
createBundleManifest(originalManifest.getMainAttributes(),
url.toString(), jarFile));
return res;
}
private static Attributes createBundleManifest(Attributes originalManifest, String url, JarFile jarFile)
{
HashMap<String, String> res = new HashMap<String, String>();
for (Entry<Object, Object> entries : originalManifest.entrySet())
{
res.put(entries.getKey().toString(),String.valueOf(entries.getValue()));
}
MultiMap<String> params = parseQueryString(url);
//follow RFC66 documentation:
//#1 Bundle-Version
String version = params.getString(Constants.BUNDLE_VERSION);
if (version != null)
{
res.put(Constants.BUNDLE_VERSION, version);
}
else
{
String versionInManifest = (String) res.get(Constants.BUNDLE_VERSION);
if (versionInManifest == null)
{
res.put(Constants.BUNDLE_VERSION, MISSING_VERSION);
}
}
//#2 Bundle_ManifestVersion
String manversion = params.getString(Constants.BUNDLE_MANIFESTVERSION);
if (manversion != null)
{
res.put(Constants.BUNDLE_MANIFESTVERSION, manversion);
}
else
{
int manv = 2;
try {
String versionInManifest = (String) res.get(Constants.BUNDLE_MANIFESTVERSION);
if (versionInManifest != null)
{
manv = Integer.parseInt(versionInManifest.trim());
}
}
catch (NumberFormatException nfe)
{
}
res.put(Constants.BUNDLE_MANIFESTVERSION, String.valueOf( manv < 2 ? 2 : manv ));
}
//#3 Bundle-SymbolicName
String symbname = params.getString(Constants.BUNDLE_SYMBOLICNAME);
if (symbname != null)
{
res.put(Constants.BUNDLE_SYMBOLICNAME, symbname);
}
else
{
symbname = (String) res.get(Constants.BUNDLE_SYMBOLICNAME);
if (symbname == null)
{
//derive the symbolic name from the url.
int lastSlash = url.lastIndexOf('/');
int beforeQueryString = url.indexOf(lastSlash, '?');
if (beforeQueryString == -1)
{
beforeQueryString = url.indexOf(lastSlash, '#');
if (beforeQueryString == -1)
{
beforeQueryString = url.length();
}
}
symbname = url.substring(lastSlash+1, beforeQueryString);
//todo: something better probably.
res.put(Constants.BUNDLE_SYMBOLICNAME, symbname);
}
}
//#4 Bundle-Classpath
String extraBundleClasspath = params.getString(Constants.BUNDLE_CLASSPATH);
String alreadyBundleClasspath = res.get(Constants.BUNDLE_CLASSPATH);
if (alreadyBundleClasspath == null)
{
StringBuilder bundleClasspath = new StringBuilder();
if (jarFile == null || jarFile.getJarEntry("WEB-INF/classes/") != null)
{
bundleClasspath.append("WEB-INF/classes");
}
if (jarFile != null)
{
List<String> libs = getJarsInWebInfLib(jarFile);
if (extraBundleClasspath != null)
{
libs.add(extraBundleClasspath);
}
for (String lib : libs)
{
if (bundleClasspath.length() != 0)
{
bundleClasspath.append(",");
}
bundleClasspath.append(lib);
}
}
alreadyBundleClasspath = bundleClasspath.toString();
}
//if there is already a manifest and it specifies the Bundle-Classpath.
//for now let's trust that one.
//please note that the draft of the spec implies that we should be parsing the existing
//header and merge it with the missing stuff so this does not follow the spec yet.
res.put(Constants.BUNDLE_CLASSPATH,
alreadyBundleClasspath + (extraBundleClasspath == null ? "" : "," + extraBundleClasspath ));
//#5 Import-Package
String extraImportPackage = params.getString(Constants.IMPORT_PACKAGE);
String alreadyImportPackage = res.get(Constants.IMPORT_PACKAGE);
if (alreadyImportPackage == null)
{//The spec does not specify that the jsp imports are optional
//kind of nice to have them optional so we can run simple wars in
//simple environments.
alreadyImportPackage = "javax.servlet; version=\"2.5\"," +
"javax.servlet.http;version=\"2.5\"," +
"javax.el;version=\"1.0\"" +
"javax.jsp;version=\"2.1\";resolution:=optional," +
"javax.jsp.tagext;version=\"2.1\";resolution:=optional";
}
if (extraImportPackage != null)
{ //if there is already a manifest and it specifies the Bundle-Classpath.
//for now let's trust that one.
//please note that the draft of the spec implies that we should be parsing the existing
//header and merge it with the missing stuff so this does not follow the spec yet.
res.put(Constants.IMPORT_PACKAGE,
(alreadyImportPackage == null ? "" : alreadyImportPackage + ",") +
extraImportPackage);
}
//#6 Export-Package
String extraExportPackage = params.getString(Constants.EXPORT_PACKAGE);
String alreadyExportPackage = res.get(Constants.EXPORT_PACKAGE);
if (extraExportPackage != null)
{ //if there is already a manifest and it specifies the Bundle-Classpath.
//for now let's trust that one.
//please note that the draft of the spec implies that we should be parsing the existing
//header and merge it with the missing stuff so this does not follow the spec yet.
res.put(Constants.EXPORT_PACKAGE,
(alreadyExportPackage == null ? "" : alreadyExportPackage + ",") +
extraImportPackage);
}
//#7 Web-ContextPath
String webContextPath = params.getString("Web-ContextPath");
if (webContextPath != null)
{
res.put("Web-ContextPath", webContextPath);
}
else
{
webContextPath = res.get("Web-ContextPath");
if (webContextPath == null)
{
//we choose to use the symbolic name as the default context path.
if (symbname.endsWith(".war"))
{
webContextPath = "/" + symbname.substring(0, symbname.length()-".war".length());
}
else
{
webContextPath = "/" + symbname;
}
res.put("Web-ContextPath", webContextPath);
}
}
//#8 Web-JSPExtractLocation
String jspExtractLocation = params.getString("Web-JSPExtractLocation");
if (jspExtractLocation != null)
{
res.put("Web-JSPExtractLocation", jspExtractLocation);
}
else
{
//nothing to do.
}
Attributes newAttrs = new Attributes();
for (Entry<String,String> e : res.entrySet())
{
newAttrs.putValue(e.getKey(),e.getValue());
}
return newAttrs;
}
/**
* @return The key values pairs that are in the query string of this url.
*/
private static MultiMap<String> parseQueryString(String url)
{
MultiMap<String> res = new MultiMap<String>();
int questionMarkIndex = url.indexOf('?');
if (questionMarkIndex == -1)
{
return res;
}
int poundIndex = url.indexOf('#');
if (poundIndex == -1)
{
poundIndex = url.length();
}
UrlEncoded.decodeUtf8To(url.getBytes(), questionMarkIndex+1,
poundIndex - questionMarkIndex - 1, res);
return res;
}
private static List<String> getJarsInWebInfLib(JarFile jarFile)
{
List<String> res = new ArrayList<String>();
Enumeration<JarEntry> en = jarFile.entries();
while (en.hasMoreElements())
{
JarEntry e = en.nextElement();
if (e.getName().startsWith("WEB-INF/lib/") && e.getName().endsWith(".jar"))
{
res.add(e.getName());
}
}
return res;
}
}

View File

@ -0,0 +1,315 @@
// ========================================================================
// 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.warurl.internal;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.net.URL;
import java.net.URLConnection;
import java.security.Permission;
import java.util.List;
import java.util.Map;
import java.util.jar.JarFile;
import java.util.jar.JarInputStream;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import java.util.zip.ZipEntry;
import org.eclipse.jetty.util.IO;
/**
* Facade for a URLConnection that will read a jar and substitute its
* manifest by the manifest provided here.
* <p>
* Use Piped streams to avoid having to create temporary files.
* </p>
*/
public class WarURLConnection extends URLConnection
{
/**
* Use PipedOuputStream and PipedInputStream to do the transformation without making
* a new temporary file ust to replace the manifest.
* @param newmanifest The new manifest
* @param rawIn The file input stream or equivalent. not the jar input stream.
*/
public static InputStream substitueManifest(final Manifest newmanifest,
final InputStream rawIn) throws IOException
{
final PipedOutputStream pOut = new PipedOutputStream();
PipedInputStream pIn = new PipedInputStream(pOut);
Runnable run = new Runnable()
{
public void run()
{
JarInputStream jin = null;
JarOutputStream dest = null;
try
{
jin = new JarInputStream(rawIn, false);
dest = new JarOutputStream(pOut, newmanifest);
ZipEntry next = jin.getNextEntry();
while (next != null)
{
if (next.getName().equalsIgnoreCase(JarFile.MANIFEST_NAME))
{
continue;
}
dest.putNextEntry(next);
if (next.getSize() > 0)
{
IO.copy(jin,dest,next.getSize());
}
next = jin.getNextJarEntry();
}
}
catch (IOException ioe) {
ioe.printStackTrace();
}
finally
{
if (dest != null) IO.close(dest);
if (jin != null) IO.close(jin);
IO.close(pOut);
}
}
};
Thread th = new Thread(run);
th.start();
return pIn;
}
private Manifest _mf;
private URLConnection _conn;
/**
* @param url The file url (for example)
* @param The manifest to use as a replacement to the jar file inside
* the file url.
*/
public WarURLConnection(URL url, Manifest mf) throws IOException
{
super(url);
_conn = url.openConnection();
_mf = mf;
}
@Override
public void connect() throws IOException
{
_conn.connect();
}
public InputStream getInputStream() throws IOException
{
return substitueManifest(_mf, _conn.getInputStream());
}
public void addRequestProperty(String key, String value)
{
_conn.addRequestProperty(key,value);
}
public boolean equals(Object obj)
{
return _conn.equals(obj);
}
public boolean getAllowUserInteraction()
{
return _conn.getAllowUserInteraction();
}
public int getConnectTimeout()
{
return _conn.getConnectTimeout();
}
public Object getContent() throws IOException
{
return _conn.getContent();
}
public Object getContent(Class[] classes) throws IOException
{
return _conn.getContent(classes);
}
public String getContentEncoding()
{
return _conn.getContentEncoding();
}
public int getContentLength()
{
return _conn.getContentLength();
}
public String getContentType()
{
return _conn.getContentType();
}
public long getDate()
{
return _conn.getDate();
}
public boolean getDefaultUseCaches()
{
return _conn.getDefaultUseCaches();
}
public boolean getDoInput()
{
return _conn.getDoInput();
}
public boolean getDoOutput()
{
return _conn.getDoOutput();
}
public long getExpiration()
{
return _conn.getExpiration();
}
public String getHeaderField(int n)
{
return _conn.getHeaderField(n);
}
public String getHeaderField(String name)
{
return _conn.getHeaderField(name);
}
public long getHeaderFieldDate(String name, long Default)
{
return _conn.getHeaderFieldDate(name,Default);
}
public int getHeaderFieldInt(String name, int Default)
{
return _conn.getHeaderFieldInt(name,Default);
}
public String getHeaderFieldKey(int n)
{
return _conn.getHeaderFieldKey(n);
}
public Map<String, List<String>> getHeaderFields()
{
return _conn.getHeaderFields();
}
public long getIfModifiedSince()
{
return _conn.getIfModifiedSince();
}
public long getLastModified()
{
return _conn.getLastModified();
}
public OutputStream getOutputStream() throws IOException
{
return _conn.getOutputStream();
}
public Permission getPermission() throws IOException
{
return _conn.getPermission();
}
public int getReadTimeout()
{
return _conn.getReadTimeout();
}
public Map<String, List<String>> getRequestProperties()
{
return _conn.getRequestProperties();
}
public String getRequestProperty(String key)
{
return _conn.getRequestProperty(key);
}
public URL getURL()
{
return _conn.getURL();
}
public boolean getUseCaches()
{
return _conn.getUseCaches();
}
public void setAllowUserInteraction(boolean allowuserinteraction)
{
_conn.setAllowUserInteraction(allowuserinteraction);
}
public void setConnectTimeout(int timeout)
{
_conn.setConnectTimeout(timeout);
}
public void setDefaultUseCaches(boolean defaultusecaches)
{
_conn.setDefaultUseCaches(defaultusecaches);
}
public void setDoInput(boolean doinput)
{
_conn.setDoInput(doinput);
}
public void setDoOutput(boolean dooutput)
{
_conn.setDoOutput(dooutput);
}
public void setIfModifiedSince(long ifmodifiedsince)
{
_conn.setIfModifiedSince(ifmodifiedsince);
}
public void setReadTimeout(int timeout)
{
_conn.setReadTimeout(timeout);
}
public void setRequestProperty(String key, String value)
{
_conn.setRequestProperty(key,value);
}
public void setUseCaches(boolean usecaches)
{
_conn.setUseCaches(usecaches);
}
}

View File

@ -0,0 +1,48 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Jetty :: OSGi :: Boot
Bundle-SymbolicName: org.eclipse.jetty.osgi.boot;singleton:=true
Bundle-Version: 7.0.1.qualifier
Bundle-Activator: org.eclipse.jetty.osgi.boot.JettyBootstrapActivator
Import-Package: javax.mail;resolution:=optional,
javax.mail.event;resolution:=optional,
javax.mail.internet;resolution:=optional,
javax.mail.search;resolution:=optional,
javax.mail.util;resolution:=optional,
javax.naming;resolution:=optional,
javax.naming.directory;resolution:=optional,
javax.security.auth;resolution:=optional,
javax.security.auth.callback;resolution:=optional,
javax.security.auth.login;resolution:=optional,
javax.security.auth.spi;resolution:=optional,
javax.servlet,
javax.servlet.http,
javax.transaction;version="1.1.0";resolution:=optional,
javax.transaction.xa;version="1.1.0";resolution:=optional,
org.osgi.framework,
org.osgi.service.cm;version="1.2.0",
org.osgi.service.packageadmin,
org.osgi.service.startlevel;version="1.0",
org.xml.sax
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,
org.eclipse.jetty.client;bundle-version="[7.0,8)";resolution:=optional,
org.eclipse.jetty.continuation;bundle-version="[7.0,8)";resolution:=optional,
org.eclipse.jetty.deploy;bundle-version="[7.0,8)",
org.eclipse.jetty.http;bundle-version="[7.0,8)",
org.eclipse.jetty.io;bundle-version="[7.0,8)",
org.eclipse.jetty.jmx;bundle-version="[7.0,8)";resolution:=optional,
org.eclipse.jetty.jndi;bundle-version="[7.0,8)";resolution:=optional,
org.eclipse.jetty.plus;bundle-version="[7.0,8.0)";resolution:=optional,
org.eclipse.jetty.rewrite;bundle-version="[7.0,8)";resolution:=optional,
org.eclipse.jetty.security;bundle-version="[7.0,8)";resolution:=optional,
org.eclipse.jetty.server;bundle-version="[7.0,8)",
org.eclipse.jetty.servlet;bundle-version="[7.0,8)",
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.xml;bundle-version="[7.0,8)"
Export-Package: org.eclipse.jetty.osgi.boot,
org.eclipse.jetty.osgi.boot.utils
Bundle-ActivationPolicy: lazy

View File

@ -0,0 +1,2 @@
Default locations for standard context definitions.
Those applications are unlikely to have access to the OSGi framework currently.

View File

@ -0,0 +1,2 @@
This folder contains the default jetty configurations file for the server.
In production, it is likely to be a different folder outside of the jetty's bootstrap plugin.

View File

@ -0,0 +1,72 @@
#
# This is a sample properties file for the org.mortbay.jetty.security.JDBCUserRealm
# implemtation of the UserRealm interface. This allows Jetty users authentication
# to work from a database.
#
# +-------+ +------------+ +-------+
# | users | | user_roles | | roles |
# +-------+ +------------+ +-------+
# | id | /| user_id |\ | id |
# | user -------| role_id |------- role |
# | pwd | \| |/ | |
# +-------+ +------------+ +-------+
#
#
# 'cachetime' is a time in seconds to cache positive database
# lookups in internal hash table. Set to 0 to disable caching.
#
#
# For MySQL:
# create a MYSQL user called "jetty" with password "jetty"
#
# Create the tables:
# create table users
# (
# id integer primary key,
# username varchar(100) not null unique key,
# pwd varchar(20) not null
# );
#
# create table roles
# (
# id integer primary key,
# role varchar(100) not null unique key
# );
#
# create table user_roles
# (
# user_id integer not null,
# role_id integer not null,
# unique key (user_id, role_id),
# index(user_id)
# );
#
# I'm not sure unique key with a first component of user_id will be
# user by MySQL in query, so additional index wouldn't hurt.
#
# To test JDBC implementation:
#
# mysql> insert into users values (1, 'admin', 'password');
# mysql> insert into roles values (1, 'server-administrator');
# mysql> insert into roles values (2, 'content-administrator');
# mysql> insert into user_roles values (1, 1);
# mysql> insert into user_roles values (1, 2);
#
# Replace HashUserRealm in etc/admin.xml with JDBCUserRealm and
# set path to properties file.
#
jdbcdriver = org.gjt.mm.mysql.Driver
url = jdbc:mysql://localhost/jetty
username = jetty
password = jetty
usertable = users
usertablekey = id
usertableuserfield = username
usertablepasswordfield = pwd
roletable = roles
roletablekey = id
roletablerolefield = role
userroletable = user_roles
userroletableuserkey = user_id
userroletablerolekey = role_id
cachetime = 300

View File

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

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 configuration for Block socket connector -->
<!-- -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.jetty.Server">
<!-- Use this connector if NIO is not available. -->
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.bio.SocketConnector">
<Set name="port"><SystemProperty name="jetty.bio.port" default="8081"/></Set>
<Set name="maxIdleTime">50000</Set>
<Set name="lowResourceMaxIdleTime">1500</Set>
</New>
</Arg>
</Call>
</Configure>

View File

@ -0,0 +1,35 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure id="Server" class="org.mortbay.jetty.Server">
<!-- ======================================================== -->
<!-- java.security.auth.login.config System property -->
<!-- This is usually a runtime parameter to the jvm, but -->
<!-- it is placed here for convenience. -->
<!-- ======================================================== -->
<Call class="java.lang.System" name="setProperty">
<Arg>java.security.auth.login.config</Arg>
<Arg><SystemProperty name="jetty.home" default="." />/etc/login.conf</Arg>
</Call>
<!-- ======================================================== -->
<!-- An example JAAS realm setup -->
<!-- For more information see the jetty wiki at -->
<!-- http://http://docs.codehaus.org/display/JETTY/JAAS -->
<!-- ======================================================== -->
<Set name="UserRealms">
<Array type="org.mortbay.jetty.security.UserRealm">
<Item>
<New class="org.mortbay.jetty.plus.jaas.JAASUserRealm">
<Set name="Name">Test JAAS Realm</Set>
<Set name="LoginModuleName">xyz</Set>
</New>
</Item>
</Array>
</Set>
</Configure>

View File

@ -0,0 +1,54 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/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 -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.jetty.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 -->
<!-- =========================================================== -->
<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>
</Call>
</Get>
<!-- optionally add a remote JMX connector
<Call id="jmxConnector" class="javax.management.remote.JMXConnectorServerFactory" name="newJMXConnectorServer">
<Arg>
<New class="javax.management.remote.JMXServiceURL">
<Arg>service:jmx:rmi:///jndi/rmi:///jettymbeanserver</Arg>
</New>
</Arg>
<Arg/>
<Arg><Ref id="MBeanServer"/></Arg>
<Call name="start"/>
</Call>
-->
</Configure>

View File

@ -0,0 +1,32 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!-- =============================================================== -->
<!-- Configure stderr and stdout to a Jetty rollover log file -->
<!-- this configuration file should be used in combination with -->
<!-- other configuration files. e.g. -->
<!-- java -jar start.jar etc/jetty-logging.xml etc/jetty.xml -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.jetty.Server">
<New id="ServerLog" class="java.io.PrintStream">
<Arg>
<New class="org.mortbay.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>
<Arg><Call class="java.util.TimeZone" name="getTimeZone"><Arg>GMT</Arg></Call></Arg>
<Get id="ServerLogName" name="datedFilename"/>
</New>
</Arg>
</New>
<Call class="org.mortbay.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>
</Configure>

View File

@ -0,0 +1,74 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!-- =============================================================== -->
<!-- Configure Jetty Plus features -->
<!-- -->
<!-- This file sets up a WebAppDeployer to automatically deploy all -->
<!-- webapps in $jetty.home/webapps-plus at startup time, and to -->
<!-- enable all of them with Plus features (jndi etc). -->
<!-- -->
<!-- You can instead configure individual webapps with Jetty Plus -->
<!-- features by using the ContextDeployer (configured in -->
<!-- $jetty.home/etc/jetty.xml), and ensuring that you set the -->
<!-- same set of classes listed below in the "plusConfig" as the -->
<!-- webapp's configurationClasses. -->
<!-- -->
<!-- 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">
<!-- =========================================================== -->
<!-- Example JAAS realm setup. -->
<!-- The LoginModuleName must be exactly the same as in the -->
<!-- login.conf file, and the realm Name must be the same as in -->
<!-- the web.xml file. -->
<!-- =========================================================== -->
<!--
<Call name="addUserRealm">
<Arg>
<New class="org.mortbay.jetty.plus.jaas.JAASUserRealm">
<Set name="name">xyzrealm</Set>
<Set name="LoginModuleName">xyz</Set>
</New>
</Arg>
</Call>
-->
<!-- =========================================================== -->
<!-- Configurations for WebAppContexts -->
<!-- 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>
</Array>
<!-- =========================================================== -->
<!-- Deploy all webapps in webapps-plus -->
<!-- =========================================================== -->
<!-- Uncomment the following to set up a WebAppDeployer that will -->
<!-- deploy webapps from a directory called webapps-plus. Note -->
<!-- that you will need to create this directory first! -->
<!--
<Call name="addLifeCycle">
<Arg>
<New class="org.mortbay.jetty.deployer.WebAppDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps-plus</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="configurationClasses"><Ref id="plusConfig"/></Set>
</New>
</Arg>
</Call>
-->
</Configure>

View File

@ -0,0 +1,149 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!-- =============================================================== -->
<!-- Mixin the RewriteHandler -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.jetty.Server">
<!-- =========================================================== -->
<!-- Configure Rewrite Handler -->
<!-- =========================================================== -->
<Get id="oldhandler" name="handler"/>
<Set name="handler">
<New id="Rewrite" class="org.mortbay.jetty.handler.rewrite.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">
<!-- 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>
<!-- 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>
<!-- 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>
</Set>
</Configure>

View File

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!-- =============================================================== -->
<!-- Configure the Jetty SetUIDServer -->
<!-- this configuration file should be used in combination with -->
<!-- other configuration files. e.g. -->
<!-- java -jar start.jar etc/jetty-setuid.xml etc/jetty.xml -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.setuid.SetUIDServer">
<Set name="startServerAsPrivileged">false</Set>
<Set name="umask">2</Set>
<Set name="uid">jetty</Set>
<Set name="gid">jetty</Set>
</Configure>

View File

@ -0,0 +1,35 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/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.mortbay.jetty.Server">
<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>
<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>
</Configure>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/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.mortbay.jetty.Server">
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.security.SslSelectChannelConnector">
<Set name="Port">8444</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="AcceptQueueSize">100</Set>
<Set name="Keystore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
<Set name="Password">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
<Set name="KeyPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
</New>
</Arg>
</Call>
</Configure>

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!-- =============================================================== -->
<!-- Mixin the Statistics Handler -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.jetty.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" -->
<Set name="handler"><Ref id="oldhandler"/></Set>
</New>
</Set>
</Configure>

View File

@ -0,0 +1,28 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/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="Server" class="org.mortbay.jetty.Server">
<Call name="addLifeCycle">
<Arg>
<New class="org.mortbay.jetty.win32service.Win32Service">
<Set name="server"><Ref id="Server"/></Set>
</New>
</Arg>
</Call>
<Set name="stopAtShutdown">true</Set>
<!-- ensure/prevent Server: header being sent to browsers -->
<Set name="sendServerVersion">true</Set>
</Configure>

View File

@ -0,0 +1,56 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!-- =============================================================== -->
<!-- Configuration for starting up Jetty using inetd/xinetd -->
<!-- This feature requires at least Java 5 -->
<!-- -->
<!-- Making it a mixin for convenience, but note that if used -->
<!-- with jetty.xml, Jetty will use multiple connectors -->
<!-- =============================================================== -->
<!-- Sample xinetd configuration (restart xinetd after adding the configuration file)
service jetty
{
disable = no
id = jetty
type = UNLISTED
wait = yes
socket_type = stream
# change this
user = username
group = groupname
port = 2001
# sample script for running jetty as a service
# replace $JETTY_HOME with /path/to/jetty_home/
server = $JETTY_HOME/bin/jetty-xinetd.sh
}
-->
<Configure id="Server" class="org.mortbay.jetty.Server">
<Call name="addConnector">
<Arg>
<!-- Inherited channel (from inetd/xinetd) -->
<New class="org.mortbay.jetty.nio.InheritedChannelConnector">
<!-- Optional. Fallback in case System.inheritedChannel() does not give a ServerSocketChannel
<Set name="port"><SystemProperty name="jetty.service.port" default="8082"/></Set>
-->
<!-- sane defaults -->
<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>
</Configure>

View File

@ -0,0 +1,209 @@
<?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="Server" 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">200</Set>
</New>
<!-- Optional Java 5 bounded threadpool with job queue
<New class="org.eclipse.thread.concurrent.ThreadPool">
<Set name="corePoolSize">50</Set>
<Set name="maximumPoolSize">50</Set>
</New>
-->
</Set>
<!-- Added from jetty-plus.xml but is this really necessary? -->
<!-- =========================================================== -->
<!-- Configurations for WebAppContexts -->
<!-- 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>
</Array>
<!-- =========================================================== -->
<!-- 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="8080"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- To add a HTTPS SSL connector -->
<!-- mixin jetty-ssl.xml: -->
<!-- java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- To add a HTTP blocking connector -->
<!-- mixin jetty-bio.xml: -->
<!-- java -jar start.jar etc/jetty.xml etc/jetty-bio.xml -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- To allow Jetty to be started from xinetd -->
<!-- mixin jetty-xinetd.xml: -->
<!-- java -jar start.jar etc/jetty.xml etc/jetty-xinetd.xml -->
<!-- -->
<!-- See jetty-xinetd.xml for further instructions. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
</Item>
<Item>
<New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</Item>
<Item>
<New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
<!-- =========================================================== -->
<!-- Configure the context deployer -->
<!-- A context deployer will deploy contexts described in -->
<!-- configuration files discovered in a directory. -->
<!-- The configuration directory can be scanned for hot -->
<!-- deployments at the configured scanInterval. -->
<!-- -->
<!-- This deployer is configured to deploy contexts configured -->
<!-- in the $JETTY_HOME/contexts directory -->
<!-- -->
<!-- =========================================================== -->
<Call name="addBean">
<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="scanInterval">5</Set>
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/jsp-api-[^/]*\.jar$|.*/jsp-[^/]*\.jar$</Arg>
</Call>
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Configure the webapp deployer. -->
<!-- A webapp deployer will deploy standard webapps discovered -->
<!-- in a directory at startup, without the need for additional -->
<!-- configuration files. It does not support hot deploy or -->
<!-- non standard contexts (see ContextDeployer above). -->
<!-- -->
<!-- This deployer is configured to deploy webapps from the -->
<!-- $JETTY_HOME/webapps directory -->
<!-- -->
<!-- Normally only one type of deployer need be used. -->
<!-- -->
<!-- =========================================================== -->
<Call name="addBean">
<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="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>
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/jsp-api-[^/]*\.jar$|.*/jsp-[^/]*\.jar$</Arg>
</Call>
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Configure Authentication Login Service -->
<!-- Realms may be configured for the entire server here, or -->
<!-- they can be configured for a specific web app in a context -->
<!-- configuration (see $(jetty.home)/contexts/test.xml for an -->
<!-- example). -->
<!-- =========================================================== -->
<Call name="addBean">
<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="refreshInterval">0</Set>
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Configure Request Log -->
<!-- Request logs may be configured for the entire server here, -->
<!-- or they can be configured for a specific web app in a -->
<!-- contexts configuration (see $(jetty.home)/contexts/test.xml -->
<!-- for an example). -->
<!-- =========================================================== -->
<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="filenameDateFormat">yyyy_MM_dd</Set>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
<Set name="extended">false</Set>
<Set name="logCookies">false</Set>
<Set name="LogTimeZone">GMT</Set>
</New>
</Set>
</Ref>
<!-- =========================================================== -->
<!-- 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

@ -0,0 +1,5 @@
xyz {
org.mortbay.jetty.plus.jaas.spi.PropertyFileLoginModule required
debug="true"
file="${jetty.home}/etc/login.properties";
};

View File

@ -0,0 +1 @@
me=me,me,roleA

View File

@ -0,0 +1,21 @@
#
# This file defines users passwords and roles for a HashUserRealm
#
# The format is
# <username>: <password>[,<rolename> ...]
#
# Passwords may be clear text, obfuscated or checksummed. The class
# org.mortbay.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
# This entry is for digest auth. The credential is a MD5 hash of username:realmname:password
digest: MD5:6e120743ad67abfbc385bc2bb754e297

View File

@ -0,0 +1,404 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- ===================================================================== -->
<!-- This file contains the default descriptor for web applications. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- The intent of this descriptor is to include jetty specific or common -->
<!-- configuration for all webapps. If a context has a webdefault.xml -->
<!-- descriptor, it is applied before the contexts own web.xml file -->
<!-- -->
<!-- A context may be assigned a default descriptor by: -->
<!-- + Calling WebApplicationContext.setDefaultsDescriptor -->
<!-- + Passed an arg to addWebApplications -->
<!-- -->
<!-- This file is used both as the resource within the jetty.jar (which is -->
<!-- used as the default if no explicit defaults descriptor is set) and it -->
<!-- is copied to the etc directory of the Jetty distro and explicitly -->
<!-- by the jetty.xml file. -->
<!-- -->
<!-- ===================================================================== -->
<web-app
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
metadata-complete="true"
version="2.5">
<description>
Default web.xml file.
This file is applied to a Web application before it's own WEB_INF/web.xml file
</description>
<!-- ==================================================================== -->
<!-- Context params to control Session Cookies -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- UNCOMMENT TO ACTIVATE
<context-param>
<param-name>org.eclipse.jetty.servlet.SessionDomain</param-name>
<param-value>127.0.0.1</param-value>
</context-param>
<context-param>
<param-name>org.eclipse.jetty.servlet.SessionPath</param-name>
<param-value>/</param-value>
</context-param>
<context-param>
<param-name>org.eclipse.jetty.servlet.MaxAge</param-name>
<param-value>-1</param-value>
</context-param>
-->
<!-- ==================================================================== -->
<!-- The default servlet. -->
<!-- This servlet, normally mapped to /, provides the handling for static -->
<!-- content, OPTIONS and TRACE methods for the context. -->
<!-- The following initParameters are supported: -->
<!-- -->
<!-- acceptRanges If true, range requests and responses are -->
<!-- supported -->
<!-- -->
<!-- dirAllowed If true, directory listings are returned if no -->
<!-- welcome file is found. Else 403 Forbidden. -->
<!-- -->
<!-- welcomeServlets If true, attempt to dispatch to welcome files -->
<!-- that are servlets, if no matching static -->
<!-- resources can be found. -->
<!-- -->
<!-- redirectWelcome If true, redirect welcome file requests -->
<!-- else use request dispatcher forwards -->
<!-- -->
<!-- gzip If set to true, then static content will be served-->
<!-- as gzip content encoded if a matching resource is -->
<!-- found ending with ".gz" -->
<!-- -->
<!-- resoureBase Can be set to replace the context resource base -->
<!-- -->
<!-- relativeResourceBase -->
<!-- Set with a pathname relative to the base of the -->
<!-- servlet context root. Useful for only serving -->
<!-- static content from only specific subdirectories. -->
<!-- -->
<!-- useFileMappedBuffer -->
<!-- If set to true (the default), a memory mapped -->
<!-- file buffer will be used to serve static content -->
<!-- when using an NIO connector. Setting this value -->
<!-- to false means that a direct buffer will be used -->
<!-- instead. If you are having trouble with Windows -->
<!-- file locking, set this to false. -->
<!-- -->
<!-- cacheControl If set, all static content will have this value -->
<!-- set as the cache-control header. -->
<!-- -->
<!-- maxCacheSize Maximum size of the static resource cache -->
<!-- -->
<!-- maxCachedFileSize Maximum size of any single file in the cache -->
<!-- -->
<!-- maxCachedFiles Maximum number of files in the cache -->
<!-- -->
<!-- cacheType "nio", "bio" or "both" to determine the type(s) -->
<!-- of resource cache. A bio cached buffer may be used-->
<!-- by nio but is not as efficient as a nio buffer. -->
<!-- An nio cached buffer may not be used by bio. -->
<!-- -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
<init-param>
<param-name>acceptRanges</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>dirAllowed</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>welcomeServlets</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>redirectWelcome</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>maxCacheSize</param-name>
<param-value>256000000</param-value>
</init-param>
<init-param>
<param-name>maxCachedFileSize</param-name>
<param-value>10000000</param-value>
</init-param>
<init-param>
<param-name>maxCachedFiles</param-name>
<param-value>1000</param-value>
</init-param>
<init-param>
<param-name>cacheType</param-name>
<param-value>both</param-value>
</init-param>
<init-param>
<param-name>gzip</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>useFileMappedBuffer</param-name>
<param-value>true</param-value>
</init-param>
<!--
<init-param>
<param-name>cacheControl</param-name>
<param-value>max-age=3600,public</param-value>
</init-param>
-->
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
<!-- ==================================================================== -->
<!-- JSP Servlet -->
<!-- This is the jasper JSP servlet from the jakarta project -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- The JSP page compiler and execution servlet, which is the mechanism -->
<!-- used by Glassfish to support JSP pages. Traditionally, this servlet -->
<!-- is mapped to URL patterh "*.jsp". This servlet supports the -->
<!-- following initialization parameters (default values are in square -->
<!-- brackets): -->
<!-- -->
<!-- checkInterval If development is false and reloading is true, -->
<!-- background compiles are enabled. checkInterval -->
<!-- is the time in seconds between checks to see -->
<!-- if a JSP page needs to be recompiled. [300] -->
<!-- -->
<!-- compiler Which compiler Ant should use to compile JSP -->
<!-- pages. See the Ant documenation for more -->
<!-- information. [javac] -->
<!-- -->
<!-- classdebuginfo Should the class file be compiled with -->
<!-- debugging information? [true] -->
<!-- -->
<!-- classpath What class path should I use while compiling -->
<!-- generated servlets? [Created dynamically -->
<!-- based on the current web application] -->
<!-- Set to ? to make the container explicitly set -->
<!-- this parameter. -->
<!-- -->
<!-- development Is Jasper used in development mode (will check -->
<!-- for JSP modification on every access)? [true] -->
<!-- -->
<!-- enablePooling Determines whether tag handler pooling is -->
<!-- enabled [true] -->
<!-- -->
<!-- fork Tell Ant to fork compiles of JSP pages so that -->
<!-- a separate JVM is used for JSP page compiles -->
<!-- from the one Tomcat is running in. [true] -->
<!-- -->
<!-- ieClassId The class-id value to be sent to Internet -->
<!-- Explorer when using <jsp:plugin> tags. -->
<!-- [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93] -->
<!-- -->
<!-- javaEncoding Java file encoding to use for generating java -->
<!-- source files. [UTF-8] -->
<!-- -->
<!-- keepgenerated Should we keep the generated Java source code -->
<!-- for each page instead of deleting it? [true] -->
<!-- -->
<!-- logVerbosityLevel The level of detailed messages to be produced -->
<!-- by this servlet. Increasing levels cause the -->
<!-- generation of more messages. Valid values are -->
<!-- FATAL, ERROR, WARNING, INFORMATION, and DEBUG. -->
<!-- [WARNING] -->
<!-- -->
<!-- mappedfile Should we generate static content with one -->
<!-- print statement per input line, to ease -->
<!-- debugging? [false] -->
<!-- -->
<!-- -->
<!-- reloading Should Jasper check for modified JSPs? [true] -->
<!-- -->
<!-- suppressSmap Should the generation of SMAP info for JSR45 -->
<!-- debugging be suppressed? [false] -->
<!-- -->
<!-- dumpSmap Should the SMAP info for JSR45 debugging be -->
<!-- dumped to a file? [false] -->
<!-- False if suppressSmap is true -->
<!-- -->
<!-- scratchdir What scratch directory should we use when -->
<!-- compiling JSP pages? [default work directory -->
<!-- for the current web application] -->
<!-- -->
<!-- tagpoolMaxSize The maximum tag handler pool size [5] -->
<!-- -->
<!-- xpoweredBy Determines whether X-Powered-By response -->
<!-- header is added by generated servlet [false] -->
<!-- -->
<!-- If you wish to use Jikes to compile JSP pages: -->
<!-- Set the init parameter "compiler" to "jikes". Define -->
<!-- the property "-Dbuild.compiler.emacs=true" when starting Jetty -->
<!-- to cause Jikes to emit error messages in a format compatible with -->
<!-- Jasper. -->
<!-- If you get an error reporting that jikes can't use UTF-8 encoding, -->
<!-- try setting the init parameter "javaEncoding" to "ISO-8859-1". -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<servlet id="jsp">
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>logVerbosityLevel</param-name>
<param-value>DEBUG</param-value>
</init-param>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<!--
<init-param>
<param-name>classpath</param-name>
<param-value>?</param-value>
</init-param>
-->
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.jspf</url-pattern>
<url-pattern>*.jspx</url-pattern>
<url-pattern>*.xsp</url-pattern>
<url-pattern>*.JSP</url-pattern>
<url-pattern>*.JSPF</url-pattern>
<url-pattern>*.JSPX</url-pattern>
<url-pattern>*.XSP</url-pattern>
</servlet-mapping>
<!-- ==================================================================== -->
<!-- Dynamic Servlet Invoker. -->
<!-- This servlet invokes anonymous servlets that have not been defined -->
<!-- in the web.xml or by other means. The first element of the pathInfo -->
<!-- of a request passed to the envoker is treated as a servlet name for -->
<!-- an existing servlet, or as a class name of a new servlet. -->
<!-- This servlet is normally mapped to /servlet/* -->
<!-- This servlet support the following initParams: -->
<!-- -->
<!-- nonContextServlets If false, the invoker can only load -->
<!-- servlets from the contexts classloader. -->
<!-- This is false by default and setting this -->
<!-- to true may have security implications. -->
<!-- -->
<!-- verbose If true, log dynamic loads -->
<!-- -->
<!-- * All other parameters are copied to the -->
<!-- each dynamic servlet as init parameters -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Uncomment for dynamic invocation
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.Invoker</servlet-class>
<init-param>
<param-name>verbose</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>nonContextServlets</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>dynamicParam</param-name>
<param-value>anyValue</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping> <servlet-name>invoker</servlet-name> <url-pattern>/servlet/*</url-pattern> </servlet-mapping>
-->
<!-- ==================================================================== -->
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<!-- ==================================================================== -->
<!-- Default MIME mappings -->
<!-- The default MIME mappings are provided by the mime.properties -->
<!-- resource in the org.eclipse.jetty.server.jar file. Additional or modified -->
<!-- mappings may be specified here -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- UNCOMMENT TO ACTIVATE
<mime-mapping>
<extension>mysuffix</extension>
<mime-type>mymime/type</mime-type>
</mime-mapping>
-->
<!-- ==================================================================== -->
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- ==================================================================== -->
<locale-encoding-mapping-list>
<locale-encoding-mapping><locale>ar</locale><encoding>ISO-8859-6</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>be</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>bg</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>ca</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>cs</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>da</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>de</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>el</locale><encoding>ISO-8859-7</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>en</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>es</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>et</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>fi</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>fr</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>hr</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>hu</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>is</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>it</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>iw</locale><encoding>ISO-8859-8</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>ja</locale><encoding>Shift_JIS</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>ko</locale><encoding>EUC-KR</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>lt</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>lv</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>mk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>nl</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>no</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>pl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>pt</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>ro</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>ru</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>sh</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>sk</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>sl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>sq</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>sr</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>sv</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>tr</locale><encoding>ISO-8859-9</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>uk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>zh</locale><encoding>GB2312</encoding></locale-encoding-mapping>
<locale-encoding-mapping><locale>zh_TW</locale><encoding>Big5</encoding></locale-encoding-mapping>
</locale-encoding-mapping-list>
<security-constraint>
<web-resource-collection>
<web-resource-name>Disable TRACE</web-resource-name>
<url-pattern>/</url-pattern>
<http-method>TRACE</http-method>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
</web-app>

View File

@ -0,0 +1,2 @@
Place here the jars that are inserted in the jetty classloader.
As similar as possible as what this folder was for in the classical jetty installation.

View File

@ -0,0 +1,3 @@
This folder contains the logs by default during development time.
In production or outside the eclipse PDE, it is likely that a different jetty.home
was set or jetty.log so it won't be here.

View File

@ -0,0 +1,2 @@
This folder is part of the class-loader shared by the webapps run in jetty.
Typically it contains log4j configuration files.

View File

@ -0,0 +1,2 @@
Default locations for standard web-applications.
Those applications are unlikely to have access to the OSGi framework currently.

View File

@ -0,0 +1,53 @@
// ========================================================================
// 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;
/**
*
*/
public class OSGiWebappConstants
{
/** url scheme to deploy war file as bundled webapp */
public static final String RFC66_WAR_URL_SCHEME = "war";
/** Name of the header that defines the context path for the embedded webapp. */
public static final String RFC66_WEB_CONTEXTPATH = "Web-ContextPath";
/** 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";
/** List of relative pathes within the bundle to the jetty context files. */
public static final String JETTY_CONTEXT_FILE_PATH = "Jetty-ContextFilePath";
/** path within the bundle to the folder that contains the basic resources. */
public static final String JETTY_WAR_FOLDER_PATH = "Jetty-WarFolderPath";
// OSGi ContextHandler service properties.
/** web app context path */
public static final String SERVICE_PROP_CONTEXT_PATH = "contextPath";
/** Path to the web application base folderr */
public static final String SERVICE_PROP_WAR = "war";
/** Extra classpath */
public static final String SERVICE_PROP_EXTRA_CLASSPATH = "extraClasspath";
/** jetty context file path */
public static final String SERVICE_PROP_CONTEXT_FILE_PATH = "contextFilePath";
/** 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";
}

View File

@ -0,0 +1,135 @@
// ========================================================================
// 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.utils.internal;
import java.util.ArrayList;
import java.util.List;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
import org.osgi.service.packageadmin.PackageAdmin;
/**
* When the PackageAdmin service is activated we can look for the fragments attached to
* this bundle and "activate" them.
*
*/
public class PackageAdminServiceTracker implements ServiceListener
{
private BundleContext _context;
private List<BundleActivator> _activatedFragments = new ArrayList<BundleActivator>();
private boolean _fragmentsWereActivated = false;
public PackageAdminServiceTracker(BundleContext context)
{
_context = context;
if (!setup())
{
try
{
_context.addServiceListener(this,"(objectclass=" + PackageAdmin.class.getName() + ")");
}
catch (InvalidSyntaxException e)
{
e.printStackTrace(); //won't happen
}
}
}
/**
* @return true if the fragments were activated by this method.
*/
private boolean setup()
{
ServiceReference sr = _context.getServiceReference(PackageAdmin.class.getName());
_fragmentsWereActivated = sr != null;
if (sr != null)
invokeFragmentActivators(sr);
return _fragmentsWereActivated;
}
/**
* Invokes the optional BundleActivator in each fragment.
* By convention the bundle activator for a fragment must
* be in the package that is defined by the symbolic name of the fragment
* and the name of the class must be 'FragmentActivator'.
*
* @param event The <code>ServiceEvent</code> object.
*/
public void serviceChanged(ServiceEvent event)
{
if (event.getType() == ServiceEvent.REGISTERED)
{
invokeFragmentActivators(event.getServiceReference());
}
}
private void invokeFragmentActivators(ServiceReference sr) {
PackageAdmin admin = (PackageAdmin) _context.getService(sr);
for (Bundle frag : admin.getFragments(_context.getBundle())) {
//find a convention to look for a class inside the fragment.
try
{
Class<?> c = Class.forName(frag.getSymbolicName() + ".FragmentActivator");
if (c != null)
{
BundleActivator bActivator = (BundleActivator) c.newInstance();
bActivator.start(_context);
_activatedFragments.add(bActivator);
}
}
catch (NullPointerException e)
{
//e.printStackTrace();
}
catch (InstantiationException e)
{
//e.printStackTrace();
}
catch (IllegalAccessException e)
{
//e.printStackTrace();
}
catch (ClassNotFoundException e)
{
//e.printStackTrace();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
public void stop()
{
for (BundleActivator fragAct : _activatedFragments)
{
try
{
fragAct.stop(_context);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}

View File

@ -0,0 +1,12 @@
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-Vendor: Mort Bay Consulting
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: javax.servlet;version="2.5.0",
javax.servlet.http;version="2.5.0",
org.osgi.service.http;version="1.2.0",
org.eclipse.equinox.http.servlet
Jetty-ContextFilePath: contexts/httpservice.xml

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!--
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
-->
<Configure class="org.eclipse.jetty.servlet.ServletContextHandler">
<!-- this servlet provides the OSGi HTTP Service once it is initialized -->
<Call name="addServlet">
<Arg>org.eclipse.jetty.osgi.httpservice.HttpServiceServletX</Arg>
<Arg>/*</Arg>
</Call>
</Configure>

View File

@ -0,0 +1,75 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty.osgi</groupId>
<artifactId>jetty-osgi-project</artifactId>
<version>7.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jetty.osgi</groupId>
<artifactId>jetty-httpservice</artifactId>
<name>Jetty :: OSGi :: HttpService</name>
<description>Jetty OSGi HttpService bundle</description>
<dependencies>
<dependency>
<groupId>org.eclipse.equinox.http</groupId>
<artifactId>servlet</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>osgi</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<tasks>
<replace file="target/classes/META-INF/MANIFEST.MF"
token="Bundle-Version: 7.0.1.qualifier"
value="Bundle-Version: ${parsedVersion.osgiVersion}"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>artifact-jar</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
<execution>
<id>test-jar</id>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifestFile>target/classes/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,28 @@
// ========================================================================
// 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.httpservice;
import org.eclipse.equinox.http.servlet.HttpServiceServlet;
/**
* Once this servlet is initialized, it provides the OSGi HttpService.
* Compliments of equinox. Currently has no added value.
*/
public class HttpServiceServletX extends HttpServiceServlet
{
/**
*
*/
private static final long serialVersionUID = 1L;
}