Merge remote-tracking branch 'origin/master' into jetty-http2
Conflicts: jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextDispatchWithQueryStrings.java
This commit is contained in:
commit
fa3d7d0f7e
|
@ -441,14 +441,14 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
|||
|
||||
// Resolve container initializers
|
||||
List<ContainerInitializer> initializers =
|
||||
(List<ContainerInitializer>)context.getAttribute(AnnotationConfiguration.CONTAINER_INITIALIZERS);
|
||||
(List<ContainerInitializer>)context.getAttribute(AnnotationConfiguration.CONTAINER_INITIALIZERS);
|
||||
if (initializers != null && initializers.size()>0)
|
||||
{
|
||||
Map<String, Set<String>> map = ( Map<String, Set<String>>) context.getAttribute(AnnotationConfiguration.CLASS_INHERITANCE_MAP);
|
||||
if (map == null)
|
||||
LOG.warn ("ServletContainerInitializers: detected. Class hierarchy: empty");
|
||||
for (ContainerInitializer i : initializers)
|
||||
i.resolveClasses(context,map);
|
||||
i.resolveClasses(context,map);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1049,9 +1049,9 @@ public class SslBytesServerTest extends SslBytesTest
|
|||
@Test
|
||||
public void testRequestWithBigContentWriteBlockedThenReset() throws Exception
|
||||
{
|
||||
// Don't run on Windows (buggy JVM)
|
||||
Assume.assumeTrue(!OS.IS_WINDOWS);
|
||||
|
||||
// Don't run on Windows (buggy JVM)
|
||||
Assume.assumeTrue(!OS.IS_WINDOWS);
|
||||
|
||||
final SSLSocket client = newClient();
|
||||
|
||||
SimpleProxy.AutomaticFlow automaticProxyFlow = proxy.startAutomaticFlow();
|
||||
|
@ -1110,10 +1110,10 @@ public class SslBytesServerTest extends SslBytesTest
|
|||
@Test
|
||||
public void testRequestWithBigContentReadBlockedThenReset() throws Exception
|
||||
{
|
||||
// Don't run on Windows (buggy JVM)
|
||||
Assume.assumeTrue(!OS.IS_WINDOWS);
|
||||
|
||||
final SSLSocket client = newClient();
|
||||
// Don't run on Windows (buggy JVM)
|
||||
Assume.assumeTrue(!OS.IS_WINDOWS);
|
||||
|
||||
final SSLSocket client = newClient();
|
||||
|
||||
SimpleProxy.AutomaticFlow automaticProxyFlow = proxy.startAutomaticFlow();
|
||||
client.startHandshake();
|
||||
|
|
|
@ -36,10 +36,10 @@ import org.junit.Test;
|
|||
*/
|
||||
public class AppLifeCycleTest
|
||||
{
|
||||
@Rule
|
||||
public TestingDir testdir = new TestingDir();
|
||||
@Rule
|
||||
public TestingDir testdir = new TestingDir();
|
||||
|
||||
private void assertNoPath(String from, String to)
|
||||
private void assertNoPath(String from, String to)
|
||||
{
|
||||
assertPath(from,to,new ArrayList<String>());
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ import org.junit.Test;
|
|||
*/
|
||||
public class ScanningAppProviderStartupTest
|
||||
{
|
||||
@Rule
|
||||
public TestingDir testdir = new TestingDir();
|
||||
@Rule
|
||||
public TestingDir testdir = new TestingDir();
|
||||
private static XmlConfiguredJetty jetty;
|
||||
|
||||
@Before
|
||||
|
|
|
@ -97,8 +97,8 @@ public class JettyHttpContext extends com.sun.net.httpserver.HttpContext
|
|||
@Override
|
||||
public Authenticator setAuthenticator(Authenticator auth)
|
||||
{
|
||||
Authenticator previous = _authenticator;
|
||||
_authenticator = auth;
|
||||
Authenticator previous = _authenticator;
|
||||
_authenticator = auth;
|
||||
return previous;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,271 +1,271 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2014 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.http.spi;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.NetworkConnector;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
|
||||
import org.eclipse.jetty.server.handler.HandlerCollection;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.thread.ThreadPool;
|
||||
|
||||
import com.sun.net.httpserver.HttpContext;
|
||||
import com.sun.net.httpserver.HttpHandler;
|
||||
|
||||
/**
|
||||
* Jetty implementation of {@link com.sun.net.httpserver.HttpServer}.
|
||||
*/
|
||||
public class JettyHttpServer extends com.sun.net.httpserver.HttpServer
|
||||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2014 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.http.spi;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.NetworkConnector;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
|
||||
import org.eclipse.jetty.server.handler.HandlerCollection;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.thread.ThreadPool;
|
||||
|
||||
import com.sun.net.httpserver.HttpContext;
|
||||
import com.sun.net.httpserver.HttpHandler;
|
||||
|
||||
/**
|
||||
* Jetty implementation of {@link com.sun.net.httpserver.HttpServer}.
|
||||
*/
|
||||
public class JettyHttpServer extends com.sun.net.httpserver.HttpServer
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(JettyHttpServer.class);
|
||||
|
||||
|
||||
private Server _server;
|
||||
|
||||
private boolean _serverShared;
|
||||
|
||||
private InetSocketAddress _addr;
|
||||
|
||||
private ThreadPoolExecutor _executor;
|
||||
|
||||
private Map<String, JettyHttpContext> _contexts = new HashMap<String, JettyHttpContext>();
|
||||
|
||||
private Map<String, Connector> _connectors = new HashMap<String, Connector>();
|
||||
|
||||
|
||||
public JettyHttpServer(Server server, boolean shared)
|
||||
{
|
||||
this._server = server;
|
||||
this._serverShared = shared;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(InetSocketAddress addr, int backlog) throws IOException
|
||||
{
|
||||
// check if there is already a connector listening
|
||||
Collection<NetworkConnector> connectors = _server.getBeans(NetworkConnector.class);
|
||||
if (connectors != null)
|
||||
{
|
||||
for (NetworkConnector connector : connectors)
|
||||
{
|
||||
if (connector.getPort() == addr.getPort()) {
|
||||
if (LOG.isDebugEnabled()) LOG.debug("server already bound to port " + addr.getPort() + ", no need to rebind");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_serverShared)
|
||||
throw new IOException("jetty server is not bound to port " + addr.getPort());
|
||||
|
||||
this._addr = addr;
|
||||
|
||||
if (LOG.isDebugEnabled()) LOG.debug("binding server to port " + addr.getPort());
|
||||
ServerConnector connector = new ServerConnector(_server);
|
||||
connector.setPort(addr.getPort());
|
||||
connector.setHost(addr.getHostName());
|
||||
_server.addConnector(connector);
|
||||
|
||||
_connectors.put(addr.getHostName() + addr.getPort(), connector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress getAddress()
|
||||
{
|
||||
return _addr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
if (_serverShared) return;
|
||||
|
||||
try
|
||||
{
|
||||
_server.start();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExecutor(Executor executor)
|
||||
{
|
||||
if (executor == null)
|
||||
throw new IllegalArgumentException("missing required 'executor' argument");
|
||||
ThreadPool threadPool = _server.getThreadPool();
|
||||
if (threadPool instanceof DelegatingThreadPool)
|
||||
((DelegatingThreadPool)_server.getThreadPool()).setExecutor(executor);
|
||||
else
|
||||
throw new UnsupportedOperationException("!DelegatingThreadPool");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Executor getExecutor()
|
||||
{
|
||||
ThreadPool threadPool = _server.getThreadPool();
|
||||
if (threadPool instanceof DelegatingThreadPool)
|
||||
return ((DelegatingThreadPool)_server.getThreadPool()).getExecutor();
|
||||
return threadPool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(int delay)
|
||||
{
|
||||
cleanUpContexts();
|
||||
cleanUpConnectors();
|
||||
|
||||
if (_serverShared) return;
|
||||
|
||||
try
|
||||
{
|
||||
_server.stop();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanUpContexts()
|
||||
{
|
||||
for (Map.Entry<String, JettyHttpContext> stringJettyHttpContextEntry : _contexts.entrySet())
|
||||
{
|
||||
JettyHttpContext context = stringJettyHttpContextEntry.getValue();
|
||||
_server.removeBean(context.getJettyContextHandler());
|
||||
}
|
||||
_contexts.clear();
|
||||
}
|
||||
|
||||
private void cleanUpConnectors()
|
||||
{
|
||||
for (Map.Entry<String, Connector> stringConnectorEntry : _connectors.entrySet())
|
||||
{
|
||||
Connector connector = stringConnectorEntry.getValue();
|
||||
try
|
||||
{
|
||||
connector.stop();
|
||||
} catch (Exception ex) {
|
||||
LOG.warn(ex);
|
||||
}
|
||||
_server.removeConnector(connector);
|
||||
}
|
||||
_connectors.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpContext createContext(String path, HttpHandler httpHandler)
|
||||
{
|
||||
checkIfContextIsFree(path);
|
||||
|
||||
JettyHttpContext context = new JettyHttpContext(this, path, httpHandler);
|
||||
HttpSpiContextHandler jettyContextHandler = context.getJettyContextHandler();
|
||||
|
||||
ContextHandlerCollection chc = findContextHandlerCollection(_server.getHandlers());
|
||||
if (chc == null)
|
||||
throw new RuntimeException("could not find ContextHandlerCollection, you must configure one");
|
||||
|
||||
chc.addHandler(jettyContextHandler);
|
||||
_contexts.put(path, context);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
private ContextHandlerCollection findContextHandlerCollection(Handler[] handlers)
|
||||
{
|
||||
if (handlers == null)
|
||||
return null;
|
||||
|
||||
for (Handler handler : handlers)
|
||||
{
|
||||
if (handler instanceof ContextHandlerCollection)
|
||||
{
|
||||
return (ContextHandlerCollection) handler;
|
||||
}
|
||||
|
||||
if (handler instanceof HandlerCollection)
|
||||
{
|
||||
HandlerCollection hc = (HandlerCollection) handler;
|
||||
ContextHandlerCollection chc = findContextHandlerCollection(hc.getHandlers());
|
||||
if (chc != null)
|
||||
return chc;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void checkIfContextIsFree(String path)
|
||||
{
|
||||
Handler serverHandler = _server.getHandler();
|
||||
if (serverHandler instanceof ContextHandler)
|
||||
{
|
||||
ContextHandler ctx = (ContextHandler) serverHandler;
|
||||
if (ctx.getContextPath().equals(path))
|
||||
throw new RuntimeException("another context already bound to path " + path);
|
||||
}
|
||||
|
||||
Handler[] handlers = _server.getHandlers();
|
||||
if (handlers == null) return;
|
||||
|
||||
for (Handler handler : handlers)
|
||||
{
|
||||
if (handler instanceof ContextHandler) {
|
||||
ContextHandler ctx = (ContextHandler) handler;
|
||||
if (ctx.getContextPath().equals(path))
|
||||
throw new RuntimeException("another context already bound to path " + path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpContext createContext(String path)
|
||||
{
|
||||
return createContext(path, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeContext(String path) throws IllegalArgumentException
|
||||
{
|
||||
JettyHttpContext context = _contexts.remove(path);
|
||||
if (context == null) return;
|
||||
_server.removeBean(context.getJettyContextHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeContext(HttpContext context)
|
||||
{
|
||||
removeContext(context.getPath());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private Server _server;
|
||||
|
||||
private boolean _serverShared;
|
||||
|
||||
private InetSocketAddress _addr;
|
||||
|
||||
private ThreadPoolExecutor _executor;
|
||||
|
||||
private Map<String, JettyHttpContext> _contexts = new HashMap<String, JettyHttpContext>();
|
||||
|
||||
private Map<String, Connector> _connectors = new HashMap<String, Connector>();
|
||||
|
||||
|
||||
public JettyHttpServer(Server server, boolean shared)
|
||||
{
|
||||
this._server = server;
|
||||
this._serverShared = shared;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(InetSocketAddress addr, int backlog) throws IOException
|
||||
{
|
||||
// check if there is already a connector listening
|
||||
Collection<NetworkConnector> connectors = _server.getBeans(NetworkConnector.class);
|
||||
if (connectors != null)
|
||||
{
|
||||
for (NetworkConnector connector : connectors)
|
||||
{
|
||||
if (connector.getPort() == addr.getPort()) {
|
||||
if (LOG.isDebugEnabled()) LOG.debug("server already bound to port " + addr.getPort() + ", no need to rebind");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_serverShared)
|
||||
throw new IOException("jetty server is not bound to port " + addr.getPort());
|
||||
|
||||
this._addr = addr;
|
||||
|
||||
if (LOG.isDebugEnabled()) LOG.debug("binding server to port " + addr.getPort());
|
||||
ServerConnector connector = new ServerConnector(_server);
|
||||
connector.setPort(addr.getPort());
|
||||
connector.setHost(addr.getHostName());
|
||||
_server.addConnector(connector);
|
||||
|
||||
_connectors.put(addr.getHostName() + addr.getPort(), connector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress getAddress()
|
||||
{
|
||||
return _addr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
if (_serverShared) return;
|
||||
|
||||
try
|
||||
{
|
||||
_server.start();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExecutor(Executor executor)
|
||||
{
|
||||
if (executor == null)
|
||||
throw new IllegalArgumentException("missing required 'executor' argument");
|
||||
ThreadPool threadPool = _server.getThreadPool();
|
||||
if (threadPool instanceof DelegatingThreadPool)
|
||||
((DelegatingThreadPool)_server.getThreadPool()).setExecutor(executor);
|
||||
else
|
||||
throw new UnsupportedOperationException("!DelegatingThreadPool");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Executor getExecutor()
|
||||
{
|
||||
ThreadPool threadPool = _server.getThreadPool();
|
||||
if (threadPool instanceof DelegatingThreadPool)
|
||||
return ((DelegatingThreadPool)_server.getThreadPool()).getExecutor();
|
||||
return threadPool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(int delay)
|
||||
{
|
||||
cleanUpContexts();
|
||||
cleanUpConnectors();
|
||||
|
||||
if (_serverShared) return;
|
||||
|
||||
try
|
||||
{
|
||||
_server.stop();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanUpContexts()
|
||||
{
|
||||
for (Map.Entry<String, JettyHttpContext> stringJettyHttpContextEntry : _contexts.entrySet())
|
||||
{
|
||||
JettyHttpContext context = stringJettyHttpContextEntry.getValue();
|
||||
_server.removeBean(context.getJettyContextHandler());
|
||||
}
|
||||
_contexts.clear();
|
||||
}
|
||||
|
||||
private void cleanUpConnectors()
|
||||
{
|
||||
for (Map.Entry<String, Connector> stringConnectorEntry : _connectors.entrySet())
|
||||
{
|
||||
Connector connector = stringConnectorEntry.getValue();
|
||||
try
|
||||
{
|
||||
connector.stop();
|
||||
} catch (Exception ex) {
|
||||
LOG.warn(ex);
|
||||
}
|
||||
_server.removeConnector(connector);
|
||||
}
|
||||
_connectors.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpContext createContext(String path, HttpHandler httpHandler)
|
||||
{
|
||||
checkIfContextIsFree(path);
|
||||
|
||||
JettyHttpContext context = new JettyHttpContext(this, path, httpHandler);
|
||||
HttpSpiContextHandler jettyContextHandler = context.getJettyContextHandler();
|
||||
|
||||
ContextHandlerCollection chc = findContextHandlerCollection(_server.getHandlers());
|
||||
if (chc == null)
|
||||
throw new RuntimeException("could not find ContextHandlerCollection, you must configure one");
|
||||
|
||||
chc.addHandler(jettyContextHandler);
|
||||
_contexts.put(path, context);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
private ContextHandlerCollection findContextHandlerCollection(Handler[] handlers)
|
||||
{
|
||||
if (handlers == null)
|
||||
return null;
|
||||
|
||||
for (Handler handler : handlers)
|
||||
{
|
||||
if (handler instanceof ContextHandlerCollection)
|
||||
{
|
||||
return (ContextHandlerCollection) handler;
|
||||
}
|
||||
|
||||
if (handler instanceof HandlerCollection)
|
||||
{
|
||||
HandlerCollection hc = (HandlerCollection) handler;
|
||||
ContextHandlerCollection chc = findContextHandlerCollection(hc.getHandlers());
|
||||
if (chc != null)
|
||||
return chc;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void checkIfContextIsFree(String path)
|
||||
{
|
||||
Handler serverHandler = _server.getHandler();
|
||||
if (serverHandler instanceof ContextHandler)
|
||||
{
|
||||
ContextHandler ctx = (ContextHandler) serverHandler;
|
||||
if (ctx.getContextPath().equals(path))
|
||||
throw new RuntimeException("another context already bound to path " + path);
|
||||
}
|
||||
|
||||
Handler[] handlers = _server.getHandlers();
|
||||
if (handlers == null) return;
|
||||
|
||||
for (Handler handler : handlers)
|
||||
{
|
||||
if (handler instanceof ContextHandler) {
|
||||
ContextHandler ctx = (ContextHandler) handler;
|
||||
if (ctx.getContextPath().equals(path))
|
||||
throw new RuntimeException("another context already bound to path " + path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpContext createContext(String path)
|
||||
{
|
||||
return createContext(path, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeContext(String path) throws IllegalArgumentException
|
||||
{
|
||||
JettyHttpContext context = _contexts.remove(path);
|
||||
if (context == null) return;
|
||||
_server.removeBean(context.getJettyContextHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeContext(HttpContext context)
|
||||
{
|
||||
removeContext(context.getPath());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class JettyHttpServerProvider extends HttpServerProvider
|
|||
|
||||
public static void setServer(Server server)
|
||||
{
|
||||
_server = server;
|
||||
_server = server;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,7 +51,7 @@ public class JettyHttpServerProvider extends HttpServerProvider
|
|||
throws IOException
|
||||
{
|
||||
Server server = _server;
|
||||
boolean shared = true;
|
||||
boolean shared = true;
|
||||
|
||||
if (server == null)
|
||||
{
|
||||
|
|
|
@ -210,7 +210,7 @@ public class JAASLoginService extends AbstractLifeCycle implements LoginService
|
|||
}
|
||||
else if (callback instanceof RequestParameterCallback)
|
||||
{
|
||||
HttpChannel channel = HttpChannel.getCurrentHttpChannel();
|
||||
HttpChannel channel = HttpChannel.getCurrentHttpChannel();
|
||||
|
||||
if (channel == null)
|
||||
return;
|
||||
|
|
|
@ -82,23 +82,23 @@ public class ConnectorServer extends AbstractLifeCycle
|
|||
public ConnectorServer(JMXServiceURL svcUrl, Map<String,?> environment, String name)
|
||||
throws Exception
|
||||
{
|
||||
String urlPath = svcUrl.getURLPath();
|
||||
int idx = urlPath.indexOf("rmi://");
|
||||
if (idx > 0)
|
||||
{
|
||||
String hostPort = urlPath.substring(idx+6, urlPath.indexOf('/', idx+6));
|
||||
String regHostPort = startRegistry(hostPort);
|
||||
if (regHostPort != null) {
|
||||
urlPath = urlPath.replace(hostPort,regHostPort);
|
||||
svcUrl = new JMXServiceURL(svcUrl.getProtocol(), svcUrl.getHost(), svcUrl.getPort(), urlPath);
|
||||
}
|
||||
}
|
||||
String urlPath = svcUrl.getURLPath();
|
||||
int idx = urlPath.indexOf("rmi://");
|
||||
if (idx > 0)
|
||||
{
|
||||
String hostPort = urlPath.substring(idx+6, urlPath.indexOf('/', idx+6));
|
||||
String regHostPort = startRegistry(hostPort);
|
||||
if (regHostPort != null) {
|
||||
urlPath = urlPath.replace(hostPort,regHostPort);
|
||||
svcUrl = new JMXServiceURL(svcUrl.getProtocol(), svcUrl.getHost(), svcUrl.getPort(), urlPath);
|
||||
}
|
||||
}
|
||||
MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
|
||||
_connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(svcUrl, environment, mbeanServer);
|
||||
mbeanServer.registerMBean(_connectorServer,new ObjectName(name));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
|
||||
*/
|
||||
|
|
|
@ -139,7 +139,7 @@ public class JettyWebAppContext extends WebAppContext
|
|||
}
|
||||
public void setContainerIncludeJarPattern(String pattern)
|
||||
{
|
||||
_containerIncludeJarPattern = pattern;
|
||||
_containerIncludeJarPattern = pattern;
|
||||
}
|
||||
|
||||
public String getContainerIncludeJarPattern()
|
||||
|
@ -150,7 +150,7 @@ public class JettyWebAppContext extends WebAppContext
|
|||
|
||||
public String getWebInfIncludeJarPattern()
|
||||
{
|
||||
return _webInfIncludeJarPattern;
|
||||
return _webInfIncludeJarPattern;
|
||||
}
|
||||
public void setWebInfIncludeJarPattern(String pattern)
|
||||
{
|
||||
|
|
|
@ -82,7 +82,7 @@ public class ServiceConnection
|
|||
*/
|
||||
public String getServiceUrl()
|
||||
{
|
||||
return _serviceUrl;
|
||||
return _serviceUrl;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -207,7 +207,7 @@ public class NoSqlSession extends MemSession
|
|||
/* ------------------------------------------------------------ */
|
||||
public Object getVersion()
|
||||
{
|
||||
return _version;
|
||||
return _version;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -654,7 +654,7 @@ public class MongoSessionManager extends NoSqlSessionManager
|
|||
/*------------------------------------------------------------ */
|
||||
private String getContextKey()
|
||||
{
|
||||
return __CONTEXT + "." + _contextId;
|
||||
return __CONTEXT + "." + _contextId;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------ */
|
||||
|
@ -664,7 +664,7 @@ public class MongoSessionManager extends NoSqlSessionManager
|
|||
*/
|
||||
private String getContextAttributeKey(String attr)
|
||||
{
|
||||
return getContextKey()+ "." + attr;
|
||||
return getContextKey()+ "." + attr;
|
||||
}
|
||||
|
||||
@ManagedOperation(value="purge invalid sessions in the session store based on normal criteria", impact="ACTION")
|
||||
|
|
|
@ -30,16 +30,16 @@ import javax.servlet.http.HttpServlet;
|
|||
*/
|
||||
public class HttpServiceErrorHandlerHelper
|
||||
{
|
||||
private static HttpServlet _customErrorHandler;
|
||||
private static HttpServlet _customErrorHandler;
|
||||
|
||||
public static HttpServlet getCustomErrorHandler()
|
||||
{
|
||||
return _customErrorHandler;
|
||||
}
|
||||
|
||||
public static void setHttpServiceErrorHandler(HttpServlet servlet)
|
||||
{
|
||||
_customErrorHandler = servlet;
|
||||
}
|
||||
|
||||
public static HttpServlet getCustomErrorHandler()
|
||||
{
|
||||
return _customErrorHandler;
|
||||
}
|
||||
|
||||
public static void setHttpServiceErrorHandler(HttpServlet servlet)
|
||||
{
|
||||
_customErrorHandler = servlet;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,46 +35,46 @@ import org.eclipse.jetty.servlet.ErrorPageErrorHandler;
|
|||
public class HttpServiceErrorPageErrorHandler extends ErrorPageErrorHandler
|
||||
{
|
||||
|
||||
private static HttpServiceErrorPageErrorHandler INSTANCE;
|
||||
|
||||
public static HttpServiceErrorPageErrorHandler getInstance()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public HttpServiceErrorPageErrorHandler()
|
||||
{
|
||||
INSTANCE = this;
|
||||
}
|
||||
private static HttpServiceErrorPageErrorHandler INSTANCE;
|
||||
|
||||
public static HttpServiceErrorPageErrorHandler getInstance()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public HttpServiceErrorPageErrorHandler()
|
||||
{
|
||||
INSTANCE = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(String target, Request baseRequest,
|
||||
HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
if (HttpServiceErrorHandlerHelper.getCustomErrorHandler() != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpServiceErrorHandlerHelper.getCustomErrorHandler().service(request, response);
|
||||
}
|
||||
catch (ServletException e)
|
||||
{
|
||||
//well
|
||||
}
|
||||
}
|
||||
if (!response.isCommitted())
|
||||
{
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void handle(String target, Request baseRequest,
|
||||
HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
if (HttpServiceErrorHandlerHelper.getCustomErrorHandler() != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpServiceErrorHandlerHelper.getCustomErrorHandler().service(request, response);
|
||||
}
|
||||
catch (ServletException e)
|
||||
{
|
||||
//well
|
||||
}
|
||||
}
|
||||
if (!response.isCommitted())
|
||||
{
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStop() throws Exception
|
||||
{
|
||||
INSTANCE = null;
|
||||
super.doStop();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void doStop() throws Exception
|
||||
{
|
||||
INSTANCE = null;
|
||||
super.doStop();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public class OverlayServer
|
|||
server.setStopAtShutdown(true);
|
||||
//server.setSendServerVersion(true);
|
||||
|
||||
// Uncomment to work with JNDI examples
|
||||
// Uncomment to work with JNDI examples
|
||||
// new org.eclipse.jetty.plus.jndi.Transaction(new com.atomikos.icatch.jta.UserTransactionImp());
|
||||
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ public class ContainerInitializer
|
|||
interested.add(c.getName());
|
||||
}
|
||||
|
||||
return String.format("ContainerInitializer{%s,interested=%s,applicable=%s,annotated=%s}",_target.getClass().getName(),interested,_applicableTypeNames,_annotatedTypeNames);
|
||||
return String.format("ContainerInitializer{%s,interested=%s,applicable=%s,annotated=%s}",_target.getClass().getName(),interested,_applicableTypeNames,_annotatedTypeNames);
|
||||
}
|
||||
|
||||
public void resolveClasses(WebAppContext context, Map<String, Set<String>> classMap)
|
||||
|
|
|
@ -102,7 +102,7 @@ public class GatewayServer extends Server
|
|||
|
||||
public GatewayServer()
|
||||
{
|
||||
this("",DFT_EXT_PATH,DFT_CONNECT_PATH,new StandardTargetIdRetriever());
|
||||
this("",DFT_EXT_PATH,DFT_CONNECT_PATH,new StandardTargetIdRetriever());
|
||||
}
|
||||
|
||||
public GatewayServer(String contextPath, String externalServletPath,String gatewayServletPath, TargetIdRetriever targetIdRetriever)
|
||||
|
@ -145,7 +145,7 @@ public class GatewayServer extends Server
|
|||
|
||||
public Gateway getGateway()
|
||||
{
|
||||
return gateway;
|
||||
return gateway;
|
||||
}
|
||||
|
||||
public ServletHolder getExternalServlet()
|
||||
|
|
|
@ -331,28 +331,28 @@ public class DeferredAuthentication implements Authentication.Deferred
|
|||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getHeaderNames()
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHeader(String arg0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getHeaders(String arg0)
|
||||
{
|
||||
public Collection<String> getHeaderNames()
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatus()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public String getHeader(String arg0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getHeaders(String arg0)
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatus()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -50,7 +50,7 @@ public class SpnegoAuthenticator extends LoginAuthenticator
|
|||
*/
|
||||
public SpnegoAuthenticator( String authMethod )
|
||||
{
|
||||
_authMethod = authMethod;
|
||||
_authMethod = authMethod;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,10 +77,10 @@ public class SpnegoAuthenticator extends LoginAuthenticator
|
|||
{
|
||||
try
|
||||
{
|
||||
if (DeferredAuthentication.isDeferred(res))
|
||||
{
|
||||
if (DeferredAuthentication.isDeferred(res))
|
||||
{
|
||||
return Authentication.UNAUTHENTICATED;
|
||||
}
|
||||
}
|
||||
|
||||
LOG.debug("SpengoAuthenticator: sending challenge");
|
||||
res.setHeader(HttpHeader.WWW_AUTHENTICATE.asString(), HttpHeader.NEGOTIATE.asString());
|
||||
|
|
|
@ -173,64 +173,64 @@ public class ContextHandlerCollection extends HandlerCollection
|
|||
{
|
||||
Handler[] handlers = getHandlers();
|
||||
if (handlers==null || handlers.length==0)
|
||||
return;
|
||||
return;
|
||||
|
||||
HttpChannelState async = baseRequest.getHttpChannelState();
|
||||
if (async.isAsync())
|
||||
{
|
||||
ContextHandler context=async.getContextHandler();
|
||||
if (context!=null)
|
||||
{
|
||||
Handler branch = _contextBranches.get(context);
|
||||
|
||||
if (branch==null)
|
||||
context.handle(target,baseRequest,request, response);
|
||||
else
|
||||
branch.handle(target, baseRequest, request, response);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// data structure which maps a request to a context; first-best match wins
|
||||
// { context path => [ context ] }
|
||||
// }
|
||||
if (target.startsWith("/"))
|
||||
{
|
||||
int limit = target.length()-1;
|
||||
|
||||
while (limit>=0)
|
||||
{
|
||||
// Get best match
|
||||
Map.Entry<String,Branch[]> branches = _pathBranches.getBest(target,1,limit);
|
||||
|
||||
|
||||
if (branches==null)
|
||||
break;
|
||||
HttpChannelState async = baseRequest.getHttpChannelState();
|
||||
if (async.isAsync())
|
||||
{
|
||||
ContextHandler context=async.getContextHandler();
|
||||
if (context!=null)
|
||||
{
|
||||
Handler branch = _contextBranches.get(context);
|
||||
|
||||
int l=branches.getKey().length();
|
||||
if (l==1 || target.length()==l || target.charAt(l)=='/')
|
||||
{
|
||||
for (Branch branch : branches.getValue())
|
||||
{
|
||||
branch.getHandler().handle(target,baseRequest, request, response);
|
||||
if (baseRequest.isHandled())
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
limit=l-2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (branch==null)
|
||||
context.handle(target,baseRequest,request, response);
|
||||
else
|
||||
branch.handle(target, baseRequest, request, response);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// data structure which maps a request to a context; first-best match wins
|
||||
// { context path => [ context ] }
|
||||
// }
|
||||
if (target.startsWith("/"))
|
||||
{
|
||||
int limit = target.length()-1;
|
||||
|
||||
while (limit>=0)
|
||||
{
|
||||
// Get best match
|
||||
Map.Entry<String,Branch[]> branches = _pathBranches.getBest(target,1,limit);
|
||||
|
||||
|
||||
if (branches==null)
|
||||
break;
|
||||
|
||||
int l=branches.getKey().length();
|
||||
if (l==1 || target.length()==l || target.charAt(l)=='/')
|
||||
{
|
||||
for (Branch branch : branches.getValue())
|
||||
{
|
||||
branch.getHandler().handle(target,baseRequest, request, response);
|
||||
if (baseRequest.isHandled())
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
limit=l-2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// This may not work in all circumstances... but then I think it should never be called
|
||||
for (int i=0;i<handlers.length;i++)
|
||||
{
|
||||
handlers[i].handle(target,baseRequest, request, response);
|
||||
if ( baseRequest.isHandled())
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (int i=0;i<handlers.length;i++)
|
||||
{
|
||||
handlers[i].handle(target,baseRequest, request, response);
|
||||
if ( baseRequest.isHandled())
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -63,9 +63,9 @@ public class SelectChannelServerSslTest extends HttpServerTestBase
|
|||
@Override
|
||||
public void testFullMethod() throws Exception
|
||||
{
|
||||
// Don't run on Windows (buggy JVM)
|
||||
Assume.assumeTrue(!OS.IS_WINDOWS);
|
||||
|
||||
// Don't run on Windows (buggy JVM)
|
||||
Assume.assumeTrue(!OS.IS_WINDOWS);
|
||||
|
||||
try
|
||||
{
|
||||
super.testFullMethod();
|
||||
|
@ -79,8 +79,8 @@ public class SelectChannelServerSslTest extends HttpServerTestBase
|
|||
@Override
|
||||
public void testFullURI() throws Exception
|
||||
{
|
||||
// Don't run on Windows (buggy JVM)
|
||||
Assume.assumeTrue(!OS.IS_WINDOWS);
|
||||
// Don't run on Windows (buggy JVM)
|
||||
Assume.assumeTrue(!OS.IS_WINDOWS);
|
||||
try
|
||||
{
|
||||
super.testFullURI();
|
||||
|
|
|
@ -66,19 +66,19 @@ public class FilterMapping implements Dumpable
|
|||
*/
|
||||
public static int dispatch(DispatcherType type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case REQUEST:
|
||||
return REQUEST;
|
||||
case ASYNC:
|
||||
return ASYNC;
|
||||
case FORWARD:
|
||||
return FORWARD;
|
||||
case INCLUDE:
|
||||
return INCLUDE;
|
||||
case ERROR:
|
||||
return ERROR;
|
||||
}
|
||||
switch(type)
|
||||
{
|
||||
case REQUEST:
|
||||
return REQUEST;
|
||||
case ASYNC:
|
||||
return ASYNC;
|
||||
case FORWARD:
|
||||
return FORWARD;
|
||||
case INCLUDE:
|
||||
return INCLUDE;
|
||||
case ERROR:
|
||||
return ERROR;
|
||||
}
|
||||
throw new IllegalArgumentException(type.toString());
|
||||
}
|
||||
|
||||
|
@ -123,8 +123,8 @@ public class FilterMapping implements Dumpable
|
|||
*/
|
||||
boolean appliesTo(int type)
|
||||
{
|
||||
if (_dispatches==0)
|
||||
return type==REQUEST || type==ASYNC && _holder.isAsyncSupported();
|
||||
if (_dispatches==0)
|
||||
return type==REQUEST || type==ASYNC && _holder.isAsyncSupported();
|
||||
return (_dispatches&type)!=0;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ public class Invoker extends HttpServlet
|
|||
|
||||
/* ------------------------------------------------------------ */
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException
|
||||
throws ServletException, IOException
|
||||
{
|
||||
// Get the requested path and info
|
||||
boolean included=false;
|
||||
|
|
|
@ -288,9 +288,9 @@ public class ServletContextHandler extends ContextHandler
|
|||
decorator.decorate(holder.getListener());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
super.startContext();
|
||||
|
||||
// OK to Initialize servlet handler now that all relevant object trees have been started
|
||||
|
|
|
@ -751,23 +751,23 @@ public class ServletHandler extends ScopedHandler
|
|||
final Map<String,FilterChain> cache=_chainCache[dispatch];
|
||||
final Queue<String> lru=_chainLRU[dispatch];
|
||||
|
||||
// Do we have too many cached chains?
|
||||
while (_maxFilterChainsCacheSize>0 && cache.size()>=_maxFilterChainsCacheSize)
|
||||
{
|
||||
// The LRU list is not atomic with the cache map, so be prepared to invalidate if
|
||||
// a key is not found to delete.
|
||||
// Delete by LRU (where U==created)
|
||||
String k=lru.poll();
|
||||
if (k==null)
|
||||
{
|
||||
cache.clear();
|
||||
break;
|
||||
}
|
||||
cache.remove(k);
|
||||
}
|
||||
// Do we have too many cached chains?
|
||||
while (_maxFilterChainsCacheSize>0 && cache.size()>=_maxFilterChainsCacheSize)
|
||||
{
|
||||
// The LRU list is not atomic with the cache map, so be prepared to invalidate if
|
||||
// a key is not found to delete.
|
||||
// Delete by LRU (where U==created)
|
||||
String k=lru.poll();
|
||||
if (k==null)
|
||||
{
|
||||
cache.clear();
|
||||
break;
|
||||
}
|
||||
cache.remove(k);
|
||||
}
|
||||
|
||||
cache.put(key,chain);
|
||||
lru.add(key);
|
||||
cache.put(key,chain);
|
||||
lru.add(key);
|
||||
}
|
||||
else if (filters.size() > 0)
|
||||
chain = new Chain(baseRequest,filters, servletHolder);
|
||||
|
|
|
@ -570,7 +570,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
|
||||
/* ------------------------------------------------------------ */
|
||||
private void initServlet()
|
||||
throws ServletException
|
||||
throws ServletException
|
||||
{
|
||||
Object old_run_as = null;
|
||||
try
|
||||
|
|
|
@ -49,7 +49,6 @@ import org.junit.Test;
|
|||
*/
|
||||
public class AsyncContextDispatchWithQueryStrings
|
||||
{
|
||||
|
||||
private Server _server = new Server();
|
||||
private ServletContextHandler _contextHandler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
|
||||
private LocalConnector _connector = new LocalConnector(_server);
|
||||
|
@ -73,7 +72,8 @@ public class AsyncContextDispatchWithQueryStrings
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleDispatchesWithNewQueryStrings() throws Exception {
|
||||
public void testMultipleDispatchesWithNewQueryStrings() throws Exception
|
||||
{
|
||||
String request =
|
||||
"GET /initialCall?initialParam=right HTTP/1.1\r\n" +
|
||||
"Host: localhost\r\n" +
|
||||
|
@ -84,7 +84,8 @@ public class AsyncContextDispatchWithQueryStrings
|
|||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
public void tearDown() throws Exception
|
||||
{
|
||||
_server.stop();
|
||||
_server.join();
|
||||
}
|
||||
|
|
|
@ -49,15 +49,15 @@ public class WelcomeFilter implements Filter
|
|||
public void init(FilterConfig filterConfig)
|
||||
{
|
||||
welcome=filterConfig.getInitParameter("welcome");
|
||||
if (welcome==null)
|
||||
welcome="index.html";
|
||||
if (welcome==null)
|
||||
welcome="index.html";
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void doFilter(ServletRequest request,
|
||||
ServletResponse response,
|
||||
FilterChain chain)
|
||||
throws IOException, ServletException
|
||||
throws IOException, ServletException
|
||||
{
|
||||
String path=((HttpServletRequest)request).getServletPath();
|
||||
if (welcome!=null && path.endsWith("/"))
|
||||
|
|
|
@ -57,6 +57,6 @@ public class CloseableDoSFilterTest extends AbstractDoSFilterTest
|
|||
public void testUnresponsiveClient() throws Exception
|
||||
{
|
||||
// TODO work out why this intermittently fails
|
||||
LOG.warn("Ignored Closeable testUnresponsiveClient");
|
||||
LOG.warn("Ignored Closeable testUnresponsiveClient");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -894,9 +894,9 @@ public class StartArgs
|
|||
// only add non-duplicates
|
||||
if (!propertyFileRefs.contains(arg))
|
||||
{
|
||||
propertyFileRefs.add(arg);
|
||||
propertyFileRefs.add(arg);
|
||||
}
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
// Anything else is unrecognized
|
||||
|
@ -938,7 +938,7 @@ public class StartArgs
|
|||
Path propertyFile = baseHome.getPath(propertyFileRef);
|
||||
if (!FS.exists(propertyFile))
|
||||
{
|
||||
propertyFile = baseHome.getPath("etc/" + propertyFileRef);
|
||||
propertyFile = baseHome.getPath("etc/" + propertyFileRef);
|
||||
}
|
||||
addUniquePropertyFile(propertyFileRef,propertyFile);
|
||||
}
|
||||
|
|
|
@ -549,7 +549,7 @@ public abstract class Resource implements ResourceFactory, Closeable
|
|||
buf.append("</TD></TR>");
|
||||
}
|
||||
buf.append("</TABLE>\n");
|
||||
buf.append("</BODY></HTML>\n");
|
||||
buf.append("</BODY></HTML>\n");
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ public class URLEncodedTest
|
|||
/* -------------------------------------------------------------- */
|
||||
@Test
|
||||
public void testUrlEncodedStream()
|
||||
throws Exception
|
||||
throws Exception
|
||||
{
|
||||
String [][] charsets = new String[][]
|
||||
{
|
||||
|
|
|
@ -124,9 +124,9 @@ public class ResourceTest
|
|||
__userURL=uri.toURL();
|
||||
|
||||
__userURL = MavenTestingUtils.getTestResourcesDir().toURI().toURL();
|
||||
FilePermission perm = (FilePermission) __userURL.openConnection().getPermission();
|
||||
__userDir = new File(perm.getName()).getCanonicalPath() + File.separatorChar;
|
||||
__relDir = "src/test/resources/".replace('/', File.separatorChar);
|
||||
FilePermission perm = (FilePermission) __userURL.openConnection().getPermission();
|
||||
__userDir = new File(perm.getName()).getCanonicalPath() + File.separatorChar;
|
||||
__relDir = "src/test/resources/".replace('/', File.separatorChar);
|
||||
|
||||
//System.err.println("User Dir="+__userDir);
|
||||
//System.err.println("Rel Dir="+__relDir);
|
||||
|
|
|
@ -75,10 +75,10 @@ public class FragmentConfiguration extends AbstractConfiguration
|
|||
{
|
||||
for (Resource key : frags.keySet())
|
||||
{
|
||||
if (key.isDirectory()) //tolerate the case where the library is a directory, not a jar. useful for OSGi for example
|
||||
{
|
||||
metaData.addFragment(key, frags.get(key));
|
||||
}
|
||||
if (key.isDirectory()) //tolerate the case where the library is a directory, not a jar. useful for OSGi for example
|
||||
{
|
||||
metaData.addFragment(key, frags.get(key));
|
||||
}
|
||||
else //the standard case: a jar most likely inside WEB-INF/lib
|
||||
{
|
||||
metaData.addFragment(key, frags.get(key));
|
||||
|
|
|
@ -221,7 +221,7 @@ public class WebAppClassLoader extends URLClassLoader
|
|||
* with '/'.
|
||||
*/
|
||||
public void addClassPath(String classPath)
|
||||
throws IOException
|
||||
throws IOException
|
||||
{
|
||||
if (classPath == null)
|
||||
return;
|
||||
|
|
|
@ -914,7 +914,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
|||
|
||||
/* ------------------------------------------------------------ */
|
||||
protected void loadConfigurations()
|
||||
throws Exception
|
||||
throws Exception
|
||||
{
|
||||
//if the configuration instances have been set explicitly, use them
|
||||
if (_configurations.size()>0)
|
||||
|
|
|
@ -67,8 +67,8 @@ public class ClientConnectTest
|
|||
Throwable cause = e.getCause();
|
||||
if(!errorClass.isInstance(cause))
|
||||
{
|
||||
cause.printStackTrace(System.err);
|
||||
Assert.assertThat("ExecutionException.cause",cause,instanceOf(errorClass));
|
||||
cause.printStackTrace(System.err);
|
||||
Assert.assertThat("ExecutionException.cause",cause,instanceOf(errorClass));
|
||||
}
|
||||
|
||||
// Validate websocket captured cause
|
||||
|
@ -359,15 +359,15 @@ public class ClientConnectTest
|
|||
}
|
||||
catch (ExecutionException e)
|
||||
{
|
||||
if(OS.IS_WINDOWS)
|
||||
{
|
||||
// On windows, this is a SocketTimeoutException
|
||||
assertExpectedError(e, wsocket, SocketTimeoutException.class);
|
||||
} else
|
||||
{
|
||||
// Expected path - java.net.ConnectException
|
||||
assertExpectedError(e,wsocket,ConnectException.class);
|
||||
}
|
||||
if(OS.IS_WINDOWS)
|
||||
{
|
||||
// On windows, this is a SocketTimeoutException
|
||||
assertExpectedError(e, wsocket, SocketTimeoutException.class);
|
||||
} else
|
||||
{
|
||||
// Expected path - java.net.ConnectException
|
||||
assertExpectedError(e,wsocket,ConnectException.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public class TestConfiguration extends HashMap<String,Object>
|
|||
|
||||
public void setPropertyTest(int value)
|
||||
{
|
||||
propValue=value;
|
||||
propValue=value;
|
||||
}
|
||||
|
||||
public TestConfiguration getNested()
|
||||
|
|
|
@ -86,7 +86,7 @@ public abstract class RFC2616BaseTest
|
|||
|
||||
public static void setUpServer(TestableJettyServer testableserver, Class<?> testclazz) throws Exception
|
||||
{
|
||||
File testWorkDir = MavenTestingUtils.getTargetTestingDir(testclazz.getName());
|
||||
File testWorkDir = MavenTestingUtils.getTargetTestingDir(testclazz.getName());
|
||||
FS.ensureDirExists(testWorkDir);
|
||||
|
||||
System.setProperty("java.io.tmpdir",testWorkDir.getAbsolutePath());
|
||||
|
|
|
@ -34,21 +34,21 @@ public class SessionValueSavingTest extends AbstractSessionValueSavingTest
|
|||
return new JdbcTestServer(port,max,scavenge);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSessionValueSaving() throws Exception
|
||||
{
|
||||
super.testSessionValueSaving();
|
||||
}
|
||||
@Test
|
||||
public void testSessionValueSaving() throws Exception
|
||||
{
|
||||
super.testSessionValueSaving();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
DriverManager.getConnection( "jdbc:derby:sessions;shutdown=true" );
|
||||
}
|
||||
catch( SQLException expected )
|
||||
{
|
||||
}
|
||||
}
|
||||
@After
|
||||
public void tearDown() throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
DriverManager.getConnection( "jdbc:derby:sessions;shutdown=true" );
|
||||
}
|
||||
catch( SQLException expected )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,8 +133,8 @@ public abstract class AbstractSessionValueSavingTest
|
|||
System.out.println("not init call " + session);
|
||||
if (session!=null)
|
||||
{
|
||||
long value = System.currentTimeMillis();
|
||||
System.out.println("Setting test to : " + value);
|
||||
long value = System.currentTimeMillis();
|
||||
System.out.println("Setting test to : " + value);
|
||||
session.setAttribute("test", value);
|
||||
|
||||
}
|
||||
|
@ -148,14 +148,14 @@ public abstract class AbstractSessionValueSavingTest
|
|||
|
||||
private void sendResult(HttpSession session, PrintWriter writer)
|
||||
{
|
||||
if (session != null)
|
||||
{
|
||||
writer.print(session.getAttribute("test"));
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.print(0);
|
||||
}
|
||||
if (session != null)
|
||||
{
|
||||
writer.print(session.getAttribute("test"));
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.print(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ public class Counter implements java.io.Serializable
|
|||
|
||||
public int getCount()
|
||||
{
|
||||
counter++;
|
||||
return counter;
|
||||
counter++;
|
||||
return counter;
|
||||
}
|
||||
|
||||
public void setLast(String uri) {
|
||||
|
|
|
@ -50,22 +50,22 @@ public class DateTag extends BodyTagSupport
|
|||
public void doInitBody() throws JspException {}
|
||||
|
||||
public int doAfterBody() throws JspException {
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
SimpleDateFormat format = new SimpleDateFormat(body.getString());
|
||||
format.setTimeZone(TimeZone.getTimeZone(tz));
|
||||
body.getEnclosingWriter().write(format.format(new Date()));
|
||||
return SKIP_BODY;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
body.getEnclosingWriter().write(format.format(new Date()));
|
||||
return SKIP_BODY;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
throw new JspTagException(ex.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void release()
|
||||
{
|
||||
body=null;
|
||||
body=null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,16 +68,16 @@ public class Dump extends HttpServlet
|
|||
@Override
|
||||
public void init(ServletConfig config) throws ServletException
|
||||
{
|
||||
super.init(config);
|
||||
super.init(config);
|
||||
|
||||
if (config.getInitParameter("unavailable")!=null && !fixed)
|
||||
{
|
||||
if (config.getInitParameter("unavailable")!=null && !fixed)
|
||||
{
|
||||
|
||||
fixed=true;
|
||||
throw new UnavailableException("Unavailable test",Integer.parseInt(config.getInitParameter("unavailable")));
|
||||
}
|
||||
fixed=true;
|
||||
throw new UnavailableException("Unavailable test",Integer.parseInt(config.getInitParameter("unavailable")));
|
||||
}
|
||||
|
||||
_timer=new Timer(true);
|
||||
_timer=new Timer(true);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -118,7 +118,7 @@ public class Dump extends HttpServlet
|
|||
}
|
||||
catch(ServletException se)
|
||||
{
|
||||
se.printStackTrace();
|
||||
se.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public class HelloWorld extends HttpServlet
|
|||
@Override
|
||||
public void init(ServletConfig config) throws ServletException
|
||||
{
|
||||
super.init(config);
|
||||
super.init(config);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -38,7 +38,7 @@ public class LoginServlet extends HttpServlet
|
|||
@Override
|
||||
public void init(ServletConfig config) throws ServletException
|
||||
{
|
||||
super.init(config);
|
||||
super.init(config);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -44,7 +44,7 @@ public class RegTest extends HttpServlet
|
|||
@Override
|
||||
public void init(ServletConfig config) throws ServletException
|
||||
{
|
||||
super.init(config);
|
||||
super.init(config);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -48,7 +48,7 @@ public class SecureModeServlet extends HttpServlet
|
|||
@Override
|
||||
public void init(ServletConfig config) throws ServletException
|
||||
{
|
||||
super.init(config);
|
||||
super.init(config);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -20,9 +20,9 @@ package com.acme;
|
|||
|
||||
|
||||
public class Bar {
|
||||
|
||||
@Foo(2)
|
||||
public void someMethod () {
|
||||
}
|
||||
|
||||
@Foo(2)
|
||||
public void someMethod () {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue