Class HttpApp
java.lang.Object
org.apache.pekko.http.javadsl.server.directives.BasicDirectives
org.apache.pekko.http.javadsl.server.directives.CacheConditionDirectives
org.apache.pekko.http.javadsl.server.directives.CodingDirectives
org.apache.pekko.http.javadsl.server.directives.CookieDirectives
org.apache.pekko.http.javadsl.server.directives.DebuggingDirectives
org.apache.pekko.http.javadsl.server.directives.ExecutionDirectives
org.apache.pekko.http.javadsl.server.directives.FileAndResourceDirectives
org.apache.pekko.http.javadsl.server.directives.FileUploadDirectives
org.apache.pekko.http.javadsl.server.directives.FormFieldDirectives
org.apache.pekko.http.javadsl.server.directives.FutureDirectives
org.apache.pekko.http.javadsl.server.directives.HeaderDirectives
org.apache.pekko.http.javadsl.server.directives.AttributeDirectives
org.apache.pekko.http.javadsl.server.directives.HostDirectives
org.apache.pekko.http.javadsl.server.directives.MarshallingDirectives
org.apache.pekko.http.javadsl.server.directives.MethodDirectives
org.apache.pekko.http.javadsl.server.directives.MiscDirectives
org.apache.pekko.http.javadsl.server.directives.ParameterDirectives
org.apache.pekko.http.javadsl.server.directives.PathDirectives
org.apache.pekko.http.javadsl.server.directives.RangeDirectives
org.apache.pekko.http.javadsl.server.directives.RespondWithDirectives
Deprecated.
HttpApp this doesn't reflect the latest APIs, since Akka HTTP 10.2.0
DEPRECATED, consider https://github.com/apache/pekko-http-quickstart-java.g8 instead
 
