@NotThreadSafe public class MockServletPool extends Object
MockServletContext.| Constructor and Description |
|---|
MockServletPool(MockServletContext aSC) |
| Modifier and Type | Method and Description |
|---|---|
javax.servlet.Servlet |
getServletOfPath(String sPath)
Find the servlet matching the specified path.
|
void |
invalidate()
Invalidate the servlet pool, by destroying all contained servlets.
|
void |
registerServlet(Class<? extends javax.servlet.Servlet> aServletClass,
String sServletPath,
String sServletName)
Register a new servlet without servlet init parameters
|
void |
registerServlet(Class<? extends javax.servlet.Servlet> aServletClass,
String sServletPath,
String sServletName,
Map<String,String> aServletInitParams)
Register a new servlet
|
public MockServletPool(@Nonnull MockServletContext aSC)
public void registerServlet(@Nonnull Class<? extends javax.servlet.Servlet> aServletClass, @Nonnull @Nonempty String sServletPath, @Nonnull @Nonempty String sServletName)
aServletClass - The class of the servlet to be registered. May not be
null.sServletPath - The path where the servlet should listen to requests. May neither be
null nor empty.sServletName - The name of the servlet. May neither be null nor empty.public void registerServlet(@Nonnull Class<? extends javax.servlet.Servlet> aServletClass, @Nonnull @Nonempty String sServletPath, @Nonnull @Nonempty String sServletName, @Nullable Map<String,String> aServletInitParams)
aServletClass - The class of the servlet to be registered. May not be
null.sServletPath - The path where the servlet should listen to requests. May neither be
null nor empty.sServletName - The name of the servlet. May neither be null nor empty.aServletInitParams - An optional map of servlet init parameters. May be null
or empty.@Nullable public javax.servlet.Servlet getServletOfPath(@Nullable String sPath)
sPath - The path, relative to the servlet context. May be null.null if no Servlet matching the specified path
was found. If more than one matching servlet was found, the first
one is returned.public void invalidate()
Copyright © 2016–2019 Philip Helger. All rights reserved.