expanded tabs in indents

This commit is contained in:
Greg Wilkins 2014-07-23 16:49:05 +10:00
parent e199b671bb
commit 3a6879d3e8
50 changed files with 616 additions and 616 deletions

View File

@ -441,14 +441,14 @@ public class AnnotationConfiguration extends AbstractConfiguration
// Resolve container initializers // Resolve container initializers
List<ContainerInitializer> initializers = List<ContainerInitializer> initializers =
(List<ContainerInitializer>)context.getAttribute(AnnotationConfiguration.CONTAINER_INITIALIZERS); (List<ContainerInitializer>)context.getAttribute(AnnotationConfiguration.CONTAINER_INITIALIZERS);
if (initializers != null && initializers.size()>0) if (initializers != null && initializers.size()>0)
{ {
Map<String, Set<String>> map = ( Map<String, Set<String>>) context.getAttribute(AnnotationConfiguration.CLASS_INHERITANCE_MAP); Map<String, Set<String>> map = ( Map<String, Set<String>>) context.getAttribute(AnnotationConfiguration.CLASS_INHERITANCE_MAP);
if (map == null) if (map == null)
LOG.warn ("ServletContainerInitializers: detected. Class hierarchy: empty"); LOG.warn ("ServletContainerInitializers: detected. Class hierarchy: empty");
for (ContainerInitializer i : initializers) for (ContainerInitializer i : initializers)
i.resolveClasses(context,map); i.resolveClasses(context,map);
} }
} }

View File