Bootstrap trait for Http Server. It helps booting up a pekko-http server by only defining the desired routes. It offers additional hooks to modify the default behavior.
- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.pekko.http.javadsl.server.directives.SecurityDirectivesSecurityDirectives.ProvidedCredentials, SecurityDirectives.ProvidedCredentials$
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected AtomicReference<org.apache.pekko.actor.ActorSystem>Deprecated.Holds a reference to theActorSystemused to start this server.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidpostHttpBinding(ServerBinding binding) Deprecated.Hook that will be called just after the Http server binding is done.protected voidpostHttpBindingFailure(Throwable cause) Deprecated.Hook that will be called in case the Http server binding fails.protected voidpostServerShutdown(Optional<Throwable> failure, org.apache.pekko.actor.ActorSystem system) Deprecated.Hook that will be called just after the server termination.protected abstract Routeroutes()Deprecated.Override to implement the route that will be served by this http server.voidstartServer(String host, int port) Deprecated.Start a server on the specified host and port.voidstartServer(String host, int port, org.apache.pekko.actor.ActorSystem system) Deprecated.Start a server on the specified host and port, using the provided [[ActorSystem]] Note that this method is blocking.voidstartServer(String host, int port, ServerSettings settings) Deprecated.Start a server on the specified host and port, using the provided settings.voidstartServer(String host, int port, ServerSettings settings, Optional<org.apache.pekko.actor.ActorSystem> system) Deprecated.Start a server on the specified host and port, using the provided settings and [[ActorSystem]] if present.voidstartServer(String host, int port, ServerSettings settings, org.apache.pekko.actor.ActorSystem system) Deprecated.Start a server on the specified host and port, using the provided settings and [[ActorSystem]].protected CompletionStage<org.apache.pekko.Done>waitForShutdownSignal(org.apache.pekko.actor.ActorSystem system) Deprecated.Hook that lets the user specify the future that will signal the shutdown of the server whenever completed.Methods inherited from class org.apache.pekko.http.javadsl.server.directives.FramedEntityStreamingDirectivesattribute, 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, extractStrictEntity, extractStrictEntity, extractUnmatchedPath, extractUri, extractWebSocketUpgrade, 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, handle, handleExceptions, handleRejections, handleSync, 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, optionalAttribute, 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, toStrictEntity, toStrictEntity, validate, withExecutionContext, withLog, withMaterializer, withoutRequestTimeout, withoutSizeLimit, withPrecompressedMediaTypeSupport, withRangeSupport, withRequestTimeout, withRequestTimeout, withRequestTimeout, withRequestTimeout, withRequestTimeoutResponse, withSettings, withSizeLimitMethods inherited from class org.apache.pekko.http.javadsl.server.directives.TimeoutDirectivesextractRequestTimeout, withoutRequestTimeout, withRequestTimeout, withRequestTimeout, withRequestTimeout, withRequestTimeout, withRequestTimeoutResponseMethods inherited from class org.apache.pekko.http.javadsl.server.directives.WebSocketDirectivesextractOfferedWsProtocols, extractWebSocketUpgrade, handleWebSocketMessages, handleWebSocketMessagesForOptionalProtocol, handleWebSocketMessagesForProtocolMethods inherited from class org.apache.pekko.http.javadsl.server.directives.SecurityDirectivesauthenticateBasic, authenticateBasicAsync, authenticateBasicAsyncOptional, authenticateBasicOptional, authenticateBasicPF, authenticateBasicPFAsync, authenticateOAuth2, authenticateOAuth2Async, authenticateOAuth2AsyncOptional, authenticateOAuth2Optional, authenticateOrRejectWithChallenge, authenticateOrRejectWithChallenge, authorize, authorizeAsync, authorizeAsyncWithRequestContext, authorizeWithRequestContext, extractCredentialsMethods inherited from class org.apache.pekko.http.javadsl.server.directives.SchemeDirectivesextractScheme, schemeMethods inherited from class org.apache.pekko.http.javadsl.server.directives.RouteDirectivescomplete, 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, handle, handleSync, redirect, reject, reject, reject, route, routeMethods inherited from class org.apache.pekko.http.javadsl.server.directives.RespondWithDirectivesrespondWithDefaultHeader, respondWithDefaultHeaders, respondWithHeader, respondWithHeadersMethods inherited from class org.apache.pekko.http.javadsl.server.directives.RangeDirectiveswithRangeSupportMethods inherited from class org.apache.pekko.http.javadsl.server.directives.PathDirectivesignoreTrailingSlash, 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, redirectToTrailingSlashIfMissingMethods inherited from class org.apache.pekko.http.javadsl.server.directives.ParameterDirectivesparameter, parameter, parameterList, parameterList, parameterList, parameterMap, parameterMultiMap, parameterOptional, parameterOptional, parameterOrDefault, parameterRequiredValueMethods inherited from class org.apache.pekko.http.javadsl.server.directives.MiscDirectivesextractClientIP, rejectEmptyResponse, requestEntityEmpty, requestEntityPresent, selectPreferredLanguage, validate, withoutSizeLimit, withSizeLimitMethods inherited from class org.apache.pekko.http.javadsl.server.directives.MethodDirectivesdelete, extractMethod, get, head, method, options, overrideMethodWithParameter, patch, post, putMethods inherited from class org.apache.pekko.http.javadsl.server.directives.MarshallingDirectivescompleteWith, entity, handleWith, requestMethods inherited from class org.apache.pekko.http.javadsl.server.directives.HostDirectivesextractHost, host, host, host, hostMethods inherited from class org.apache.pekko.http.javadsl.server.directives.AttributeDirectivesattribute, optionalAttributeMethods inherited from class org.apache.pekko.http.javadsl.server.directives.HeaderDirectivescheckSameOrigin, headerValue, headerValueByName, headerValueByType, headerValuePF, optionalHeaderValue, optionalHeaderValueByName, optionalHeaderValueByType, optionalHeaderValuePFMethods inherited from class org.apache.pekko.http.javadsl.server.directives.FutureDirectivescompleteOrRecoverWith, onComplete, onComplete, onCompleteWithBreaker, onSuccess, onSuccessMethods inherited from class org.apache.pekko.http.javadsl.server.directives.FormFieldDirectivesformField, formField, formFieldList, formFieldList, formFieldList, formFieldMap, formFieldMultiMap, formFieldOptional, formFieldOptionalMethods inherited from class org.apache.pekko.http.javadsl.server.directives.FileUploadDirectivesfileUpload, fileUploadAll, storeUploadedFile, storeUploadedFilesMethods inherited from class org.apache.pekko.http.javadsl.server.directives.FileAndResourceDirectivesdefaultContentTypeResolver, 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, listDirectoryContentsMethods inherited from class org.apache.pekko.http.javadsl.server.directives.ExecutionDirectiveshandleExceptions, handleRejectionsMethods inherited from class org.apache.pekko.http.javadsl.server.directives.DebuggingDirectiveslogRequest, logRequest, logRequest, logRequestResult, logRequestResultOptional, logResult, logResult, logResultMethods inherited from class org.apache.pekko.http.javadsl.server.directives.CookieDirectivescookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, optionalCookie, setCookie, setCookieMethods inherited from class org.apache.pekko.http.javadsl.server.directives.CodingDirectivesdecodeRequest, decodeRequestWith, decodeRequestWith, encodeResponse, encodeResponseWith, requestEncodedWith, responseEncodingAccepted, withPrecompressedMediaTypeSupportMethods inherited from class org.apache.pekko.http.javadsl.server.directives.CacheConditionDirectivesconditional, conditional, conditional, conditionalMethods inherited from class org.apache.pekko.http.javadsl.server.directives.BasicDirectivescancelRejection, cancelRejections, cancelRejections, extract, extractActorSystem, extractDataBytes, extractEntity, extractExecutionContext, extractLog, extractMatchedPath, extractMaterializer, extractParserSettings, extractRequest, extractRequestContext, extractRequestEntity, extractSettings, extractStrictEntity, extractStrictEntity, extractStrictEntity, extractStrictEntity, extractUnmatchedPath, extractUri, mapInnerRoute, mapRejections, mapRequest, mapRequestContext, mapResponse, mapResponseEntity, mapResponseHeaders, mapRouteResult, mapRouteResultFuture, mapRouteResultPF, mapRouteResultWith, mapRouteResultWithPF, mapSettings, mapUnmatchedPath, pass, provide, recoverRejections, recoverRejectionsWith, toStrictEntity, toStrictEntity, toStrictEntity, toStrictEntity, withExecutionContext, withLog, withMaterializer, withSettings
- 
Field Details- 
systemReferenceDeprecated.Holds a reference to theActorSystemused to start this server. Stopping this system will interfere with the proper functioning condition of the server.
 
