public class Helpers
extends java.lang.Object
Constructor and Description |
---|
Helpers() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getDateTimeYyyyMMddHHmmss() |
static java.util.Map<java.lang.String,java.lang.String> |
getJVMInfo() |
static java.lang.String |
getLocalIpAddress() |
static java.util.Map<java.lang.String,java.lang.String> |
getOSInfo() |
static java.lang.String |
getQueryParameter(play.mvc.Http.Request request,
java.lang.String parameter)
Gets the value of to the given parameter in request's query string and trims whitespace.
|
static java.lang.String |
getQueryString(play.mvc.Http.Request request)
Returns the whole query string of the given Request including '?'.
|
static int |
getStringSize(java.lang.String str)
Gets the number of bytes in UTF-8 the given string has
|
static java.lang.String |
humanReadableByteCount(long bytes) |
static java.lang.String |
humanReadableDuration(java.time.Duration duration) |
static void |
initializeAndUnproxy(java.lang.Object... objs)
Initialize all given objects that are loaded lazily in a Hibernate object
|
static <T> T |
initializeAndUnproxy(T obj)
Initialize an object that is loaded lazily in a Hibernate object
|
static java.lang.Boolean |
isAjax()
Check if the request was made via Ajax or not.
|
static boolean |
isAllowedSuperuser(User user) |
static boolean |
isApiRequest(play.mvc.Http.Request request)
Checks if the HTTP request has an "Authorization: Bearer" header.
|
static boolean |
isHtmlRequest(play.mvc.Http.Request request) |
static boolean |
isHtmlRequest(play.api.mvc.RequestHeader request) |
static boolean |
isLocalhost() |
static boolean |
isSessionCookieRequest(play.mvc.Http.Request request)
Checks if the session has a field 'username'
|
static akka.stream.javadsl.Source<akka.util.ByteString,java.util.concurrent.CompletionStage<akka.stream.IOResult>> |
okFileStreamed(java.io.File file,
java.lang.Runnable handler)
Helper function to allow an action after a file was sent (e.g.
|
static java.util.Optional<java.lang.Long> |
parseLong(java.lang.String str) |
static java.lang.String |
urlDecode(java.lang.String str) |
static java.lang.String |
urlEncode(java.lang.String str) |
public static java.lang.Boolean isAjax()
public static boolean isHtmlRequest(play.mvc.Http.Request request)
public static boolean isHtmlRequest(play.api.mvc.RequestHeader request)
public static boolean isSessionCookieRequest(play.mvc.Http.Request request)
public static boolean isApiRequest(play.mvc.Http.Request request)
public static boolean isLocalhost()
public static java.lang.String getLocalIpAddress()
public static java.lang.String urlEncode(java.lang.String str)
public static java.lang.String urlDecode(java.lang.String str)
public static java.lang.String getQueryParameter(play.mvc.Http.Request request, java.lang.String parameter)
public static java.lang.String getQueryString(play.mvc.Http.Request request)
public static java.lang.String humanReadableByteCount(long bytes)
public static java.util.Map<java.lang.String,java.lang.String> getJVMInfo()
public static java.util.Map<java.lang.String,java.lang.String> getOSInfo()
public static java.lang.String humanReadableDuration(java.time.Duration duration)
public static java.lang.String getDateTimeYyyyMMddHHmmss()
public static void initializeAndUnproxy(java.lang.Object... objs)
public static <T> T initializeAndUnproxy(T obj)
public static boolean isAllowedSuperuser(User user)
public static akka.stream.javadsl.Source<akka.util.ByteString,java.util.concurrent.CompletionStage<akka.stream.IOResult>> okFileStreamed(java.io.File file, java.lang.Runnable handler)
public static java.util.Optional<java.lang.Long> parseLong(java.lang.String str)
public static int getStringSize(java.lang.String str)