@ -1049,8 +1049,8 @@ public class SslBytesServerTest extends SslBytesTest
@Test @Test
public void testRequestWithBigContentWriteBlockedThenReset() throws Exception public void testRequestWithBigContentWriteBlockedThenReset() throws Exception
{ {
// Don't run on Windows (buggy JVM) // Don't run on Windows (buggy JVM)
Assume.assumeTrue(!OS.IS_WINDOWS); Assume.assumeTrue(!OS.IS_WINDOWS);
final SSLSocket client = newClient(); final SSLSocket client = newClient();
@ -1110,10 +1110,10 @@ public class SslBytesServerTest extends SslBytesTest
@Test @Test
public void testRequestWithBigContentReadBlockedThenReset() throws Exception public void testRequestWithBigContentReadBlockedThenReset() throws Exception
{ {
// Don't run on Windows (buggy JVM) // Don't run on Windows (buggy JVM)
Assume.assumeTrue(!OS.IS_WINDOWS); Assume.assumeTrue(!OS.IS_WINDOWS);
final SSLSocket client = newClient(); final SSLSocket client = newClient();
SimpleProxy.AutomaticFlow automaticProxyFlow = proxy.startAutomaticFlow(); SimpleProxy.AutomaticFlow automaticProxyFlow = proxy.startAutomaticFlow();
client.startHandshake(); client.startHandshake();

View File

@ -36,10 +36,10 @@ import org.junit.Test;
*/ */
public class AppLifeCycleTest public class AppLifeCycleTest
{ {
@Rule @Rule
public TestingDir testdir = new TestingDir(); 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>()); assertPath(from,to,new ArrayList<String>());
} }

View File

@ -30,8 +30,8 @@ import org.junit.Test;
*/ */
public class ScanningAppProviderStartupTest public class ScanningAppProviderStartupTest
{ {
@Rule @Rule
public TestingDir testdir = new TestingDir(); public TestingDir testdir = new TestingDir();
private static XmlConfiguredJetty jetty; private static XmlConfiguredJetty jetty;
@Before @Before

View File

@ -97,8 +97,8 @@ public class JettyHttpContext extends com.sun.net.httpserver.HttpContext
@Override @Override
public Authenticator setAuthenticator(Authenticator auth) public Authenticator setAuthenticator(Authenticator auth)
{ {
Authenticator previous = _authenticator; Authenticator previous = _authenticator;
_authenticator = auth; _authenticator = auth;
return previous; return previous;
} }

View File

@ -71,7 +71,7 @@ public class JettyHttpServer extends com.sun.net.httpserver.HttpServer
@Override @Override
public void bind(InetSocketAddress addr, int backlog) throws IOException public void bind(InetSocketAddress addr, int backlog) throws IOException
{ {
// check if there is already a connector listening // check if there is already a connector listening
Collection<NetworkConnector> connectors = _server.getBeans(NetworkConnector.class); Collection<NetworkConnector> connectors = _server.getBeans(NetworkConnector.class);
if (connectors != null) if (connectors != null)
{ {
@ -85,7 +85,7 @@ public class JettyHttpServer extends com.sun.net.httpserver.HttpServer
} }
if (_serverShared) if (_serverShared)
throw new IOException("jetty server is not bound to port " + addr.getPort()); throw new IOException("jetty server is not bound to port " + addr.getPort());
this._addr = addr; this._addr = addr;
@ -107,7 +107,7 @@ public class JettyHttpServer extends com.sun.net.httpserver.HttpServer
@Override @Override
public void start() public void start()
{ {
if (_serverShared) return; if (_serverShared) return;
try try
{ {
@ -143,12 +143,12 @@ public class JettyHttpServer extends com.sun.net.httpserver.HttpServer
@Override @Override
public void stop(int delay) public void stop(int delay)
{ {
cleanUpContexts(); cleanUpContexts();
cleanUpConnectors(); cleanUpConnectors();
if (_serverShared) return; if (_serverShared) return;
try try
{ {
_server.stop(); _server.stop();
} }
@ -158,15 +158,15 @@ public class JettyHttpServer extends com.sun.net.httpserver.HttpServer
} }
} }
private void cleanUpContexts() private void cleanUpContexts()
{ {
for (Map.Entry<String, JettyHttpContext> stringJettyHttpContextEntry : _contexts.entrySet()) for (Map.Entry<String, JettyHttpContext> stringJettyHttpContextEntry : _contexts.entrySet())
{ {
JettyHttpContext context = stringJettyHttpContextEntry.getValue(); JettyHttpContext context = stringJettyHttpContextEntry.getValue();
_server.removeBean(context.getJettyContextHandler()); _server.removeBean(context.getJettyContextHandler());
} }
_contexts.clear(); _contexts.clear();
} }
private void cleanUpConnectors() private void cleanUpConnectors()
{ {
@ -181,20 +181,20 @@ public class JettyHttpServer extends com.sun.net.httpserver.HttpServer
} }
_server.removeConnector(connector); _server.removeConnector(connector);
} }
_connectors.clear(); _connectors.clear();
} }
@Override @Override
public HttpContext createContext(String path, HttpHandler httpHandler) public HttpContext createContext(String path, HttpHandler httpHandler)
{ {
checkIfContextIsFree(path); checkIfContextIsFree(path);
JettyHttpContext context = new JettyHttpContext(this, path, httpHandler); JettyHttpContext context = new JettyHttpContext(this, path, httpHandler);
HttpSpiContextHandler jettyContextHandler = context.getJettyContextHandler(); HttpSpiContextHandler jettyContextHandler = context.getJettyContextHandler();
ContextHandlerCollection chc = findContextHandlerCollection(_server.getHandlers()); ContextHandlerCollection chc = findContextHandlerCollection(_server.getHandlers());
if (chc == null) if (chc == null)
throw new RuntimeException("could not find ContextHandlerCollection, you must configure one"); throw new RuntimeException("could not find ContextHandlerCollection, you must configure one");
chc.addHandler(jettyContextHandler); chc.addHandler(jettyContextHandler);
_contexts.put(path, context); _contexts.put(path, context);
@ -227,16 +227,16 @@ public class JettyHttpServer extends com.sun.net.httpserver.HttpServer
private void checkIfContextIsFree(String path) private void checkIfContextIsFree(String path)
{ {
Handler serverHandler = _server.getHandler(); Handler serverHandler = _server.getHandler();
if (serverHandler instanceof ContextHandler) if (serverHandler instanceof ContextHandler)
{ {
ContextHandler ctx = (ContextHandler) serverHandler; ContextHandler ctx = (ContextHandler) serverHandler;
if (ctx.getContextPath().equals(path)) if (ctx.getContextPath().equals(path))
throw new RuntimeException("another context already bound to path " + path); throw new RuntimeException("another context already bound to path " + path);
} }
Handler[] handlers = _server.getHandlers(); Handler[] handlers = _server.getHandlers();
if (handlers == null) return; if (handlers == null) return;
for (Handler handler : handlers) for (Handler handler : handlers)
{ {
@ -246,9 +246,9 @@ public class JettyHttpServer extends com.sun.net.httpserver.HttpServer
throw new RuntimeException("another context already bound to path " + path); throw new RuntimeException("another context already bound to path " + path);
} }
} }
} }
@Override @Override
public HttpContext createContext(String path) public HttpContext createContext(String path)
{ {
return createContext(path, null); return createContext(path, null);

View File

@ -43,7 +43,7 @@ public class JettyHttpServerProvider extends HttpServerProvider
public static void setServer(Server server) public static void setServer(Server server)
{ {
_server = server; _server = server;
} }
@Override @Override
@ -51,7 +51,7 @@ public class JettyHttpServerProvider extends HttpServerProvider
throws IOException throws IOException
{ {
Server server = _server; Server server = _server;
boolean shared = true; boolean shared = true;
if (server == null) if (server == null)
{ {

View File

@ -210,7 +210,7 @@ public class JAASLoginService extends AbstractLifeCycle implements LoginService
} }
else if (callback instanceof RequestParameterCallback) else if (callback instanceof RequestParameterCallback)
{ {
HttpChannel channel = HttpChannel.getCurrentHttpChannel(); HttpChannel channel = HttpChannel.getCurrentHttpChannel();
if (channel == null) if (channel == null)
return; return;

View File

@ -82,23 +82,23 @@ public class ConnectorServer extends AbstractLifeCycle
public ConnectorServer(JMXServiceURL svcUrl, Map<String,?> environment, String name) public ConnectorServer(JMXServiceURL svcUrl, Map<String,?> environment, String name)
throws Exception throws Exception
{ {
String urlPath = svcUrl.getURLPath(); String urlPath = svcUrl.getURLPath();
int idx = urlPath.indexOf("rmi://"); int idx = urlPath.indexOf("rmi://");
if (idx > 0) if (idx > 0)
{ {
String hostPort = urlPath.substring(idx+6, urlPath.indexOf('/', idx+6)); String hostPort = urlPath.substring(idx+6, urlPath.indexOf('/', idx+6));
String regHostPort = startRegistry(hostPort); String regHostPort = startRegistry(hostPort);
if (regHostPort != null) { if (regHostPort != null) {
urlPath = urlPath.replace(hostPort,regHostPort); urlPath = urlPath.replace(hostPort,regHostPort);
svcUrl = new JMXServiceURL(svcUrl.getProtocol(), svcUrl.getHost(), svcUrl.getPort(), urlPath); svcUrl = new JMXServiceURL(svcUrl.getProtocol(), svcUrl.getHost(), svcUrl.getPort(), urlPath);
} }
} }
MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
_connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(svcUrl, environment, mbeanServer); _connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(svcUrl, environment, mbeanServer);
mbeanServer.registerMBean(_connectorServer,new ObjectName(name)); mbeanServer.registerMBean(_connectorServer,new ObjectName(name));
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart() * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
*/ */

View File

@ -139,7 +139,7 @@ public class JettyWebAppContext extends WebAppContext
} }
public void setContainerIncludeJarPattern(String pattern) public void setContainerIncludeJarPattern(String pattern)
{ {
_containerIncludeJarPattern = pattern; _containerIncludeJarPattern = pattern;
} }
public String getContainerIncludeJarPattern() public String getContainerIncludeJarPattern()
@ -150,7 +150,7 @@ public class JettyWebAppContext extends WebAppContext
public String getWebInfIncludeJarPattern() public String getWebInfIncludeJarPattern()
{ {
return _webInfIncludeJarPattern; return _webInfIncludeJarPattern;
} }
public void setWebInfIncludeJarPattern(String pattern) public void setWebInfIncludeJarPattern(String pattern)
{ {

View File

@ -82,7 +82,7 @@ public class ServiceConnection
*/ */
public String getServiceUrl() public String getServiceUrl()
{ {
return _serviceUrl; return _serviceUrl;
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */

View File

@ -207,7 +207,7 @@ public class NoSqlSession extends MemSession
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
public Object getVersion() public Object getVersion()
{ {
return _version; return _version;
} }
@Override @Override

View File

@ -654,7 +654,7 @@ public class MongoSessionManager extends NoSqlSessionManager
/*------------------------------------------------------------ */ /*------------------------------------------------------------ */
private String getContextKey() private String getContextKey()
{ {
return __CONTEXT + "." + _contextId; return __CONTEXT + "." + _contextId;
} }
/*------------------------------------------------------------ */ /*------------------------------------------------------------ */
@ -664,7 +664,7 @@ public class MongoSessionManager extends NoSqlSessionManager
*/ */
private String getContextAttributeKey(String attr) 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") @ManagedOperation(value="purge invalid sessions in the session store based on normal criteria", impact="ACTION")

View File

@ -30,16 +30,16 @@ import javax.servlet.http.HttpServlet;
*/ */
public class HttpServiceErrorHandlerHelper public class HttpServiceErrorHandlerHelper
{ {
private static HttpServlet _customErrorHandler; private static HttpServlet _customErrorHandler;
public static HttpServlet getCustomErrorHandler() public static HttpServlet getCustomErrorHandler()
{ {
return _customErrorHandler; return _customErrorHandler;
} }
public static void setHttpServiceErrorHandler(HttpServlet servlet) public static void setHttpServiceErrorHandler(HttpServlet servlet)
{ {
_customErrorHandler = servlet; _customErrorHandler = servlet;
} }
} }

View File

@ -35,45 +35,45 @@ import org.eclipse.jetty.servlet.ErrorPageErrorHandler;
public class HttpServiceErrorPageErrorHandler extends ErrorPageErrorHandler public class HttpServiceErrorPageErrorHandler extends ErrorPageErrorHandler
{ {
private static HttpServiceErrorPageErrorHandler INSTANCE; private static HttpServiceErrorPageErrorHandler INSTANCE;
public static HttpServiceErrorPageErrorHandler getInstance() public static HttpServiceErrorPageErrorHandler getInstance()
{ {
return INSTANCE; return INSTANCE;
} }
public HttpServiceErrorPageErrorHandler() public HttpServiceErrorPageErrorHandler()
{ {
INSTANCE = this; INSTANCE = this;
} }
@Override @Override
public void handle(String target, Request baseRequest, public void handle(String target, Request baseRequest,
HttpServletRequest request, HttpServletResponse response) HttpServletRequest request, HttpServletResponse response)
throws IOException { throws IOException {
if (HttpServiceErrorHandlerHelper.getCustomErrorHandler() != null) if (HttpServiceErrorHandlerHelper.getCustomErrorHandler() != null)
{ {
try try
{ {
HttpServiceErrorHandlerHelper.getCustomErrorHandler().service(request, response); HttpServiceErrorHandlerHelper.getCustomErrorHandler().service(request, response);
} }
catch (ServletException e) catch (ServletException e)
{ {
//well //well
} }
} }
if (!response.isCommitted()) if (!response.isCommitted())
{ {
super.handle(target, baseRequest, request, response); super.handle(target, baseRequest, request, response);
} }
} }
@Override @Override
protected void doStop() throws Exception protected void doStop() throws Exception
{ {
INSTANCE = null; INSTANCE = null;
super.doStop(); super.doStop();
} }

View File

@ -86,7 +86,7 @@ public class OverlayServer
server.setStopAtShutdown(true); server.setStopAtShutdown(true);
//server.setSendServerVersion(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()); // new org.eclipse.jetty.plus.jndi.Transaction(new com.atomikos.icatch.jta.UserTransactionImp());

View File

@ -157,7 +157,7 @@ public class ContainerInitializer
interested.add(c.getName()); 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) public void resolveClasses(WebAppContext context, Map<String, Set<String>> classMap)

View File

@ -102,7 +102,7 @@ public class GatewayServer extends Server
public GatewayServer() 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) public GatewayServer(String contextPath, String externalServletPath,String gatewayServletPath, TargetIdRetriever targetIdRetriever)
@ -145,7 +145,7 @@ public class GatewayServer extends Server
public Gateway getGateway() public Gateway getGateway()
{ {
return gateway; return gateway;
} }
public ServletHolder getExternalServlet() public ServletHolder getExternalServlet()

View File

@ -331,28 +331,28 @@ public class DeferredAuthentication implements Authentication.Deferred
} }
@Override @Override
public Collection<String> getHeaderNames() public Collection<String> getHeaderNames()
{ {
return Collections.emptyList();
}
@Override
public String getHeader(String arg0)
{
return null;
}
@Override
public Collection<String> getHeaders(String arg0)
{
return Collections.emptyList(); return Collections.emptyList();
} }
@Override @Override
public int getStatus() public String getHeader(String arg0)
{ {
return 0; return null;
} }
@Override
public Collection<String> getHeaders(String arg0)
{
return Collections.emptyList();
}
@Override
public int getStatus()
{
return 0;
}
}; };

View File

@ -50,7 +50,7 @@ public class SpnegoAuthenticator extends LoginAuthenticator
*/ */
public SpnegoAuthenticator( String authMethod ) public SpnegoAuthenticator( String authMethod )
{ {
_authMethod = authMethod; _authMethod = authMethod;
} }
@Override @Override
@ -77,10 +77,10 @@ public class SpnegoAuthenticator extends LoginAuthenticator
{ {
try try
{ {
if (DeferredAuthentication.isDeferred(res)) if (DeferredAuthentication.isDeferred(res))
{ {
return Authentication.UNAUTHENTICATED; return Authentication.UNAUTHENTICATED;
} }
LOG.debug("SpengoAuthenticator: sending challenge"); LOG.debug("SpengoAuthenticator: sending challenge");
res.setHeader(HttpHeader.WWW_AUTHENTICATE.asString(), HttpHeader.NEGOTIATE.asString()); res.setHeader(HttpHeader.WWW_AUTHENTICATE.asString(), HttpHeader.NEGOTIATE.asString());

View File

@ -173,64 +173,64 @@ public class ContextHandlerCollection extends HandlerCollection
{ {
Handler[] handlers = getHandlers(); Handler[] handlers = getHandlers();
if (handlers==null || handlers.length==0) if (handlers==null || handlers.length==0)
return; return;
HttpChannelState async = baseRequest.getHttpChannelState(); HttpChannelState async = baseRequest.getHttpChannelState();
if (async.isAsync()) if (async.isAsync())
{ {
ContextHandler context=async.getContextHandler(); ContextHandler context=async.getContextHandler();
if (context!=null) if (context!=null)
{ {
Handler branch = _contextBranches.get(context); Handler branch = _contextBranches.get(context);
if (branch==null) if (branch==null)
context.handle(target,baseRequest,request, response); context.handle(target,baseRequest,request, response);
else else
branch.handle(target, baseRequest, request, response); branch.handle(target, baseRequest, request, response);
return; return;
} }
} }
// data structure which maps a request to a context; first-best match wins // data structure which maps a request to a context; first-best match wins
// { context path => [ context ] } // { context path => [ context ] }
// } // }
if (target.startsWith("/")) if (target.startsWith("/"))
{ {
int limit = target.length()-1; int limit = target.length()-1;
while (limit>=0) while (limit>=0)
{ {
// Get best match // Get best match
Map.Entry<String,Branch[]> branches = _pathBranches.getBest(target,1,limit); Map.Entry<String,Branch[]> branches = _pathBranches.getBest(target,1,limit);
if (branches==null) if (branches==null)
break; break;
int l=branches.getKey().length(); int l=branches.getKey().length();
if (l==1 || target.length()==l || target.charAt(l)=='/') if (l==1 || target.length()==l || target.charAt(l)=='/')
{ {
for (Branch branch : branches.getValue()) for (Branch branch : branches.getValue())
{ {
branch.getHandler().handle(target,baseRequest, request, response); branch.getHandler().handle(target,baseRequest, request, response);
if (baseRequest.isHandled()) if (baseRequest.isHandled())
return; return;
} }
} }
limit=l-2; limit=l-2;
} }
} }
else else
{ {
// This may not work in all circumstances... but then I think it should never be called // This may not work in all circumstances... but then I think it should never be called
for (int i=0;i<handlers.length;i++) for (int i=0;i<handlers.length;i++)
{ {
handlers[i].handle(target,baseRequest, request, response); handlers[i].handle(target,baseRequest, request, response);
if ( baseRequest.isHandled()) if ( baseRequest.isHandled())
return; return;
} }
} }
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */

View File

@ -63,8 +63,8 @@ public class SelectChannelServerSslTest extends HttpServerTestBase
@Override @Override
public void testFullMethod() throws Exception public void testFullMethod() throws Exception
{ {
// Don't run on Windows (buggy JVM) // Don't run on Windows (buggy JVM)
Assume.assumeTrue(!OS.IS_WINDOWS); Assume.assumeTrue(!OS.IS_WINDOWS);
try try
{ {
@ -79,8 +79,8 @@ public class SelectChannelServerSslTest extends HttpServerTestBase
@Override @Override
public void testFullURI() throws Exception public void testFullURI() throws Exception
{ {
// Don't run on Windows (buggy JVM) // Don't run on Windows (buggy JVM)
Assume.assumeTrue(!OS.IS_WINDOWS); Assume.assumeTrue(!OS.IS_WINDOWS);
try try
{ {
super.testFullURI(); super.testFullURI();

View File

@ -66,19 +66,19 @@ public class FilterMapping implements Dumpable
*/ */
public static int dispatch(DispatcherType type) public static int dispatch(DispatcherType type)
{ {
switch(type) switch(type)
{ {
case REQUEST: case REQUEST:
return REQUEST; return REQUEST;
case ASYNC: case ASYNC:
return ASYNC; return ASYNC;
case FORWARD: case FORWARD:
return FORWARD; return FORWARD;
case INCLUDE: case INCLUDE:
return INCLUDE; return INCLUDE;
case ERROR: case ERROR:
return ERROR; return ERROR;
} }
throw new IllegalArgumentException(type.toString()); throw new IllegalArgumentException(type.toString());
} }
@ -123,8 +123,8 @@ public class FilterMapping implements Dumpable
*/ */
boolean appliesTo(int type) boolean appliesTo(int type)
{ {
if (_dispatches==0) if (_dispatches==0)
return type==REQUEST || type==ASYNC && _holder.isAsyncSupported(); return type==REQUEST || type==ASYNC && _holder.isAsyncSupported();
return (_dispatches&type)!=0; return (_dispatches&type)!=0;
} }

View File

@ -112,7 +112,7 @@ public class Invoker extends HttpServlet
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
protected void service(HttpServletRequest request, HttpServletResponse response) protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException throws ServletException, IOException
{ {
// Get the requested path and info // Get the requested path and info
boolean included=false; boolean included=false;

View File

@ -288,8 +288,8 @@ public class ServletContextHandler extends ContextHandler
decorator.decorate(holder.getListener()); decorator.decorate(holder.getListener());
} }
} }
} }
} }
super.startContext(); super.startContext();

View File

@ -751,23 +751,23 @@ public class ServletHandler extends ScopedHandler
final Map<String,FilterChain> cache=_chainCache[dispatch]; final Map<String,FilterChain> cache=_chainCache[dispatch];
final Queue<String> lru=_chainLRU[dispatch]; final Queue<String> lru=_chainLRU[dispatch];
// Do we have too many cached chains? // Do we have too many cached chains?
while (_maxFilterChainsCacheSize>0 && cache.size()>=_maxFilterChainsCacheSize) while (_maxFilterChainsCacheSize>0 && cache.size()>=_maxFilterChainsCacheSize)
{ {
// The LRU list is not atomic with the cache map, so be prepared to invalidate if // The LRU list is not atomic with the cache map, so be prepared to invalidate if
// a key is not found to delete. // a key is not found to delete.
// Delete by LRU (where U==created) // Delete by LRU (where U==created)
String k=lru.poll(); String k=lru.poll();
if (k==null) if (k==null)
{ {
cache.clear(); cache.clear();
break; break;
} }
cache.remove(k); cache.remove(k);
} }
cache.put(key,chain); cache.put(key,chain);
lru.add(key); lru.add(key);
} }
else if (filters.size() > 0) else if (filters.size() > 0)
chain = new Chain(baseRequest,filters, servletHolder); chain = new Chain(baseRequest,filters, servletHolder);

View File

@ -569,7 +569,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
private void initServlet() private void initServlet()
throws ServletException throws ServletException
{ {
Object old_run_as = null; Object old_run_as = null;
try try

View File

@ -45,67 +45,67 @@ import org.junit.Test;
*/ */
public class AsyncContextDispatchWithQueryStrings { public class AsyncContextDispatchWithQueryStrings {
private Server _server = new Server(); private Server _server = new Server();
private ServletContextHandler _contextHandler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS); private ServletContextHandler _contextHandler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
private LocalConnector _connector = new LocalConnector(_server); private LocalConnector _connector = new LocalConnector(_server);
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
_connector.setIdleTimeout(30000); _connector.setIdleTimeout(30000);
_server.setConnectors(new Connector[] { _connector }); _server.setConnectors(new Connector[] { _connector });
_contextHandler.setContextPath("/"); _contextHandler.setContextPath("/");
_contextHandler.addServlet(new ServletHolder(new TestServlet()), "/initialCall"); _contextHandler.addServlet(new ServletHolder(new TestServlet()), "/initialCall");
_contextHandler.addServlet(new ServletHolder(new TestServlet()), "/firstDispatchWithNewQueryString"); _contextHandler.addServlet(new ServletHolder(new TestServlet()), "/firstDispatchWithNewQueryString");
_contextHandler.addServlet(new ServletHolder(new TestServlet()), "/secondDispatchNewValueForExistingQueryString"); _contextHandler.addServlet(new ServletHolder(new TestServlet()), "/secondDispatchNewValueForExistingQueryString");
HandlerList handlers = new HandlerList(); HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[] { _contextHandler, new DefaultHandler() }); handlers.setHandlers(new Handler[] { _contextHandler, new DefaultHandler() });
_server.setHandler(handlers); _server.setHandler(handlers);
_server.start(); _server.start();
} }
@Test @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" + "Content-Type: application/x-www-form-urlencoded\r\n" String request = "GET /initialCall?initialParam=right HTTP/1.1\r\n" + "Host: localhost\r\n" + "Content-Type: application/x-www-form-urlencoded\r\n"
+ "Connection: close\r\n" + "\r\n"; + "Connection: close\r\n" + "\r\n";
String responseString = _connector.getResponses(request); String responseString = _connector.getResponses(request);
assertTrue("Not the expected response. Check STDOUT for details.", responseString.startsWith("HTTP/1.1 200")); assertTrue("Not the expected response. Check STDOUT for details.", responseString.startsWith("HTTP/1.1 200"));
} }
@After @After
public void tearDown() throws Exception { public void tearDown() throws Exception {
_server.stop(); _server.stop();
_server.join(); _server.join();
} }
private class TestServlet extends HttpServlet { private class TestServlet extends HttpServlet {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Override @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String path = request.getRequestURI(); String path = request.getRequestURI();
String queryString = request.getQueryString(); String queryString = request.getQueryString();
if ("/initialCall".equals(path)) if ("/initialCall".equals(path))
{ {
AsyncContext async = request.startAsync(); AsyncContext async = request.startAsync();
async.dispatch("/firstDispatchWithNewQueryString?newQueryString=initialValue"); async.dispatch("/firstDispatchWithNewQueryString?newQueryString=initialValue");
assertEquals("initialParam=right", queryString); assertEquals("initialParam=right", queryString);
} }
else if ("/firstDispatchWithNewQueryString".equals(path)) else if ("/firstDispatchWithNewQueryString".equals(path))
{ {
AsyncContext async = request.startAsync(); AsyncContext async = request.startAsync();
async.dispatch("/secondDispatchNewValueForExistingQueryString?newQueryString=newValue"); async.dispatch("/secondDispatchNewValueForExistingQueryString?newQueryString=newValue");
assertEquals("newQueryString=initialValue&initialParam=right", queryString); assertEquals("newQueryString=initialValue&initialParam=right", queryString);
} }
else else
{ {
response.setContentType("text/html"); response.setContentType("text/html");
response.setStatus(HttpServletResponse.SC_OK); response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("<h1>woohhooooo</h1>"); response.getWriter().println("<h1>woohhooooo</h1>");
assertEquals("newQueryString=newValue&initialParam=right", queryString); assertEquals("newQueryString=newValue&initialParam=right", queryString);
} }
} }
} }
} }

View File

@ -49,15 +49,15 @@ public class WelcomeFilter implements Filter
public void init(FilterConfig filterConfig) public void init(FilterConfig filterConfig)
{ {
welcome=filterConfig.getInitParameter("welcome"); welcome=filterConfig.getInitParameter("welcome");
if (welcome==null) if (welcome==null)
welcome="index.html"; welcome="index.html";
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
public void doFilter(ServletRequest request, public void doFilter(ServletRequest request,
ServletResponse response, ServletResponse response,
FilterChain chain) FilterChain chain)
throws IOException, ServletException throws IOException, ServletException
{ {
String path=((HttpServletRequest)request).getServletPath(); String path=((HttpServletRequest)request).getServletPath();
if (welcome!=null && path.endsWith("/")) if (welcome!=null && path.endsWith("/"))

View File

@ -57,6 +57,6 @@ public class CloseableDoSFilterTest extends AbstractDoSFilterTest
public void testUnresponsiveClient() throws Exception public void testUnresponsiveClient() throws Exception
{ {
// TODO work out why this intermittently fails // TODO work out why this intermittently fails
LOG.warn("Ignored Closeable testUnresponsiveClient"); LOG.warn("Ignored Closeable testUnresponsiveClient");
} }
} }

View File

@ -894,9 +894,9 @@ public class StartArgs
// only add non-duplicates // only add non-duplicates
if (!propertyFileRefs.contains(arg)) if (!propertyFileRefs.contains(arg))
{ {
propertyFileRefs.add(arg); propertyFileRefs.add(arg);
} }
return; return;
} }
// Anything else is unrecognized // Anything else is unrecognized
@ -938,7 +938,7 @@ public class StartArgs
Path propertyFile = baseHome.getPath(propertyFileRef); Path propertyFile = baseHome.getPath(propertyFileRef);
if (!FS.exists(propertyFile)) if (!FS.exists(propertyFile))
{ {
propertyFile = baseHome.getPath("etc/" + propertyFileRef); propertyFile = baseHome.getPath("etc/" + propertyFileRef);
} }
addUniquePropertyFile(propertyFileRef,propertyFile); addUniquePropertyFile(propertyFileRef,propertyFile);
} }

View File

@ -549,7 +549,7 @@ public abstract class Resource implements ResourceFactory, Closeable
buf.append("</TD></TR>"); buf.append("</TD></TR>");
} }
buf.append("</TABLE>\n"); buf.append("</TABLE>\n");
buf.append("</BODY></HTML>\n"); buf.append("</BODY></HTML>\n");
return buf.toString(); return buf.toString();
} }

View File

@ -199,7 +199,7 @@ public class URLEncodedTest
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
@Test @Test
public void testUrlEncodedStream() public void testUrlEncodedStream()
throws Exception throws Exception
{ {
String [][] charsets = new String[][] String [][] charsets = new String[][]
{ {

View File

@ -124,9 +124,9 @@ public class ResourceTest
__userURL=uri.toURL(); __userURL=uri.toURL();
__userURL = MavenTestingUtils.getTestResourcesDir().toURI().toURL(); __userURL = MavenTestingUtils.getTestResourcesDir().toURI().toURL();
FilePermission perm = (FilePermission) __userURL.openConnection().getPermission(); FilePermission perm = (FilePermission) __userURL.openConnection().getPermission();
__userDir = new File(perm.getName()).getCanonicalPath() + File.separatorChar; __userDir = new File(perm.getName()).getCanonicalPath() + File.separatorChar;
__relDir = "src/test/resources/".replace('/', File.separatorChar); __relDir = "src/test/resources/".replace('/', File.separatorChar);
//System.err.println("User Dir="+__userDir); //System.err.println("User Dir="+__userDir);
//System.err.println("Rel Dir="+__relDir); //System.err.println("Rel Dir="+__relDir);

View File

@ -75,10 +75,10 @@ public class FragmentConfiguration extends AbstractConfiguration
{ {
for (Resource key : frags.keySet()) 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 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)); metaData.addFragment(key, frags.get(key));
} }
else //the standard case: a jar most likely inside WEB-INF/lib else //the standard case: a jar most likely inside WEB-INF/lib
{ {
metaData.addFragment(key, frags.get(key)); metaData.addFragment(key, frags.get(key));

View File

@ -221,7 +221,7 @@ public class WebAppClassLoader extends URLClassLoader
* with '/'. * with '/'.
*/ */
public void addClassPath(String classPath) public void addClassPath(String classPath)
throws IOException throws IOException
{ {
if (classPath == null) if (classPath == null)
return; return;

View File

@ -914,7 +914,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
protected void loadConfigurations() protected void loadConfigurations()
throws Exception throws Exception
{ {
//if the configuration instances have been set explicitly, use them //if the configuration instances have been set explicitly, use them
if (_configurations.size()>0) if (_configurations.size()>0)

View File

@ -67,8 +67,8 @@ public class ClientConnectTest
Throwable cause = e.getCause(); Throwable cause = e.getCause();
if(!errorClass.isInstance(cause)) if(!errorClass.isInstance(cause))
{ {
cause.printStackTrace(System.err); cause.printStackTrace(System.err);
Assert.assertThat("ExecutionException.cause",cause,instanceOf(errorClass)); Assert.assertThat("ExecutionException.cause",cause,instanceOf(errorClass));
} }
// Validate websocket captured cause // Validate websocket captured cause
@ -359,15 +359,15 @@ public class ClientConnectTest
} }
catch (ExecutionException e) catch (ExecutionException e)
{ {
if(OS.IS_WINDOWS) if(OS.IS_WINDOWS)
{ {
// On windows, this is a SocketTimeoutException // On windows, this is a SocketTimeoutException
assertExpectedError(e, wsocket, SocketTimeoutException.class); assertExpectedError(e, wsocket, SocketTimeoutException.class);
} else } else
{ {
// Expected path - java.net.ConnectException // Expected path - java.net.ConnectException
assertExpectedError(e,wsocket,ConnectException.class); assertExpectedError(e,wsocket,ConnectException.class);
} }
} }
} }

View File

@ -79,7 +79,7 @@ public class TestConfiguration extends HashMap<String,Object>
public void setPropertyTest(int value) public void setPropertyTest(int value)
{ {
propValue=value; propValue=value;
} }
public TestConfiguration getNested() public TestConfiguration getNested()

View File

@ -86,7 +86,7 @@ public abstract class RFC2616BaseTest
public static void setUpServer(TestableJettyServer testableserver, Class<?> testclazz) throws Exception 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); FS.ensureDirExists(testWorkDir);
System.setProperty("java.io.tmpdir",testWorkDir.getAbsolutePath()); System.setProperty("java.io.tmpdir",testWorkDir.getAbsolutePath());

View File

@ -34,21 +34,21 @@ public class SessionValueSavingTest extends AbstractSessionValueSavingTest
return new JdbcTestServer(port,max,scavenge); return new JdbcTestServer(port,max,scavenge);
} }
@Test @Test
public void testSessionValueSaving() throws Exception public void testSessionValueSaving() throws Exception
{ {
super.testSessionValueSaving(); super.testSessionValueSaving();
} }
@After @After
public void tearDown() throws Exception public void tearDown() throws Exception
{ {
try try
{ {
DriverManager.getConnection( "jdbc:derby:sessions;shutdown=true" ); DriverManager.getConnection( "jdbc:derby:sessions;shutdown=true" );
} }
catch( SQLException expected ) catch( SQLException expected )
{ {
} }
} }
} }

View File

@ -133,8 +133,8 @@ public abstract class AbstractSessionValueSavingTest
System.out.println("not init call " + session); System.out.println("not init call " + session);
if (session!=null) if (session!=null)
{ {
long value = System.currentTimeMillis(); long value = System.currentTimeMillis();
System.out.println("Setting test to : " + value); System.out.println("Setting test to : " + value);
session.setAttribute("test", value); session.setAttribute("test", value);
} }
@ -148,14 +148,14 @@ public abstract class AbstractSessionValueSavingTest
private void sendResult(HttpSession session, PrintWriter writer) private void sendResult(HttpSession session, PrintWriter writer)
{ {
if (session != null) if (session != null)
{ {
writer.print(session.getAttribute("test")); writer.print(session.getAttribute("test"));
} }
else else
{ {
writer.print(0); writer.print(0);
} }
} }
} }

View File

@ -26,8 +26,8 @@ public class Counter implements java.io.Serializable
public int getCount() public int getCount()
{ {
counter++; counter++;
return counter; return counter;
} }
public void setLast(String uri) { public void setLast(String uri) {

View File

@ -50,22 +50,22 @@ public class DateTag extends BodyTagSupport
public void doInitBody() throws JspException {} public void doInitBody() throws JspException {}
public int doAfterBody() throws JspException { public int doAfterBody() throws JspException {
try try
{ {
SimpleDateFormat format = new SimpleDateFormat(body.getString()); SimpleDateFormat format = new SimpleDateFormat(body.getString());
format.setTimeZone(TimeZone.getTimeZone(tz)); format.setTimeZone(TimeZone.getTimeZone(tz));
body.getEnclosingWriter().write(format.format(new Date())); body.getEnclosingWriter().write(format.format(new Date()));
return SKIP_BODY; return SKIP_BODY;
} }
catch (Exception ex) { catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
throw new JspTagException(ex.toString()); throw new JspTagException(ex.toString());
} }
} }
public void release() public void release()
{ {
body=null; body=null;
} }
} }

View File

@ -68,16 +68,16 @@ public class Dump extends HttpServlet
@Override @Override
public void init(ServletConfig config) throws ServletException 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; fixed=true;
throw new UnavailableException("Unavailable test",Integer.parseInt(config.getInitParameter("unavailable"))); 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) catch(ServletException se)
{ {
se.printStackTrace(); se.printStackTrace();
} }
} }

View File

@ -37,7 +37,7 @@ public class HelloWorld extends HttpServlet
@Override @Override
public void init(ServletConfig config) throws ServletException public void init(ServletConfig config) throws ServletException
{ {
super.init(config); super.init(config);
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */

View File

@ -38,7 +38,7 @@ public class LoginServlet extends HttpServlet
@Override @Override
public void init(ServletConfig config) throws ServletException public void init(ServletConfig config) throws ServletException
{ {
super.init(config); super.init(config);
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */

View File

@ -44,7 +44,7 @@ public class RegTest extends HttpServlet
@Override @Override
public void init(ServletConfig config) throws ServletException public void init(ServletConfig config) throws ServletException
{ {
super.init(config); super.init(config);
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */

View File

@ -48,7 +48,7 @@ public class SecureModeServlet extends HttpServlet
@Override @Override
public void init(ServletConfig config) throws ServletException public void init(ServletConfig config) throws ServletException
{ {
super.init(config); super.init(config);
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */

View File

@ -21,8 +21,8 @@ package com.acme;
public class Bar { public class Bar {
@Foo(2) @Foo(2)
public void someMethod () { public void someMethod () {
} }
} }