- 
- 
Constructor Details- 
HttpApppublic HttpApp()Deprecated.
 
- 
- 
Method Details- 
startServerDeprecated.Start a server on the specified host and port. Note that this method is blocking.
- 
startServerpublic void startServer(String host, int port, org.apache.pekko.actor.ActorSystem system) throws ExecutionException, InterruptedException Deprecated.Start a server on the specified host and port, using the provided [[ActorSystem]] Note that this method is blocking.- Parameters:
- 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.
- Throws:
- ExecutionException
- InterruptedException
 
- 
startServerpublic void startServer(String host, int port, ServerSettings settings) throws ExecutionException, InterruptedException Deprecated.Start a server on the specified host and port, using the provided settings. Note that this method is blocking.
- 
startServerpublic void startServer(String host, int port, ServerSettings settings, org.apache.pekko.actor.ActorSystem system) throws ExecutionException, InterruptedException Deprecated.Start a server on the specified host and port, using the provided settings and [[ActorSystem]]. Note that this method is blocking.- Parameters:
- 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.
- Throws:
- ExecutionException
- InterruptedException
 
- 
startServerpublic void startServer(String host, int port, ServerSettings settings, Optional<org.apache.pekko.actor.ActorSystem> system) throws ExecutionException, InterruptedException Deprecated.Start a server on the specified host and port, using the provided settings and [[ActorSystem]] if present. Note that this method is blocking. This method may throw anExecutionExceptionorInterruptedExceptionif the future that signals that the server should shutdown is interrupted or cancelled.- Parameters:
- 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.
- Throws:
- ExecutionException
- InterruptedException
 
- 
postServerShutdownprotected void postServerShutdown(Optional<Throwable> failure, org.apache.pekko.actor.ActorSystem system) Deprecated.Hook that will be called just after the server termination. Override this method if you want to perform some cleanup actions after the server is stopped. Thefailureparameter contains aThrowableonly if there has been a problem shutting down the server.
- 
postHttpBindingDeprecated.Hook that will be called just after the Http server binding is done. Override this method if you want to perform some actions after the server is up.
- 
postHttpBindingFailureDeprecated.Hook that will be called in case the Http server binding fails. Override this method if you want to perform some actions after the server binding failed.
- 
waitForShutdownSignalprotected CompletionStage<org.apache.pekko.Done> waitForShutdownSignal(org.apache.pekko.actor.ActorSystem system) Deprecated.Hook that lets the user specify the future that will signal the shutdown of the server whenever completed.
- 
routesDeprecated.Override to implement the route that will be served by this http server.
 
-