Tests should start the server in their setUp() method and stop the
server in their tearDown() method. Only while started the server's
URL and/or port number can be obtained.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | authRole
Role for authentication. |
| private final HttpConfiguration | |
| private final ServerConnector | |
| private final ContextHandlerCollection | |
| private List | |
| private static final String | keyPassword
SSL keystore password; must have at least 6 characters. |
| private final TestRequestLog | |
| public static final String | |
| public static final String | realm
Realm name for the secure access areas. |
| private final HttpConfiguration | |
| private final ServerConnector | |
| private final Server | |
| public static final String | username
Username for secured access areas. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | AppServer(int
the http port number; may be zero to allocate a port
dynamically port)Constructor for |
| public | AppServer(int
for http, may be zero to allocate a port dynamically port, int for https,may be zero to allocate a port dynamically. If
negative, the server will be set up without https support. sslPort)Constructor for |
| Modifier and Type | Method and Description |
|---|---|
| public ServletContextHandler | Returns: the context to add servlets into.path of the context; use "/" for the root context if binding
to the root is desired. path)Create a new servlet context within the server. |
| private void | |
| private void | |
| private void | |
| public ServletContextHandler | Returns: servlet context handlerservlet context handler ctx, String... the methods methods)Configure basic authentication. |
| private ConstraintMapping | |
| private SslContextFactory. | |
| public int | |
| public List | |
| public List | Returns: all requests which match the given path.base URI used to access the server. base, String the path to locate requests for, relative to path)base.Get requests. |
| public List | Returns: all requests which match the given path.the path to locate requests for. path)Get requests. |
| public int | |
| public URI | |
| private void | |
| public void | |
| public void |
| authRole | back to summary |
|---|---|
| private static final String authRole Role for authentication. | |
| config | back to summary |
|---|---|
| private final HttpConfiguration config | |
| connector | back to summary |
|---|---|
| private final ServerConnector connector | |
| contexts | back to summary |
|---|---|
| private final ContextHandlerCollection contexts | |
| filesToDelete | back to summary |
|---|---|
| private List<File> filesToDelete | |
| keyPassword | back to summary |
|---|---|
| private static final String keyPassword SSL keystore password; must have at least 6 characters. | |
| log | back to summary |
|---|---|
| private final TestRequestLog log | |
| password | back to summary |
|---|---|
| public static final String password Password for | |
| realm | back to summary |
|---|---|
| public static final String realm Realm name for the secure access areas. | |
| secureConfig | back to summary |
|---|---|
| private final HttpConfiguration secureConfig | |
| secureConnector | back to summary |
|---|---|
| private final ServerConnector secureConnector | |
| server | back to summary |
|---|---|
| private final Server server | |
| username | back to summary |
|---|---|
| public static final String username Username for secured access areas. | |
| AppServer | back to summary |
|---|---|
| public AppServer() Constructor for | |
| AppServer | back to summary |
|---|---|
| public AppServer(int port) Constructor for
| |
| AppServer | back to summary |
|---|---|
| public AppServer(int port, int sslPort) Constructor for
| |
| addContext | back to summary |
|---|---|
| public ServletContextHandler addContext(String path) Create a new servlet context within the server. This method should be invoked before the server is started, once for each context the caller wants to register.
| |
| assertAlreadySetUp | back to summary |
|---|---|
| private void assertAlreadySetUp() | |
| assertNotYetSetUp | back to summary |
|---|---|
| private void assertNotYetSetUp() | |
| auth | back to summary |
|---|---|
| private void auth(ServletContextHandler ctx, Authenticator authType, String... methods) | |
| authBasic | back to summary |
|---|---|
| public ServletContextHandler authBasic(ServletContextHandler ctx, String... methods) Configure basic authentication.
| |
| createConstraintMapping | back to summary |
|---|---|
| private ConstraintMapping createConstraintMapping() | |
| createTestSslContextFactory | back to summary |
|---|---|
| private SslContextFactory. | |
| getPort | back to summary |
|---|---|
| public int getPort() Get port.
| |
| getRequests | back to summary |
|---|---|
| public List Get requests.
| |
| getRequests | back to summary |
|---|---|
| public List Get requests.
| |
| getRequests | back to summary |
|---|---|
| public List Get requests.
| |
| getSecurePort | back to summary |
|---|---|
| public int getSecurePort() Get secure port.
| |
| getURI | back to summary |
|---|---|
| public URI getURI() Get the URI to reference this server. The returned URI includes the proper host name and port number, but does not contain a path.
| |
| makePrivate | back to summary |
|---|---|
| private void makePrivate(File file) | |
| setUp | back to summary |
|---|---|
| public void setUp() throws Exception Start the server on a random local port.
| |
| tearDown | back to summary |
|---|---|
| public void tearDown() throws Exception Shutdown the server.
| |
| Modifier and Type | Field and Description |
|---|---|
| private RolePrincipal | |
| protected final Map |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected void | doStart()
Overrides org. Starts the managed lifecycle beans in the order they were added. |
| protected List | loadRoleInfo(UserPrincipal user)
Implements abstract org.
|
| protected UserPrincipal | loadUserInfo(String user)
Implements abstract org.
|
| role | back to summary |
|---|---|
| private RolePrincipal role | |
| users | back to summary |
|---|---|
| protected final Map<String, UserPrincipal> users | |
| TestMappedLoginService | back to summary |
|---|---|
| pack-priv TestMappedLoginService(String role) | |
| doStart | back to summary |
|---|---|
| protected void doStart() throws Exception Overrides org. Doc from org. Starts the managed lifecycle beans in the order they were added.
| |
| loadRoleInfo | back to summary |
|---|---|
| protected List Implements abstract org.
| |
| loadUserInfo | back to summary |
|---|---|
| protected UserPrincipal loadUserInfo(String user) Implements abstract org.
| |