jetty-9 Added proxy test webapp. Refined no servlet context handling
This commit is contained in:
parent
0eeef6ab4e
commit
9a4e5f3301
|
@ -27,6 +27,7 @@ import java.net.URLClassLoader;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.apache.tools.ant.AntClassLoader;
|
||||
import org.eclipse.jetty.annotations.AnnotationConfiguration;
|
||||
|
@ -141,7 +142,7 @@ public class WebApplicationProxyImpl implements WebApplicationProxy
|
|||
{
|
||||
//super.initJspServlet();
|
||||
|
||||
ContextHandler ch = ((ContextHandler.Context)getServletHandler().getServletContext()).getContextHandler();
|
||||
ContextHandler ch = ContextHandler.getContextHandler(getServletHandler().getServletContext());
|
||||
|
||||
/* Set the webapp's classpath for Jasper */
|
||||
ch.setAttribute("org.apache.catalina.jsp_classpath", ch.getClassPath());
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.eclipse.jetty.deploy.bindings;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.jetty.deploy.App;
|
||||
import org.eclipse.jetty.deploy.AppLifeCycle;
|
||||
import org.eclipse.jetty.deploy.graph.Node;
|
||||
|
@ -92,6 +94,12 @@ public class GlobalWebappConfigBinding implements AppLifeCycle.Binding
|
|||
{
|
||||
XmlConfiguration jettyXmlConfig = new XmlConfiguration(globalContextSettings.getInputStream());
|
||||
|
||||
Resource resource = Resource.newResource(app.getOriginId());
|
||||
File file = resource.getFile();
|
||||
jettyXmlConfig.getIdMap().put("Server",app.getDeploymentManager().getServer());
|
||||
jettyXmlConfig.getProperties().put("jetty.webapp",file.getCanonicalPath());
|
||||
jettyXmlConfig.getProperties().put("jetty.webapps",file.getParentFile().getCanonicalPath());
|
||||
|
||||
jettyXmlConfig.configure(context);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.Locale;
|
|||
import org.eclipse.jetty.deploy.App;
|
||||
import org.eclipse.jetty.deploy.ConfigurationManager;
|
||||
import org.eclipse.jetty.deploy.util.FileID;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.util.URIUtil;
|
||||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
|
@ -57,7 +58,8 @@ import org.eclipse.jetty.xml.XmlConfiguration;
|
|||
* <li>If a WAR file and a matching XML exist (eg foo.war and foo.xml) then the WAR is assumed to
|
||||
* be configured by the XML and only the XML is deployed.
|
||||
* </ul>
|
||||
*
|
||||
* <p>For XML configured contexts, the ID map will contain a reference to the {@link Server} instance called "Server" and
|
||||
* properties for the webapp file as "jetty.webapp" and directory as "jetty.webapps".
|
||||
*/
|
||||
@ManagedObject("Provider for start-up deployement of webapps based on presence in directory")
|
||||
public class WebAppProvider extends ScanningAppProvider
|
||||
|
@ -267,6 +269,9 @@ public class WebAppProvider extends ScanningAppProvider
|
|||
XmlConfiguration xmlc = new XmlConfiguration(resource.getURL());
|
||||
|
||||
xmlc.getIdMap().put("Server",getDeploymentManager().getServer());
|
||||
xmlc.getProperties().put("jetty.webapp",file.getCanonicalPath());
|
||||
xmlc.getProperties().put("jetty.webapps",file.getParentFile().getCanonicalPath());
|
||||
|
||||
if (getConfigurationManager() != null)
|
||||
xmlc.getProperties().putAll(getConfigurationManager().getProperties());
|
||||
return (ContextHandler)xmlc.configure();
|
||||
|
|
|
@ -102,6 +102,16 @@
|
|||
<outputDirectory>${assembly-directory}/webapps</outputDirectory>
|
||||
<destFileName>test.war</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>test-proxy-webapp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>war</type>
|
||||
<overWrite>true</overWrite>
|
||||
<includes>**</includes>
|
||||
<outputDirectory>${assembly-directory}/webapps</outputDirectory>
|
||||
<destFileName>javadoc-proxy.war</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.eclipse.jetty.example-async-rest</groupId>
|
||||
<artifactId>example-async-rest-webapp</artifactId>
|
||||
|
@ -343,6 +353,12 @@
|
|||
<type>war</type>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>test-proxy-webapp</artifactId>
|
||||
<type>war</type>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-jmx</artifactId>
|
||||
|
@ -376,6 +392,12 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-proxy</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-jaas</artifactId>
|
||||
|
@ -393,6 +415,38 @@
|
|||
<artifactId>jetty-rewrite</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-http-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-example-webapp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>war</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.example-async-rest</groupId>
|
||||
<artifactId>example-async-rest-webapp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>war</type>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
|
@ -428,100 +482,4 @@
|
|||
</dependency>
|
||||
-->
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
<!-- Modules that are only for JDK7+ builds -->
|
||||
<id>JDK7-plus-modules</id>
|
||||
<activation>
|
||||
<jdk>[1.7,)</jdk>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-lib-spdy-deps</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<includeGroupIds>org.eclipse.jetty.spdy</includeGroupIds>
|
||||
<includeTypes>jar</includeTypes>
|
||||
<outputDirectory>${assembly-directory}/lib/spdy</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
<!--
|
||||
<execution>
|
||||
<id>copy-spdy</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-example-webapp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>war</type>
|
||||
<overWrite>true</overWrite>
|
||||
<includes>**</includes>
|
||||
<outputDirectory>${assembly-directory}/webapps</outputDirectory>
|
||||
<destFileName>spdy.war</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
-->
|
||||
<execution>
|
||||
<id>unpack-spdy</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>unpack-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<includeGroupIds>org.eclipse.jetty.spdy</includeGroupIds>
|
||||
<classifier>config</classifier>
|
||||
<failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
|
||||
<excludes>META-INF/**</excludes>
|
||||
<outputDirectory>${assembly-directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-http-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-example-webapp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>war</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.example-async-rest</groupId>
|
||||
<artifactId>example-async-rest-webapp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>war</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
|
|
@ -29,6 +29,7 @@ The project is 100% <a href="http://en.wikipedia.org/wiki/Open_source">Open Sour
|
|||
<ul>
|
||||
<li><a href="/test/">Test Jetty Webapp</a></li>
|
||||
<li><a href="/async-rest/">Async Rest</a></li>
|
||||
<li><a href="/javadoc/">Proxy to javadoc</a></li>
|
||||
<li><a href="/oldContextPath/">Redirected Context</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
||||
|
||||
<!--Configure a context for the javadoc -->
|
||||
<Configure class="org.eclipse.jetty.server.handler.ContextHandler">
|
||||
<Set name="contextPath">/javadoc</Set>
|
||||
<Set name="resourceBase"><SystemProperty name="jetty.home" default="."/>/javadoc/</Set>
|
||||
<Set name="handler">
|
||||
<New class="org.eclipse.jetty.server.handler.ResourceHandler">
|
||||
<Set name="welcomeFiles">
|
||||
<Array type="String">
|
||||
<Item>index.html</Item>
|
||||
</Array>
|
||||
</Set>
|
||||
<Set name="cacheControl">max-age=3600,public</Set>
|
||||
</New>
|
||||
</Set>
|
||||
</Configure>
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
|
||||
|
||||
<!-- ============================================================= -->
|
||||
<!-- Configure the Jetty Server instance with an ID "Proxy" -->
|
||||
<!-- by adding a proxy functionalities. -->
|
||||
<!-- ============================================================= -->
|
||||
<!-- ========================================================================== -->
|
||||
<!-- Configure the Jetty Server instance with an ID "Proxy" -->
|
||||
<!-- by adding a proxy functionalities. -->
|
||||
<!-- ========================================================================== -->
|
||||
<Configure id="Proxy" class="org.eclipse.jetty.server.Server">
|
||||
|
||||
<Arg name="threadpool">
|
||||
|
@ -17,7 +17,7 @@
|
|||
<Call name="addConnector">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.ServerConnector">
|
||||
<Arg name="server"><Ref id="Server" /></Arg>
|
||||
<Arg name="server"><Ref id="Proxy" /></Arg>
|
||||
<Set name="host"><Property name="jetty.host" /></Set>
|
||||
<Set name="port"><Property name="jetty.port" default="8888"/></Set>
|
||||
<Set name="idleTimeout">300000</Set>
|
||||
|
@ -26,25 +26,22 @@
|
|||
</Call>
|
||||
|
||||
<Set name="handler">
|
||||
<New class="org.eclipse.jetty.server.handler.ConnectHandler">
|
||||
<New class="org.eclipse.jetty.proxy.ConnectHandler">
|
||||
<Set name="handler">
|
||||
<New class="org.eclipse.jetty.servlet.ServletHandler">
|
||||
<Call id="proxyHolder" name="addServletWithMapping">
|
||||
<Arg>org.eclipse.jetty.servlets.ProxyServlet</Arg>
|
||||
<Arg>org.eclipse.jetty.proxy.ProxyServlet</Arg>
|
||||
<Arg>/</Arg>
|
||||
<Call name="setInitParameter">
|
||||
<Arg>maxThreads</Arg>
|
||||
<Arg>128</Arg>
|
||||
</Call>
|
||||
</Call>
|
||||
</New>
|
||||
</Set>
|
||||
</New>
|
||||
</Set>
|
||||
|
||||
<Ref id="proxyHolder">
|
||||
<Call name="setInitParameter">
|
||||
<Arg>maxThreads</Arg>
|
||||
<Arg>128</Arg>
|
||||
</Call>
|
||||
</Ref>
|
||||
|
||||
<Set name="stopAtShutdown">true</Set>
|
||||
<Set name="sendServerVersion">true</Set>
|
||||
<Set name="sendDateHeader">true</Set>
|
||||
|
|
|
@ -100,7 +100,13 @@ import org.eclipse.jetty.util.resource.Resource;
|
|||
@ManagedObject("URI Context")
|
||||
public class ContextHandler extends ScopedHandler implements Attributes, Graceful
|
||||
{
|
||||
public static int SERVLET_MAJOR_VERSION=3;
|
||||
public static int SERVLET_MINOR_VERSION=0;
|
||||
|
||||
final private static String __unimplmented="Unimplemented - use org.eclipse.jetty.servlet.ServletContextHandler";
|
||||
|
||||
|
||||
|
||||
private static final Logger LOG = Log.getLogger(ContextHandler.class);
|
||||
|
||||
private static final ThreadLocal<Context> __context = new ThreadLocal<Context>();
|
||||
|
@ -123,10 +129,20 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
return __context.get();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public static ContextHandler getContextHandler(ServletContext context)
|
||||
{
|
||||
if(context instanceof ContextHandler.Context)
|
||||
return ((ContextHandler.Context)context).getContextHandler();
|
||||
Context c= getCurrentContext();
|
||||
if (c!=null)
|
||||
return c.getContextHandler();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
protected Context _scontext;
|
||||
|
||||
private final AttributesMap _attributes;
|
||||
private final AttributesMap _contextAttributes;
|
||||
private final Map<String, String> _initParams;
|
||||
private ClassLoader _classLoader;
|
||||
private String _contextPath = "/";
|
||||
|
@ -168,7 +184,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
super();
|
||||
_scontext = new Context();
|
||||
_attributes = new AttributesMap();
|
||||
_contextAttributes = new AttributesMap();
|
||||
_initParams = new HashMap<String, String>();
|
||||
}
|
||||
|
||||
|
@ -181,7 +196,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
super();
|
||||
_scontext = context;
|
||||
_attributes = new AttributesMap();
|
||||
_contextAttributes = new AttributesMap();
|
||||
_initParams = new HashMap<String, String>();
|
||||
}
|
||||
|
||||
|
@ -217,7 +231,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
Collections.singletonList(new ClassLoaderDump(getClassLoader())),
|
||||
_initParams.entrySet(),
|
||||
_attributes.getAttributeEntrySet(),
|
||||
_contextAttributes.getAttributeEntrySet());
|
||||
_scontext.getAttributeEntrySet());
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -825,7 +839,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
current_thread.setContextClassLoader(old_classloader);
|
||||
}
|
||||
|
||||
_contextAttributes.clearAttributes();
|
||||
_scontext.clearAttributes();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -1652,10 +1666,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
*
|
||||
*
|
||||
*/
|
||||
public class Context implements ServletContext
|
||||
public class Context extends NoContext
|
||||
{
|
||||
protected int _majorVersion = 3;
|
||||
protected int _minorVersion = 0;
|
||||
protected boolean _enabled = true; //whether or not the dynamic API is enabled for callers
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -1755,17 +1767,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
return null;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see javax.servlet.ServletContext#getMajorVersion()
|
||||
*/
|
||||
@Override
|
||||
public int getMajorVersion()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see javax.servlet.ServletContext#getMimeType(java.lang.String)
|
||||
|
@ -1777,27 +1778,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
return null;
|
||||
return _mimeTypes.getMimeByExtension(file);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see javax.servlet.ServletContext#getMinorVersion()
|
||||
*/
|
||||
@Override
|
||||
public int getMinorVersion()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see javax.servlet.ServletContext#getNamedDispatcher(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public RequestDispatcher getNamedDispatcher(String name)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see javax.servlet.ServletContext#getRequestDispatcher(java.lang.String)
|
||||
|
@ -1909,51 +1890,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
return ContextHandler.this.getResourcePaths(path);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see javax.servlet.ServletContext#getServerInfo()
|
||||
*/
|
||||
@Override
|
||||
public String getServerInfo()
|
||||
{
|
||||
return "jetty/" + Server.getVersion();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see javax.servlet.ServletContext#getServlet(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public Servlet getServlet(String name) throws ServletException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see javax.servlet.ServletContext#getServletNames()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@Deprecated
|
||||
public Enumeration<String> getServletNames()
|
||||
{
|
||||
return Collections.enumeration(Collections.EMPTY_LIST);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see javax.servlet.ServletContext#getServlets()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@Deprecated
|
||||
public Enumeration<Servlet> getServlets()
|
||||
{
|
||||
return Collections.enumeration(Collections.EMPTY_LIST);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see javax.servlet.ServletContext#log(java.lang.Exception, java.lang.String)
|
||||
|
@ -2013,8 +1949,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
public synchronized Object getAttribute(String name)
|
||||
{
|
||||
Object o = ContextHandler.this.getAttribute(name);
|
||||
if (o == null && _contextAttributes != null)
|
||||
o = _contextAttributes.getAttribute(name);
|
||||
if (o == null)
|
||||
o = super.getAttribute(name);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
@ -2026,13 +1962,10 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
public synchronized Enumeration<String> getAttributeNames()
|
||||
{
|
||||
HashSet<String> set = new HashSet<String>();
|
||||
if (_contextAttributes != null)
|
||||
{
|
||||
Enumeration<String> e = _contextAttributes.getAttributeNames();
|
||||
while (e.hasMoreElements())
|
||||
set.add(e.nextElement());
|
||||
}
|
||||
Enumeration<String> e = _attributes.getAttributeNames();
|
||||
Enumeration<String> e = super.getAttributeNames();
|
||||
while (e.hasMoreElements())
|
||||
set.add(e.nextElement());
|
||||
e = _attributes.getAttributeNames();
|
||||
while (e.hasMoreElements())
|
||||
set.add(e.nextElement());
|
||||
|
||||
|
@ -2047,12 +1980,12 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
public synchronized void setAttribute(String name, Object value)
|
||||
{
|
||||
checkManagedAttribute(name,value);
|
||||
Object old_value = _contextAttributes.getAttribute(name);
|
||||
Object old_value = super.getAttribute(name);
|
||||
|
||||
if (value == null)
|
||||
_contextAttributes.removeAttribute(name);
|
||||
super.removeAttribute(name);
|
||||
else
|
||||
_contextAttributes.setAttribute(name,value);
|
||||
super.setAttribute(name,value);
|
||||
|
||||
if (!_contextAttributeListeners.isEmpty())
|
||||
{
|
||||
|
@ -2079,15 +2012,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
{
|
||||
checkManagedAttribute(name,null);
|
||||
|
||||
if (_contextAttributes == null)
|
||||
{
|
||||
// Set it on the handler
|
||||
_attributes.removeAttribute(name);
|
||||
return;
|
||||
}
|
||||
|
||||
Object old_value = _contextAttributes.getAttribute(name);
|
||||
_contextAttributes.removeAttribute(name);
|
||||
Object old_value = super.getAttribute(name);
|
||||
super.removeAttribute(name);
|
||||
if (old_value != null &&!_contextAttributeListeners.isEmpty())
|
||||
{
|
||||
ServletContextAttributeEvent event = new ServletContextAttributeEvent(_scontext,name,old_value);
|
||||
|
@ -2137,8 +2063,255 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(String className)
|
||||
{
|
||||
if (!_enabled)
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
try
|
||||
{
|
||||
Class<? extends EventListener> clazz = _classLoader==null?Loader.loadClass(ContextHandler.class,className):_classLoader.loadClass(className);
|
||||
addListener(clazz);
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends EventListener> void addListener(T t)
|
||||
{
|
||||
if (!_enabled)
|
||||
throw new UnsupportedOperationException();
|
||||
ContextHandler.this.addEventListener(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(Class<? extends EventListener> listenerClass)
|
||||
{
|
||||
if (!_enabled)
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
try
|
||||
{
|
||||
EventListener e = createListener(listenerClass);
|
||||
ContextHandler.this.addEventListener(e);
|
||||
ContextHandler.this.addProgrammaticListener(e);
|
||||
}
|
||||
catch (ServletException e)
|
||||
{
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends EventListener> T createListener(Class<T> clazz) throws ServletException
|
||||
{
|
||||
try
|
||||
{
|
||||
return clazz.newInstance();
|
||||
}
|
||||
catch (InstantiationException e)
|
||||
{
|
||||
throw new ServletException(e);
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
throw new ServletException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader getClassLoader()
|
||||
{
|
||||
AccessController.checkPermission(new RuntimePermission("getClassLoader"));
|
||||
return _classLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JspConfigDescriptor getJspConfigDescriptor()
|
||||
{
|
||||
LOG.warn(__unimplmented);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setJspConfigDescriptor(JspConfigDescriptor d)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void declareRoles(String... roleNames)
|
||||
{
|
||||
if (!isStarting())
|
||||
throw new IllegalStateException ();
|
||||
if (!_enabled)
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled)
|
||||
{
|
||||
_enabled = enabled;
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return _enabled;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class NoContext extends AttributesMap implements ServletContext
|
||||
{
|
||||
private int _effectiveMajorVersion = SERVLET_MAJOR_VERSION;
|
||||
private int _effectiveMinorVersion = SERVLET_MINOR_VERSION;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
final private static String __unimplmented="Unimplemented - use org.eclipse.jetty.servlet.ServletContextHandler";
|
||||
public NoContext()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletContext getContext(String uripath)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMajorVersion()
|
||||
{
|
||||
return SERVLET_MAJOR_VERSION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMimeType(String file)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinorVersion()
|
||||
{
|
||||
return SERVLET_MINOR_VERSION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestDispatcher getNamedDispatcher(String name)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestDispatcher getRequestDispatcher(String uriInContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRealPath(String path)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getResource(String path) throws MalformedURLException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getResourceAsStream(String path)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getResourcePaths(String path)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerInfo()
|
||||
{
|
||||
return "jetty/" + Server.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public Servlet getServlet(String name) throws ServletException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@Deprecated
|
||||
public Enumeration<String> getServletNames()
|
||||
{
|
||||
return Collections.enumeration(Collections.EMPTY_LIST);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@Deprecated
|
||||
public Enumeration<Servlet> getServlets()
|
||||
{
|
||||
return Collections.enumeration(Collections.EMPTY_LIST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(Exception exception, String msg)
|
||||
{
|
||||
LOG.warn(msg,exception);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String msg)
|
||||
{
|
||||
LOG.info(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String message, Throwable throwable)
|
||||
{
|
||||
LOG.warn(message,throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInitParameter(String name)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Enumeration<String> getInitParameterNames()
|
||||
{
|
||||
return Collections.enumeration(Collections.EMPTY_LIST);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getServletContextName()
|
||||
{
|
||||
return "No Context";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContextPath()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean setInitParameter(String name, String value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dynamic addFilter(String filterName, Class<? extends Filter> filterClass)
|
||||
|
@ -2254,44 +2427,19 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
@Override
|
||||
public void addListener(String className)
|
||||
{
|
||||
if (!_enabled)
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
try
|
||||
{
|
||||
Class<? extends EventListener> clazz = _classLoader==null?Loader.loadClass(ContextHandler.class,className):_classLoader.loadClass(className);
|
||||
addListener(clazz);
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
LOG.warn(__unimplmented);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends EventListener> void addListener(T t)
|
||||
{
|
||||
if (!_enabled)
|
||||
throw new UnsupportedOperationException();
|
||||
ContextHandler.this.addEventListener(t);
|
||||
LOG.warn(__unimplmented);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(Class<? extends EventListener> listenerClass)
|
||||
{
|
||||
if (!_enabled)
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
try
|
||||
{
|
||||
EventListener e = createListener(listenerClass);
|
||||
ContextHandler.this.addEventListener(e);
|
||||
ContextHandler.this.addProgrammaticListener(e);
|
||||
}
|
||||
catch (ServletException e)
|
||||
{
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
LOG.warn(__unimplmented);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2315,29 +2463,29 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
public ClassLoader getClassLoader()
|
||||
{
|
||||
AccessController.checkPermission(new RuntimePermission("getClassLoader"));
|
||||
return _classLoader;
|
||||
return ContextHandler.class.getClassLoader();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEffectiveMajorVersion()
|
||||
{
|
||||
return _majorVersion;
|
||||
return _effectiveMajorVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEffectiveMinorVersion()
|
||||
{
|
||||
return _minorVersion;
|
||||
return _effectiveMinorVersion;
|
||||
}
|
||||
|
||||
public void setEffectiveMajorVersion (int v)
|
||||
{
|
||||
_majorVersion = v;
|
||||
_effectiveMajorVersion = v;
|
||||
}
|
||||
|
||||
public void setEffectiveMinorVersion (int v)
|
||||
{
|
||||
_minorVersion = v;
|
||||
_effectiveMinorVersion = v;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2347,28 +2495,10 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
return null;
|
||||
}
|
||||
|
||||
public void setJspConfigDescriptor(JspConfigDescriptor d)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void declareRoles(String... roleNames)
|
||||
{
|
||||
if (!isStarting())
|
||||
throw new IllegalStateException ();
|
||||
if (!_enabled)
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled)
|
||||
{
|
||||
_enabled = enabled;
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return _enabled;
|
||||
LOG.warn(__unimplmented);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import javax.servlet.DispatcherType;
|
|||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.FilterRegistration;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
import org.eclipse.jetty.util.TypeUtil;
|
||||
|
@ -100,7 +101,10 @@ public class FilterHolder extends Holder<Filter>
|
|||
{
|
||||
try
|
||||
{
|
||||
_filter=((ServletContextHandler.Context)_servletHandler.getServletContext()).createFilter(getHeldClass());
|
||||
ServletContext context=_servletHandler.getServletContext();
|
||||
_filter=(context instanceof ServletContextHandler.Context)
|
||||
?((ServletContextHandler.Context)context).createFilter(getHeldClass())
|
||||
:getHeldClass().newInstance();
|
||||
}
|
||||
catch (ServletException se)
|
||||
{
|
||||
|
|
|
@ -265,8 +265,8 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
|
|||
{
|
||||
if (_servletHandler!=null)
|
||||
{
|
||||
ContextHandler.Context context=(ContextHandler.Context)_servletHandler.getServletContext();
|
||||
if (context!=null && context.getContextHandler().isStarted())
|
||||
ServletContext context=_servletHandler.getServletContext();
|
||||
if ((context instanceof ContextHandler.Context) && ((ContextHandler.Context)context).getContextHandler().isStarted())
|
||||
throw new IllegalStateException("Started");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,10 +19,15 @@
|
|||
package org.eclipse.jetty.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Enumeration;
|
||||
import java.util.EventListener;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -34,15 +39,20 @@ import java.util.concurrent.ConcurrentMap;
|
|||
import javax.servlet.DispatcherType;
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterRegistration;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRegistration;
|
||||
import javax.servlet.ServletRegistration.Dynamic;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.ServletSecurityElement;
|
||||
import javax.servlet.SessionCookieConfig;
|
||||
import javax.servlet.SessionTrackingMode;
|
||||
import javax.servlet.UnavailableException;
|
||||
import javax.servlet.descriptor.JspConfigDescriptor;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
@ -61,6 +71,7 @@ import org.eclipse.jetty.server.UserIdentity;
|
|||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.server.handler.ScopedHandler;
|
||||
import org.eclipse.jetty.util.ArrayUtil;
|
||||
import org.eclipse.jetty.util.AttributesMap;
|
||||
import org.eclipse.jetty.util.LazyList;
|
||||
import org.eclipse.jetty.util.MultiException;
|
||||
import org.eclipse.jetty.util.MultiMap;
|
||||
|
@ -94,7 +105,7 @@ public class ServletHandler extends ScopedHandler
|
|||
|
||||
/* ------------------------------------------------------------ */
|
||||
private ServletContextHandler _contextHandler;
|
||||
private ContextHandler.Context _servletContext;
|
||||
private ServletContext _servletContext;
|
||||
private FilterHolder[] _filters=new FilterHolder[0];
|
||||
private FilterMapping[] _filterMappings;
|
||||
private boolean _filterChainsCached=true;
|
||||
|
@ -128,8 +139,9 @@ public class ServletHandler extends ScopedHandler
|
|||
protected synchronized void doStart()
|
||||
throws Exception
|
||||
{
|
||||
_servletContext=ContextHandler.getCurrentContext();
|
||||
_contextHandler=(ServletContextHandler)(_servletContext==null?null:_servletContext.getContextHandler());
|
||||
ContextHandler.Context context=ContextHandler.getCurrentContext();
|
||||
_servletContext=context==null?new ContextHandler.NoContext():context;
|
||||
_contextHandler=(ServletContextHandler)(context==null?null:context.getContextHandler());
|
||||
|
||||
if (_contextHandler!=null)
|
||||
{
|
||||
|
@ -1464,4 +1476,6 @@ public class ServletHandler extends ScopedHandler
|
|||
if (_contextHandler!=null)
|
||||
_contextHandler.destroyFilter(filter);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -551,8 +551,8 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
*/
|
||||
protected void initJspServlet () throws Exception
|
||||
{
|
||||
ContextHandler ch = ((ContextHandler.Context)getServletHandler().getServletContext()).getContextHandler();
|
||||
|
||||
ContextHandler ch = ContextHandler.getContextHandler(getServletHandler().getServletContext());
|
||||
|
||||
/* Set the webapp's classpath for Jasper */
|
||||
ch.setAttribute("org.apache.catalina.jsp_classpath", ch.getClassPath());
|
||||
|
||||
|
@ -584,7 +584,8 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
{
|
||||
//Register a listener to delete tmp files that are created as a result of this
|
||||
//servlet calling Request.getPart() or Request.getParts()
|
||||
ContextHandler ch = ((ContextHandler.Context)getServletHandler().getServletContext()).getContextHandler();
|
||||
|
||||
ContextHandler ch = ContextHandler.getContextHandler(getServletHandler().getServletContext());
|
||||
ch.addEventListener(new Request.MultiPartCleanerListener());
|
||||
}
|
||||
}
|
||||
|
@ -945,9 +946,9 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
try
|
||||
{
|
||||
ServletContext ctx = getServletHandler().getServletContext();
|
||||
if (ctx==null)
|
||||
return getHeldClass().newInstance();
|
||||
return ((ServletContextHandler.Context)ctx).createServlet(getHeldClass());
|
||||
if (ctx instanceof ServletContextHandler.Context)
|
||||
return ((ServletContextHandler.Context)ctx).createServlet(getHeldClass());
|
||||
return getHeldClass().newInstance();
|
||||
}
|
||||
catch (ServletException se)
|
||||
{
|
||||
|
|
|
@ -33,13 +33,17 @@ import org.eclipse.jetty.http.HttpURI;
|
|||
import org.eclipse.jetty.servlet.FilterHolder;
|
||||
import org.eclipse.jetty.servlet.ServletTester;
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
|
@ -321,7 +325,8 @@ public abstract class AbstractDoSFilterTest
|
|||
// was expired, and stopped before reaching the end of the requests
|
||||
int responseLines = count(responses, "Line:");
|
||||
assertTrue(responses.contains("DoSFilter: timeout"));
|
||||
assertTrue(responseLines > 0 && responseLines < numRequests);
|
||||
assertThat(responseLines,greaterThan(0));
|
||||
assertThat(responseLines,Matchers.lessThan(numRequests));
|
||||
}
|
||||
|
||||
public static class TestServlet extends HttpServlet implements Servlet
|
||||
|
|
|
@ -38,6 +38,7 @@ public class CloseableDoSFilterTest extends AbstractDoSFilterTest
|
|||
|
||||
public static class CloseableDoSFilter2 extends CloseableDoSFilter
|
||||
{
|
||||
@Override
|
||||
public void closeConnection(HttpServletRequest request, HttpServletResponse response, Thread thread)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
</build>
|
||||
<modules>
|
||||
<module>test-jetty-webapp</module>
|
||||
<module>test-proxy-webapp</module>
|
||||
<module>test-webapp-rfc2616</module>
|
||||
<module>test-mock-resources</module>
|
||||
<module>test-servlet-spec</module>
|
||||
|
|
|
@ -34,7 +34,6 @@ This is a test context that serves:
|
|||
<li><a href="dispatch">Dispatcher Servlet</a></li>
|
||||
<li><a href="rewrite/">Request Rewrite Servlet</a></li>
|
||||
<li><a href="jsp/">JSP examples</a></li>
|
||||
<li><a href="javadoc-proxy/">Transparent Proxy</a> (to javadoc @ eclipse.org)</li>
|
||||
<li>Comet Chat: <a href="chat/">Long Polling</a>, <a href="ws">WebSocket</a></li>
|
||||
<li><a href="auth.html">Authentication</a></li>
|
||||
</ul>
|
||||
|
|
|
@ -150,7 +150,6 @@ public class TestServer
|
|||
|
||||
|
||||
// Setup context
|
||||
|
||||
HashLoginService login = new HashLoginService();
|
||||
login.setName("Test Realm");
|
||||
login.setConfig(jetty_root + "/test-jetty-webapp/src/main/config/etc/realm.properties");
|
||||
|
@ -166,7 +165,6 @@ public class TestServer
|
|||
|
||||
WebAppContext webapp = new WebAppContext();
|
||||
webapp.setParentLoaderPriority(true);
|
||||
webapp.prependServerClass("-org.eclipse.jetty.websocket.server.");
|
||||
webapp.setResourceBase("./src/main/webapp");
|
||||
webapp.setAttribute("testAttribute","testValue");
|
||||
File sessiondir=File.createTempFile("sessions",null);
|
||||
|
|
|
@ -0,0 +1,318 @@
|
|||
<jmeterTestPlan version="1.2" properties="1.8">
|
||||
<hashTree>
|
||||
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
|
||||
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
|
||||
<collectionProp name="Arguments.arguments"/>
|
||||
</elementProp>
|
||||
<stringProp name="TestPlan.user_define_classpath"></stringProp>
|
||||
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
|
||||
<boolProp name="TestPlan.functional_mode">false</boolProp>
|
||||
<stringProp name="TestPlan.comments"></stringProp>
|
||||
</TestPlan>
|
||||
<hashTree>
|
||||
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
|
||||
<longProp name="ThreadGroup.start_time">1165945030000</longProp>
|
||||
<stringProp name="ThreadGroup.delay"></stringProp>
|
||||
<stringProp name="ThreadGroup.duration"></stringProp>
|
||||
<stringProp name="ThreadGroup.num_threads">400</stringProp>
|
||||
<boolProp name="ThreadGroup.scheduler">false</boolProp>
|
||||
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
|
||||
<stringProp name="LoopController.loops">1</stringProp>
|
||||
<boolProp name="LoopController.continue_forever">false</boolProp>
|
||||
</elementProp>
|
||||
<longProp name="ThreadGroup.end_time">1165945030000</longProp>
|
||||
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
|
||||
<stringProp name="ThreadGroup.ramp_time">10</stringProp>
|
||||
</ThreadGroup>
|
||||
<hashTree>
|
||||
<Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
|
||||
<collectionProp name="Arguments.arguments">
|
||||
<elementProp name="rooms" elementType="Argument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">50</stringProp>
|
||||
<stringProp name="Argument.name">rooms</stringProp>
|
||||
</elementProp>
|
||||
<elementProp name="" elementType="Argument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value"></stringProp>
|
||||
<stringProp name="Argument.name"></stringProp>
|
||||
</elementProp>
|
||||
</collectionProp>
|
||||
</Arguments>
|
||||
<hashTree/>
|
||||
<ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="true">
|
||||
<stringProp name="HTTPSampler.path">/test/chat/</stringProp>
|
||||
<stringProp name="HTTPSampler.domain">localhost</stringProp>
|
||||
<stringProp name="HTTPSampler.protocol">http</stringProp>
|
||||
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
|
||||
<collectionProp name="Arguments.arguments"/>
|
||||
</elementProp>
|
||||
<stringProp name="HTTPSampler.port">8080</stringProp>
|
||||
</ConfigTestElement>
|
||||
<hashTree/>
|
||||
<CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true">
|
||||
<boolProp name="CookieManager.clearEachIteration">true</boolProp>
|
||||
<collectionProp name="CookieManager.cookies"/>
|
||||
</CookieManager>
|
||||
<hashTree/>
|
||||
<HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler" testname="HTTP Poll 0" enabled="true">
|
||||
<stringProp name="HTTPSampler.path"></stringProp>
|
||||
<stringProp name="HTTPSampler.method">GET</stringProp>
|
||||
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
|
||||
<stringProp name="HTTPSampler.protocol"></stringProp>
|
||||
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
|
||||
<stringProp name="HTTPSampler.port"></stringProp>
|
||||
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
|
||||
<collectionProp name="Arguments.arguments">
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">poll</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">ajax</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">poll</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">message</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">0</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">timeout</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">${__javaScript(${__threadNum}%${rooms},room)}</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">room</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
</collectionProp>
|
||||
</elementProp>
|
||||
<stringProp name="HTTPSampler.mimetype"></stringProp>
|
||||
<stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
|
||||
<stringProp name="HTTPSampler.monitor">false</stringProp>
|
||||
<stringProp name="HTTPSampler.domain"></stringProp>
|
||||
<stringProp name="HTTPSampler.FILE_NAME"></stringProp>
|
||||
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
|
||||
</HTTPSampler>
|
||||
<hashTree/>
|
||||
<HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler" testname="HTTP Join" enabled="true">
|
||||
<stringProp name="HTTPSampler.path"></stringProp>
|
||||
<stringProp name="HTTPSampler.method">POST</stringProp>
|
||||
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
|
||||
<stringProp name="HTTPSampler.protocol"></stringProp>
|
||||
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
|
||||
<stringProp name="HTTPSampler.port"></stringProp>
|
||||
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
|
||||
<collectionProp name="Arguments.arguments">
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">join</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">ajax</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">Elvis${__threadNum}</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">message</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">${__javaScript(${__threadNum}%${rooms},room)}</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">room</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
</collectionProp>
|
||||
</elementProp>
|
||||
<stringProp name="HTTPSampler.mimetype"></stringProp>
|
||||
<stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
|
||||
<stringProp name="HTTPSampler.monitor">false</stringProp>
|
||||
<stringProp name="HTTPSampler.domain"></stringProp>
|
||||
<stringProp name="HTTPSampler.FILE_NAME"></stringProp>
|
||||
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
|
||||
</HTTPSampler>
|
||||
<hashTree/>
|
||||
<LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
|
||||
<intProp name="LoopController.loops">-1</intProp>
|
||||
<boolProp name="LoopController.continue_forever">true</boolProp>
|
||||
</LoopController>
|
||||
<hashTree>
|
||||
<LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
|
||||
<stringProp name="LoopController.loops">${__Random(3,20,random)}</stringProp>
|
||||
<boolProp name="LoopController.continue_forever">true</boolProp>
|
||||
</LoopController>
|
||||
<hashTree>
|
||||
<HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler" testname="HTTP Poll n" enabled="true">
|
||||
<stringProp name="HTTPSampler.path"></stringProp>
|
||||
<stringProp name="HTTPSampler.method">GET</stringProp>
|
||||
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
|
||||
<stringProp name="HTTPSampler.protocol"></stringProp>
|
||||
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
|
||||
<stringProp name="HTTPSampler.port"></stringProp>
|
||||
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
|
||||
<collectionProp name="Arguments.arguments">
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">poll</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">ajax</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">poll</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">message</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">${__Random(3000,10000,poll)}</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">timeout</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">${__javaScript(${__threadNum}%${rooms},room)}</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">room</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
</collectionProp>
|
||||
</elementProp>
|
||||
<stringProp name="HTTPSampler.mimetype"></stringProp>
|
||||
<stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
|
||||
<stringProp name="HTTPSampler.monitor">false</stringProp>
|
||||
<stringProp name="HTTPSampler.domain"></stringProp>
|
||||
<stringProp name="HTTPSampler.FILE_NAME"></stringProp>
|
||||
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
|
||||
</HTTPSampler>
|
||||
<hashTree/>
|
||||
</hashTree>
|
||||
<HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler" testname="HTTP chat" enabled="true">
|
||||
<stringProp name="HTTPSampler.path"></stringProp>
|
||||
<stringProp name="HTTPSampler.method">POST</stringProp>
|
||||
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
|
||||
<stringProp name="HTTPSampler.protocol"></stringProp>
|
||||
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
|
||||
<stringProp name="HTTPSampler.port"></stringProp>
|
||||
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
|
||||
<collectionProp name="Arguments.arguments">
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">chat</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">ajax</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">Give me ${__Random(1,200,mars)} deep fried mars bars</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">message</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">${__javaScript(${__threadNum}%${rooms},room)}</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">room</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
</collectionProp>
|
||||
</elementProp>
|
||||
<stringProp name="HTTPSampler.mimetype"></stringProp>
|
||||
<stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
|
||||
<stringProp name="HTTPSampler.monitor">false</stringProp>
|
||||
<stringProp name="HTTPSampler.domain"></stringProp>
|
||||
<stringProp name="HTTPSampler.FILE_NAME"></stringProp>
|
||||
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
|
||||
</HTTPSampler>
|
||||
<hashTree/>
|
||||
</hashTree>
|
||||
<HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler" testname="HTTP Leave" enabled="true">
|
||||
<stringProp name="HTTPSampler.path"></stringProp>
|
||||
<stringProp name="HTTPSampler.method">POST</stringProp>
|
||||
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
|
||||
<stringProp name="HTTPSampler.protocol"></stringProp>
|
||||
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
|
||||
<stringProp name="HTTPSampler.port"></stringProp>
|
||||
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
|
||||
<collectionProp name="Arguments.arguments">
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">leave</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">ajax</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">Elvis${__threadNum}</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">message</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
<elementProp name="" elementType="HTTPArgument">
|
||||
<stringProp name="Argument.metadata">=</stringProp>
|
||||
<stringProp name="Argument.value">${__javaScript(${__threadNum}%${rooms},room)}</stringProp>
|
||||
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
||||
<stringProp name="Argument.name">room</stringProp>
|
||||
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
||||
</elementProp>
|
||||
</collectionProp>
|
||||
</elementProp>
|
||||
<stringProp name="HTTPSampler.mimetype"></stringProp>
|
||||
<stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
|
||||
<stringProp name="HTTPSampler.monitor">false</stringProp>
|
||||
<stringProp name="HTTPSampler.domain"></stringProp>
|
||||
<stringProp name="HTTPSampler.FILE_NAME"></stringProp>
|
||||
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
|
||||
</HTTPSampler>
|
||||
<hashTree/>
|
||||
</hashTree>
|
||||
<ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" enabled="true">
|
||||
<objProp>
|
||||
<value class="SampleSaveConfiguration">
|
||||
<time>true</time>
|
||||
<latency>true</latency>
|
||||
<timestamp>true</timestamp>
|
||||
<success>true</success>
|
||||
<label>true</label>
|
||||
<code>true</code>
|
||||
<message>true</message>
|
||||
<threadName>true</threadName>
|
||||
<dataType>true</dataType>
|
||||
<encoding>false</encoding>
|
||||
<assertions>true</assertions>
|
||||
<subresults>true</subresults>
|
||||
<responseData>false</responseData>
|
||||
<samplerData>false</samplerData>
|
||||
<xml>false</xml>
|
||||
<fieldNames>false</fieldNames>
|
||||
<responseHeaders>false</responseHeaders>
|
||||
<requestHeaders>false</requestHeaders>
|
||||
<responseDataOnError>false</responseDataOnError>
|
||||
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
|
||||
<assertionsResultsToSave>0</assertionsResultsToSave>
|
||||
</value>
|
||||
<name>saveConfig</name>
|
||||
</objProp>
|
||||
<stringProp name="filename"></stringProp>
|
||||
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
||||
</ResultCollector>
|
||||
<hashTree/>
|
||||
</hashTree>
|
||||
</hashTree>
|
||||
</jmeterTestPlan>
|
|
@ -0,0 +1,237 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
// ========================================================================
|
||||
// Copyright (c) Webtide LLC
|
||||
//
|
||||
// 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.apache.org/licenses/LICENSE-2.0.txt
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
-->
|
||||
<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.tests</groupId>
|
||||
<artifactId>test-webapps-parent</artifactId>
|
||||
<version>9.0.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>test-proxy-webapp</artifactId>
|
||||
<name>Test :: Jetty Proxy Webapp</name>
|
||||
<packaging>war</packaging>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>test</id>
|
||||
<phase>test</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>**/WebAppTest.java</exclude>
|
||||
<exclude>**/Test*.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>config</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/web-bundle.xml</descriptor>
|
||||
</descriptors>
|
||||
<archive>
|
||||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- also make this webapp an osgi bundle -->
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<supportedProjectTypes>
|
||||
<supportedProjectType>war</supportedProjectType>
|
||||
</supportedProjectTypes>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>bundle-manifest</id>
|
||||
<phase>process-classes</phase>
|
||||
<goals>
|
||||
<goal>manifest</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Bundle-SymbolicName>org.eclipse.jetty.test-jetty-webapp</Bundle-SymbolicName>
|
||||
<Import-Package>javax.servlet.jsp.*;version="2.2.0",javax.servlet.*;version="[2.6,3.0)",org.eclipse.jetty.*;version="9.0",*</Import-Package>
|
||||
<Export-Package>!com.acme*</Export-Package>
|
||||
<!-- the test webapp is configured via a jetty xml file
|
||||
in order to add the security handler. -->
|
||||
<Web-ContextPath>/</Web-ContextPath>
|
||||
<!-- in fact the '.' must not be there
|
||||
but Felix-BND has a bug:
|
||||
http://www.mail-archive.com/users@felix.apache.org/msg04730.html
|
||||
https://issues.apache.org/jira/browse/FELIX-1571
|
||||
-->
|
||||
<Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<stopPort>8087</stopPort>
|
||||
<stopKey>foo</stopKey>
|
||||
<scanIntervalSeconds>1</scanIntervalSeconds>
|
||||
<systemProperties>
|
||||
<systemProperty>
|
||||
<name>fooprop</name>
|
||||
<value>222</value>
|
||||
</systemProperty>
|
||||
</systemProperties>
|
||||
<!-- useTestScope>true</useTestScope -->
|
||||
<webAppConfig>
|
||||
<contextPath>/test</contextPath>
|
||||
<tempDirectory>${project.build.directory}/work</tempDirectory>
|
||||
<sessionHandler implementation="org.eclipse.jetty.server.session.SessionHandler">
|
||||
<sessionManager implementation="org.eclipse.jetty.server.session.HashSessionManager">
|
||||
<storeDirectory>${basedir}/target/sessions</storeDirectory>
|
||||
</sessionManager>
|
||||
</sessionHandler>
|
||||
</webAppConfig>
|
||||
<loginServices>
|
||||
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
|
||||
<name>Test Realm</name>
|
||||
<config>src/main/config/etc/realm.properties</config>
|
||||
</loginService>
|
||||
</loginServices>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- uncomment to precompile jsps -->
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-jspc-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>jspc</id>
|
||||
<goals>
|
||||
<goal>jspc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<includes>**/*.foo</includes>
|
||||
<excludes>**/*.fff</excludes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<webXml>${basedir}/target/web.xml</webXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
-->
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-proxy</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.orbit</groupId>
|
||||
<artifactId>javax.servlet</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-webapp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-jmx</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-test-helper</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet.jsp</groupId>
|
||||
<artifactId>jsp-api</artifactId>
|
||||
<version>2.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-http-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
<version>1.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
|
||||
|
||||
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
|
||||
<Set name="contextPath">/javadoc</Set>
|
||||
</Configure>
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<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_3_0.xsd"
|
||||
metadata-complete="false"
|
||||
version="3.0">
|
||||
|
||||
<display-name>Transparent Proxy WebApp</display-name>
|
||||
|
||||
|
||||
<servlet>
|
||||
<servlet-name>TransparentProxy</servlet-name>
|
||||
<servlet-class>org.eclipse.jetty.proxy.ProxyServlet$Transparent</servlet-class>
|
||||
<init-param>
|
||||
<param-name>proxyTo</param-name><param-value>http://download.eclipse.org/jetty/stable-9/apidocs</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>hostHeader</param-name><param-value>download.eclipse.org</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
<async-supported>true</async-supported>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>TransparentProxy</servlet-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
</web-app>
|
||||
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// 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;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
|
||||
import org.eclipse.jetty.jmx.MBeanContainer;
|
||||
import org.eclipse.jetty.server.ForwardedRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
import org.eclipse.jetty.server.SslConnectionFactory;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
|
||||
import org.eclipse.jetty.server.handler.DefaultHandler;
|
||||
import org.eclipse.jetty.server.handler.HandlerCollection;
|
||||
import org.eclipse.jetty.server.handler.ResourceHandler;
|
||||
import org.eclipse.jetty.spdy.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.server.SPDYServerConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.server.http.PushStrategy;
|
||||
import org.eclipse.jetty.spdy.server.http.ReferrerPushStrategy;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.StdErrLog;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
import org.junit.Ignore;
|
||||
|
||||
@Ignore("Not a test case")
|
||||
public class TestTransparentProxyServer
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
((StdErrLog)Log.getLog()).setSource(false);
|
||||
|
||||
String jetty_root = "../../..";
|
||||
|
||||
// Setup Threadpool
|
||||
QueuedThreadPool threadPool = new QueuedThreadPool();
|
||||
threadPool.setMaxThreads(100);
|
||||
|
||||
// Setup server
|
||||
Server server = new Server(threadPool);
|
||||
server.manage(threadPool);
|
||||
server.setSendDateHeader(true);
|
||||
|
||||
// Setup JMX
|
||||
MBeanContainer mbContainer=new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
|
||||
server.addBean(mbContainer);
|
||||
server.addBean(Log.getLog());
|
||||
|
||||
|
||||
// Common HTTP configuration
|
||||
HttpConfiguration config = new HttpConfiguration();
|
||||
config.setSecurePort(8443);
|
||||
config.addCustomizer(new ForwardedRequestCustomizer());
|
||||
config.addCustomizer(new SecureRequestCustomizer());
|
||||
|
||||
|
||||
// Http Connector
|
||||
HttpConnectionFactory http = new HttpConnectionFactory(config);
|
||||
ServerConnector httpConnector = new ServerConnector(server,http);
|
||||
httpConnector.setPort(8080);
|
||||
httpConnector.setIdleTimeout(30000);
|
||||
server.addConnector(httpConnector);
|
||||
|
||||
|
||||
// SSL configurations
|
||||
SslContextFactory sslContextFactory = new SslContextFactory();
|
||||
sslContextFactory.setKeyStorePath(jetty_root + "/jetty-server/src/main/config/etc/keystore");
|
||||
sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
|
||||
sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
|
||||
sslContextFactory.setTrustStorePath(jetty_root + "/jetty-server/src/main/config/etc/keystore");
|
||||
sslContextFactory.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
|
||||
sslContextFactory.setExcludeCipherSuites(
|
||||
"SSL_RSA_WITH_DES_CBC_SHA",
|
||||
"SSL_DHE_RSA_WITH_DES_CBC_SHA",
|
||||
"SSL_DHE_DSS_WITH_DES_CBC_SHA",
|
||||
"SSL_RSA_EXPORT_WITH_RC4_40_MD5",
|
||||
"SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
|
||||
"SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
|
||||
"SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA");
|
||||
|
||||
|
||||
// Spdy Connector
|
||||
SPDYServerConnectionFactory.checkNPNAvailable();
|
||||
PushStrategy push = new ReferrerPushStrategy();
|
||||
HTTPSPDYServerConnectionFactory spdy2 = new HTTPSPDYServerConnectionFactory(2,config,push);
|
||||
spdy2.setInputBufferSize(8192);
|
||||
spdy2.setInitialWindowSize(32768);
|
||||
HTTPSPDYServerConnectionFactory spdy3 = new HTTPSPDYServerConnectionFactory(3,config,push);
|
||||
spdy2.setInputBufferSize(8192);
|
||||
NPNServerConnectionFactory npn = new NPNServerConnectionFactory(spdy3.getProtocol(),spdy2.getProtocol(),http.getProtocol());
|
||||
npn.setDefaultProtocol(http.getProtocol());
|
||||
npn.setInputBufferSize(1024);
|
||||
SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory,npn.getProtocol());
|
||||
ServerConnector spdyConnector = new ServerConnector(server,ssl,npn,spdy3,spdy2,http);
|
||||
spdyConnector.setPort(8443);
|
||||
spdyConnector.setIdleTimeout(15000);
|
||||
server.addConnector(spdyConnector);
|
||||
|
||||
// Handlers
|
||||
HandlerCollection handlers = new HandlerCollection();
|
||||
ContextHandlerCollection contexts = new ContextHandlerCollection();
|
||||
handlers.setHandlers(new Handler[]
|
||||
{ contexts, new DefaultHandler() });
|
||||
|
||||
server.setHandler(handlers);
|
||||
|
||||
// Setup proxy webapp
|
||||
WebAppContext webapp = new WebAppContext();
|
||||
webapp.setResourceBase("src/main/webapp");
|
||||
contexts.addHandler(webapp);
|
||||
|
||||
// start server
|
||||
server.setStopAtShutdown(true);
|
||||
server.setSendServerVersion(true);
|
||||
server.start();
|
||||
server.join();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue