@ApiMayChange public abstract class HttpApp extends AllDirectives
SecurityDirectives.ProvidedCredentials, SecurityDirectives.ProvidedCredentials$
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.atomic.AtomicReference<akka.actor.ActorSystem> |
systemReference
Holds a reference to the
ActorSystem used to start this server. |
Constructor and Description |
---|
HttpApp() |
Modifier and Type | Method and Description |
---|---|
protected void |
postHttpBinding(ServerBinding binding)
Hook that will be called just after the Http server binding is done.
|
protected void |
postHttpBindingFailure(java.lang.Throwable cause)
Hook that will be called in case the Http server binding fails.
|
protected void |
postServerShutdown(java.util.Optional<java.lang.Throwable> failure,
akka.actor.ActorSystem system)
Hook that will be called just after the server termination.
|
protected abstract Route |
routes()
Override to implement the route that will be served by this http server.
|
void |
startServer(java.lang.String host,
int port)
Start a server on the specified host and port.
|
void |
startServer(java.lang.String host,
int port,
akka.actor.ActorSystem system)
Start a server on the specified host and port, using the provided [[ActorSystem]]
Note that this method is blocking.
|
void |
startServer(java.lang.String host,
int port,
ServerSettings settings)
Start a server on the specified host and port, using the provided settings.
|
void |
startServer(java.lang.String host,
int port,
ServerSettings settings,
akka.actor.ActorSystem system)
Start a server on the specified host and port, using the provided settings and [[ActorSystem]].
|
void |
startServer(java.lang.String host,
int port,
ServerSettings settings,
java.util.Optional<akka.actor.ActorSystem> system)
Start a server on the specified host and port, using the provided settings and [[ActorSystem]] if present.
|
protected java.util.concurrent.CompletionStage<akka.Done> |
waitForShutdownSignal(akka.actor.ActorSystem system)
Hook that lets the user specify the future that will signal the shutdown of the server whenever completed.
|
authenticateBasic, authenticateBasicAsync, authenticateBasicAsyncOptional, authenticateBasicOptional, authenticateBasicPF, authenticateBasicPFAsync, authenticateOAuth2, authenticateOAuth2Async, authenticateOAuth2AsyncOptional, authenticateOAuth2Optional, authenticateOrRejectWithChallenge, authenticateOrRejectWithChallenge, authorize, authorizeAsync, authorizeAsyncWithRequestContext, authorizeWithRequestContext, cancelRejection, cancelRejections, cancelRejections, checkSameOrigin, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, completeOK, completeOKWithFuture, completeOKWithFuture, completeOKWithFuture, completeOKWithFutureString, completeOKWithFutureString, completeOKWithSource, completeOrRecoverWith, completeWith, completeWithFuture, completeWithFuture, completeWithFuture, completeWithFutureResponse, completeWithFutureStatus, completeWithFutureStatus, completeWithSource, concat, concat, conditional, conditional, conditional, conditional, cookie, decodeRequest, decodeRequestWith, decodeRequestWith, defaultContentTypeResolver, defaultDirectoryRenderer, delete, deleteCookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, encodeResponse, encodeResponseWith, entity, entityAsSourceOf, extract, extractActorSystem, extractClientIP, extractCredentials, extractDataBytes, extractEntity, extractExecutionContext, extractHost, extractLog, extractMatchedPath, extractMaterializer, extractMethod, extractOfferedWsProtocols, extractParserSettings, extractRequest, extractRequestContext, extractRequestEntity, extractRequestTimeout, extractScheme, extractSettings, extractStrictEntity, extractStrictEntity, extractUnmatchedPath, extractUpgradeToWebSocket, extractUri, failWith, fileUpload, fileUploadAll, formField, formField, formFieldList, formFieldList, formFieldList, formFieldMap, formFieldMultiMap, formFieldOptional, formFieldOptional, get, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectory, getFromBrowseableDirectory, getFromBrowseableDirectory, getFromBrowseableDirectory, getFromDirectory, getFromDirectory, getFromFile, getFromFile, getFromFile, getFromFile, getFromFile, getFromResource, getFromResource, getFromResource, getFromResource, getFromResourceDirectory, getFromResourceDirectory, getFromResourceDirectory, getFromResourceDirectory, handleExceptions, handleRejections, handleWebSocketMessages, handleWebSocketMessagesForOptionalProtocol, handleWebSocketMessagesForProtocol, handleWith, head, headerValue, headerValueByName, headerValueByType, headerValuePF, host, host, host, host, ignoreTrailingSlash, listDirectoryContents, listDirectoryContents, listDirectoryContents, listDirectoryContents, logRequest, logRequest, logRequest, logRequestResult, logRequestResultOptional, logResult, logResult, logResult, mapInnerRoute, mapRejections, mapRequest, mapRequestContext, mapResponse, mapResponseEntity, mapResponseHeaders, mapRouteResult, mapRouteResultFuture, mapRouteResultPF, mapRouteResultWith, mapRouteResultWithPF, mapSettings, mapUnmatchedPath, method, onComplete, onComplete, onCompleteWithBreaker, onSuccess, onSuccess, optionalCookie, optionalHeaderValue, optionalHeaderValueByName, optionalHeaderValueByType, optionalHeaderValuePF, options, overrideMethodWithParameter, parameter, parameter, parameterList, parameterList, parameterList, parameterMap, parameterMultiMap, parameterOptional, parameterOptional, parameterOrDefault, parameterRequiredValue, pass, patch, path, path, path, path, path, path, pathEnd, pathEndOrSingleSlash, pathPrefix, pathPrefix, pathPrefix, pathPrefix, pathPrefix, pathPrefix, pathPrefixTest, pathPrefixTest, pathPrefixTest, pathPrefixTest, pathSingleSlash, pathSuffix, pathSuffix, pathSuffix, pathSuffix, pathSuffixTest, pathSuffixTest, pathSuffixTest, pathSuffixTest, post, provide, put, rawPathPrefix, rawPathPrefix, rawPathPrefix, rawPathPrefix, rawPathPrefixTest, rawPathPrefixTest, rawPathPrefixTest, rawPathPrefixTest, recoverRejections, recoverRejectionsWith, redirect, redirectToNoTrailingSlashIfPresent, redirectToTrailingSlashIfMissing, reject, reject, reject, rejectEmptyResponse, request, requestEncodedWith, requestEntityEmpty, requestEntityPresent, respondWithDefaultHeader, respondWithDefaultHeaders, respondWithHeader, respondWithHeaders, responseEncodingAccepted, route, route, scheme, selectPreferredLanguage, setCookie, setCookie, storeUploadedFile, storeUploadedFiles, toStrictEntity, toStrictEntity, uploadedFile, validate, withExecutionContext, withLog, withMaterializer, withoutRequestTimeout, withoutSizeLimit, withPrecompressedMediaTypeSupport, withRangeSupport, withRequestTimeout, withRequestTimeout, withRequestTimeoutResponse, withSettings, withSizeLimit
extractRequestTimeout, withoutRequestTimeout, withRequestTimeout, withRequestTimeout, withRequestTimeoutResponse
extractOfferedWsProtocols, extractUpgradeToWebSocket, handleWebSocketMessages, handleWebSocketMessagesForOptionalProtocol, handleWebSocketMessagesForProtocol
authenticateBasic, authenticateBasicAsync, authenticateBasicAsyncOptional, authenticateBasicOptional, authenticateBasicPF, authenticateBasicPFAsync, authenticateOAuth2, authenticateOAuth2Async, authenticateOAuth2AsyncOptional, authenticateOAuth2Optional, authenticateOrRejectWithChallenge, authenticateOrRejectWithChallenge, authorize, authorizeAsync, authorizeAsyncWithRequestContext, authorizeWithRequestContext, extractCredentials
extractScheme, scheme
complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, complete, completeOK, completeOKWithFuture, completeOKWithFuture, completeOKWithFuture, completeOKWithFutureString, completeOKWithFutureString, completeWithFuture, completeWithFuture, completeWithFuture, completeWithFutureResponse, completeWithFutureStatus, completeWithFutureStatus, concat, concat, failWith, redirect, reject, reject, reject, route, route
respondWithDefaultHeader, respondWithDefaultHeaders, respondWithHeader, respondWithHeaders
withRangeSupport
ignoreTrailingSlash, path, path, path, path, path, path, pathEnd, pathEndOrSingleSlash, pathPrefix, pathPrefix, pathPrefix, pathPrefix, pathPrefix, pathPrefix, pathPrefixTest, pathPrefixTest, pathPrefixTest, pathPrefixTest, pathSingleSlash, pathSuffix, pathSuffix, pathSuffix, pathSuffix, pathSuffixTest, pathSuffixTest, pathSuffixTest, pathSuffixTest, rawPathPrefix, rawPathPrefix, rawPathPrefix, rawPathPrefix, rawPathPrefixTest, rawPathPrefixTest, rawPathPrefixTest, rawPathPrefixTest, redirectToNoTrailingSlashIfPresent, redirectToTrailingSlashIfMissing
parameter, parameter, parameterList, parameterList, parameterList, parameterMap, parameterMultiMap, parameterOptional, parameterOptional, parameterOrDefault, parameterRequiredValue
extractClientIP, rejectEmptyResponse, requestEntityEmpty, requestEntityPresent, selectPreferredLanguage, validate, withoutSizeLimit, withSizeLimit
delete, extractMethod, get, head, method, options, overrideMethodWithParameter, patch, post, put
completeWith, entity, handleWith, request
extractHost, host, host, host, host
checkSameOrigin, headerValue, headerValueByName, headerValueByType, headerValuePF, optionalHeaderValue, optionalHeaderValueByName, optionalHeaderValueByType, optionalHeaderValuePF
completeOrRecoverWith, onComplete, onComplete, onCompleteWithBreaker, onSuccess, onSuccess
formField, formField, formFieldList, formFieldList, formFieldList, formFieldMap, formFieldMultiMap, formFieldOptional, formFieldOptional
fileUpload, fileUploadAll, storeUploadedFile, storeUploadedFiles, uploadedFile
defaultContentTypeResolver, defaultDirectoryRenderer, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectory, getFromBrowseableDirectory, getFromBrowseableDirectory, getFromBrowseableDirectory, getFromDirectory, getFromDirectory, getFromFile, getFromFile, getFromFile, getFromFile, getFromFile, getFromResource, getFromResource, getFromResource, getFromResource, getFromResourceDirectory, getFromResourceDirectory, getFromResourceDirectory, getFromResourceDirectory, listDirectoryContents, listDirectoryContents, listDirectoryContents, listDirectoryContents
handleExceptions, handleRejections
logRequest, logRequest, logRequest, logRequestResult, logRequestResultOptional, logResult, logResult, logResult
cookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, optionalCookie, setCookie, setCookie
decodeRequest, decodeRequestWith, decodeRequestWith, encodeResponse, encodeResponseWith, requestEncodedWith, responseEncodingAccepted, withPrecompressedMediaTypeSupport
conditional, conditional, conditional, conditional
cancelRejection, cancelRejections, cancelRejections, extract, extractActorSystem, extractDataBytes, extractEntity, extractExecutionContext, extractLog, extractMatchedPath, extractMaterializer, extractParserSettings, extractRequest, extractRequestContext, extractRequestEntity, extractSettings, extractStrictEntity, extractStrictEntity, extractUnmatchedPath, extractUri, mapInnerRoute, mapRejections, mapRequest, mapRequestContext, mapResponse, mapResponseEntity, mapResponseHeaders, mapRouteResult, mapRouteResultFuture, mapRouteResultPF, mapRouteResultWith, mapRouteResultWithPF, mapSettings, mapUnmatchedPath, pass, provide, recoverRejections, recoverRejectionsWith, toStrictEntity, toStrictEntity, withExecutionContext, withLog, withMaterializer, withSettings
protected java.util.concurrent.atomic.AtomicReference<akka.actor.ActorSystem> systemReference
ActorSystem
used to start this server. Stopping this system will interfere with the proper functioning condition of the server.public void startServer(java.lang.String host, int port) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.lang.InterruptedException
public void startServer(java.lang.String host, int port, akka.actor.ActorSystem system) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
system
- ActorSystem to use for starting the app,
if null is passed in a new default ActorSystem will be created instead, which will
be terminated when the server is stopped.java.util.concurrent.ExecutionException
java.lang.InterruptedException
public void startServer(java.lang.String host, int port, ServerSettings settings) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.lang.InterruptedException
public void startServer(java.lang.String host, int port, ServerSettings settings, akka.actor.ActorSystem system) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
system
- ActorSystem to use for starting the app,
if null is passed in a new default ActorSystem will be created instead, which will
be terminated when the server is stopped.java.util.concurrent.ExecutionException
java.lang.InterruptedException
public void startServer(java.lang.String host, int port, ServerSettings settings, java.util.Optional<akka.actor.ActorSystem> system) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
ExecutionException
or InterruptedException
if the future that signals that
the server should shutdown is interrupted or cancelled.system
- ActorSystem to use for starting the app,
if an empty Optional is passed in a new default ActorSystem will be created instead, which will
be terminated when the server is stopped.java.util.concurrent.ExecutionException
java.lang.InterruptedException
protected void postServerShutdown(java.util.Optional<java.lang.Throwable> failure, akka.actor.ActorSystem system)
failure
parameter contains a Throwable
only if there has been a problem shutting down the server.protected void postHttpBinding(ServerBinding binding)
protected void postHttpBindingFailure(java.lang.Throwable cause)
protected java.util.concurrent.CompletionStage<akka.Done> waitForShutdownSignal(akka.actor.ActorSystem system)
protected abstract Route routes()