public class Helpers extends java.lang.Object implements Http.Status, Http.HeaderNames
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_TIMEOUT
Default Timeout (milliseconds) for fake requests issued by these Helpers.
|
static java.lang.String |
DELETE |
static java.lang.Class<? extends org.openqa.selenium.WebDriver> |
FIREFOX |
static java.lang.String |
GET |
static java.lang.String |
HEAD |
static java.lang.Class<? extends org.openqa.selenium.WebDriver> |
HTMLUNIT |
static java.lang.String |
POST |
static java.lang.String |
PUT |
ACCEPTED, BAD_GATEWAY, BAD_REQUEST, CONFLICT, CONTINUE, CREATED, EXPECTATION_FAILED, FORBIDDEN, FOUND, GATEWAY_TIMEOUT, GONE, HTTP_VERSION_NOT_SUPPORTED, INTERNAL_SERVER_ERROR, LENGTH_REQUIRED, METHOD_NOT_ALLOWED, MOVED_PERMANENTLY, MULTIPLE_CHOICES, NO_CONTENT, NON_AUTHORITATIVE_INFORMATION, NOT_ACCEPTABLE, NOT_FOUND, NOT_IMPLEMENTED, NOT_MODIFIED, OK, PARTIAL_CONTENT, PAYMENT_REQUIRED, PRECONDITION_FAILED, PROXY_AUTHENTICATION_REQUIRED, REQUEST_ENTITY_TOO_LARGE, REQUEST_TIMEOUT, REQUEST_URI_TOO_LONG, REQUESTED_RANGE_NOT_SATISFIABLE, RESET_CONTENT, SEE_OTHER, SERVICE_UNAVAILABLE, SWITCHING_PROTOCOLS, TEMPORARY_REDIRECT, UNAUTHORIZED, UNSUPPORTED_MEDIA_TYPE, USE_PROXY
ACCEPT, ACCEPT_CHARSET, ACCEPT_ENCODING, ACCEPT_LANGUAGE, ACCEPT_RANGES, ACCESS_CONTROL_ALLOW_CREDENTIALS, ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_METHODS, ACCESS_CONTROL_ALLOW_ORIGIN, ACCESS_CONTROL_EXPOSE_HEADERS, ACCESS_CONTROL_MAX_AGE, ACCESS_CONTROL_REQUEST_HEADERS, ACCESS_CONTROL_REQUEST_METHOD, AGE, ALLOW, AUTHORIZATION, CACHE_CONTROL, CONNECTION, CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_MD5, CONTENT_RANGE, CONTENT_TRANSFER_ENCODING, CONTENT_TYPE, COOKIE, DATE, ETAG, EXPECT, EXPIRES, FORWARDED, FROM, HOST, IF_MATCH, IF_MODIFIED_SINCE, IF_NONE_MATCH, IF_RANGE, IF_UNMODIFIED_SINCE, LAST_MODIFIED, LOCATION, MAX_FORWARDS, ORIGIN, PRAGMA, PROXY_AUTHENTICATE, PROXY_AUTHORIZATION, RANGE, REFERER, RETRY_AFTER, SERVER, SET_COOKIE, SET_COOKIE2, TE, TRAILER, TRANSFER_ENCODING, UPGRADE, USER_AGENT, VARY, VIA, WARNING, WWW_AUTHENTICATE, X_FORWARDED_FOR, X_FORWARDED_HOST, X_FORWARDED_PORT, X_FORWARDED_PROTO, X_REQUESTED_WITH
Constructor and Description |
---|
Helpers() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
charset(Result result)
Deprecated.
use
Result.charset() instead. |
static byte[] |
contentAsBytes(play.twirl.api.Content content)
Extracts the content as bytes.
|
static byte[] |
contentAsBytes(Result result)
Extracts the content as bytes.
|
static byte[] |
contentAsBytes(Result result,
long timeout) |
static java.lang.String |
contentAsString(play.twirl.api.Content content)
Extracts the content as String.
|
static java.lang.String |
contentAsString(Result result)
Extracts the content as String.
|
static java.lang.String |
contentAsString(Result result,
long timeout) |
static java.lang.String |
contentType(play.twirl.api.Content content)
Deprecated.
use
Result.contentType() instead. |
static java.lang.String |
contentType(Result result)
Deprecated.
use
Result.contentType() instead. |
static Http.Cookie |
cookie(java.lang.String name,
Result result)
Deprecated.
use
Result.cookie(String) instead. |
static Http.Cookies |
cookies(Result result)
Deprecated.
use
Result.cookies() instead. |
static FakeApplication |
fakeApplication()
Build a new fake application.
|
static FakeApplication |
fakeApplication(GlobalSettings global)
Build a new fake application.
|
static FakeApplication |
fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration)
Build a new fake application.
|
static FakeApplication |
fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration,
GlobalSettings global)
Build a new fake application.
|
static FakeApplication |
fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration,
java.util.List<java.lang.String> additionalPlugin)
Build a new fake application.
|
static FakeApplication |
fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration,
java.util.List<java.lang.String> additionalPlugin,
GlobalSettings global)
Build a new fake application.
|
static FakeApplication |
fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration,
java.util.List<java.lang.String> additionalPlugins,
java.util.List<java.lang.String> withoutPlugins)
Build a new fake application.
|
static FakeApplication |
fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration,
java.util.List<java.lang.String> additionalPlugins,
java.util.List<java.lang.String> withoutPlugins,
GlobalSettings global)
Build a new fake application.
|
static GlobalSettings |
fakeGlobal()
A fake Global
|
static Http.RequestBuilder |
fakeRequest()
Build a new GET / fake request.
|
static Http.RequestBuilder |
fakeRequest(Call call)
Build a new fake request corresponding to a given route call
|
static Http.RequestBuilder |
fakeRequest(java.lang.String method,
java.lang.String uri)
Build a new fake request.
|
static Http.Flash |
flash(Result result)
Deprecated.
use
Result.flash() instead. |
static java.lang.String |
header(java.lang.String header,
Result result)
Deprecated.
use
Result.header(String) instead. |
static java.util.Map<java.lang.String,java.lang.String> |
headers(Result result)
Deprecated.
use
Result.headers() instead. |
static java.util.Map<java.lang.String,java.lang.String> |
inMemoryDatabase()
Constructs a in-memory (h2) database configuration to add to a FakeApplication.
|
static java.util.Map<java.lang.String,java.lang.String> |
inMemoryDatabase(java.lang.String name)
Constructs a in-memory (h2) database configuration to add to a FakeApplication.
|
static java.util.Map<java.lang.String,java.lang.String> |
inMemoryDatabase(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> options)
Constructs a in-memory (h2) database configuration to add to a FakeApplication.
|
static <V> V |
invokeWithContext(Http.RequestBuilder requestBuilder,
java.util.concurrent.Callable<V> callable)
Calls a Callable which invokes a Controller or some other method with a Context
|
static java.lang.String |
redirectLocation(Result result)
Deprecated.
use
Result.redirectLocation() instead. |
static Result |
route(Application app,
Call call) |
static Result |
route(Application app,
Call call,
long timeout) |
static Result |
route(Application app,
Http.RequestBuilder requestBuilder) |
static Result |
route(Application app,
Http.RequestBuilder requestBuilder,
byte[] body)
Deprecated.
|
static Result |
route(Application app,
Http.RequestBuilder requestBuilder,
byte[] body,
long timeout)
Deprecated.
|
static Result |
route(Application app,
Http.RequestBuilder requestBuilder,
long timeout) |
static Result |
route(Call call) |
static Result |
route(Call call,
long timeout) |
static Result |
route(Http.RequestBuilder requestBuilder) |
static Result |
route(Http.RequestBuilder requestBuilder,
byte[] body)
Deprecated.
|
static Result |
route(Http.RequestBuilder requestBuilder,
byte[] body,
long timeout)
Deprecated.
|
static Result |
route(Http.RequestBuilder requestBuilder,
long timeout) |
static Result |
routeAndCall(java.lang.Class<? extends play.api.routing.Router> router,
Http.RequestBuilder requestBuilder,
long timeout) |
static Result |
routeAndCall(Http.RequestBuilder requestBuilder,
long timeout) |
static Result |
routeAndCall(play.api.routing.Router router,
Http.RequestBuilder requestBuilder) |
static Result |
routeAndCall(play.api.routing.Router router,
Http.RequestBuilder requestBuilder,
long timeout) |
static void |
running(Application application,
java.lang.Runnable block)
Executes a block of code in a running application.
|
static void |
running(TestServer server,
java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriver,
F.Callback<TestBrowser> block)
Executes a block of code in a running server, with a test browser.
|
static void |
running(TestServer server,
java.lang.Runnable block)
Executes a block of code in a running server.
|
static void |
running(TestServer server,
org.openqa.selenium.WebDriver webDriver,
F.Callback<TestBrowser> block)
Executes a block of code in a running server, with a test browser.
|
static Http.Session |
session(Result result)
Deprecated.
use
Result.session() instead. |
static void |
start(Application application)
Starts a new application.
|
static void |
start(TestServer server)
Starts a Test server.
|
static int |
status(Result result)
Deprecated.
use
Result.status() instead. |
static void |
stop(Application application)
Stops an application.
|
static void |
stop(TestServer server)
Stops a Test server.
|
static TestBrowser |
testBrowser()
Creates a Test Browser.
|
static TestBrowser |
testBrowser(java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriver)
Creates a Test Browser.
|
static TestBrowser |
testBrowser(java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriver,
int port)
Creates a Test Browser.
|
static TestBrowser |
testBrowser(int port)
Creates a Test Browser.
|
static TestBrowser |
testBrowser(org.openqa.selenium.WebDriver of)
Creates a Test Browser.
|
static TestBrowser |
testBrowser(org.openqa.selenium.WebDriver of,
int port)
Creates a Test Browser.
|
static TestServer |
testServer()
Creates a new Test server listening on port defined by configuration setting "testserver.port" (defaults to 19001).
|
static TestServer |
testServer(Application app)
Creates a new Test server listening on port defined by configuration setting "testserver.port" (defaults to 19001) and using the given FakeApplication.
|
static TestServer |
testServer(int port)
Creates a new Test server.
|
static TestServer |
testServer(int port,
Application app)
Creates a new Test server.
|
public static java.lang.String GET
public static java.lang.String POST
public static java.lang.String PUT
public static java.lang.String DELETE
public static java.lang.String HEAD
public static java.lang.Class<? extends org.openqa.selenium.WebDriver> HTMLUNIT
public static java.lang.Class<? extends org.openqa.selenium.WebDriver> FIREFOX
public static final long DEFAULT_TIMEOUT
public static <V> V invokeWithContext(Http.RequestBuilder requestBuilder, java.util.concurrent.Callable<V> callable)
public static Http.RequestBuilder fakeRequest()
public static Http.RequestBuilder fakeRequest(java.lang.String method, java.lang.String uri)
public static Http.RequestBuilder fakeRequest(Call call)
public static FakeApplication fakeApplication()
public static FakeApplication fakeApplication(GlobalSettings global)
public static GlobalSettings fakeGlobal()
public static java.util.Map<java.lang.String,java.lang.String> inMemoryDatabase()
public static java.util.Map<java.lang.String,java.lang.String> inMemoryDatabase(java.lang.String name)
public static java.util.Map<java.lang.String,java.lang.String> inMemoryDatabase(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> options)
public static FakeApplication fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration)
public static FakeApplication fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration, GlobalSettings global)
public static FakeApplication fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration, java.util.List<java.lang.String> additionalPlugin)
public static FakeApplication fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration, java.util.List<java.lang.String> additionalPlugin, GlobalSettings global)
public static FakeApplication fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration, java.util.List<java.lang.String> additionalPlugins, java.util.List<java.lang.String> withoutPlugins)
public static FakeApplication fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration, java.util.List<java.lang.String> additionalPlugins, java.util.List<java.lang.String> withoutPlugins, GlobalSettings global)
@Deprecated public static int status(Result result)
Result.status()
instead.@Deprecated public static java.lang.String redirectLocation(Result result)
Result.redirectLocation()
instead.@Deprecated public static Http.Flash flash(Result result)
Result.flash()
instead.@Deprecated public static Http.Session session(Result result)
Result.session()
instead.@Deprecated public static Http.Cookie cookie(java.lang.String name, Result result)
Result.cookie(String)
instead.@Deprecated public static Http.Cookies cookies(Result result)
Result.cookies()
instead.@Deprecated public static java.lang.String header(java.lang.String header, Result result)
Result.header(String)
instead.@Deprecated public static java.util.Map<java.lang.String,java.lang.String> headers(Result result)
Result.headers()
instead.@Deprecated public static java.lang.String contentType(play.twirl.api.Content content)
Result.contentType()
instead.@Deprecated public static java.lang.String contentType(Result result)
Result.contentType()
instead.@Deprecated public static java.lang.String charset(Result result)
Result.charset()
instead.public static byte[] contentAsBytes(Result result)
public static byte[] contentAsBytes(Result result, long timeout)
public static byte[] contentAsBytes(play.twirl.api.Content content)
public static java.lang.String contentAsString(play.twirl.api.Content content)
public static java.lang.String contentAsString(Result result)
public static java.lang.String contentAsString(Result result, long timeout)
public static Result routeAndCall(Http.RequestBuilder requestBuilder, long timeout)
public static Result routeAndCall(java.lang.Class<? extends play.api.routing.Router> router, Http.RequestBuilder requestBuilder, long timeout)
public static Result routeAndCall(play.api.routing.Router router, Http.RequestBuilder requestBuilder)
public static Result routeAndCall(play.api.routing.Router router, Http.RequestBuilder requestBuilder, long timeout)
public static Result route(Application app, Call call)
public static Result route(Application app, Call call, long timeout)
public static Result route(Http.RequestBuilder requestBuilder)
public static Result route(Http.RequestBuilder requestBuilder, long timeout)
public static Result route(Application app, Http.RequestBuilder requestBuilder)
public static Result route(Application app, Http.RequestBuilder requestBuilder, long timeout)
@Deprecated public static Result route(Application app, Http.RequestBuilder requestBuilder, byte[] body)
@Deprecated public static Result route(Application app, Http.RequestBuilder requestBuilder, byte[] body, long timeout)
@Deprecated public static Result route(Http.RequestBuilder requestBuilder, byte[] body)
@Deprecated public static Result route(Http.RequestBuilder requestBuilder, byte[] body, long timeout)
public static void start(Application application)
public static void stop(Application application)
public static void running(Application application, java.lang.Runnable block)
public static TestServer testServer()
public static TestServer testServer(Application app)
public static TestServer testServer(int port)
public static TestServer testServer(int port, Application app)
public static void start(TestServer server)
public static void stop(TestServer server)
public static void running(TestServer server, java.lang.Runnable block)
public static void running(TestServer server, java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriver, F.Callback<TestBrowser> block)
public static void running(TestServer server, org.openqa.selenium.WebDriver webDriver, F.Callback<TestBrowser> block)
public static TestBrowser testBrowser()
public static TestBrowser testBrowser(int port)
public static TestBrowser testBrowser(java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriver)
public static TestBrowser testBrowser(java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriver, int port)
public static TestBrowser testBrowser(org.openqa.selenium.WebDriver of, int port)
public static TestBrowser testBrowser(org.openqa.selenium.WebDriver of)