Class HttpApp
java.lang.Object
org.apache.pekko.http.scaladsl.server.HttpApp
- All Implemented Interfaces:
- ToNameReceptacleEnhancements,- Directives,- AttributeDirectives,- BasicDirectives,- CacheConditionDirectives,- CodingDirectives,- CookieDirectives,- DebuggingDirectives,- ExecutionDirectives,- FileAndResourceDirectives,- FileUploadDirectives,- FormFieldDirectives,- FormFieldDirectivesInstances,- FramedEntityStreamingDirectives,- FutureDirectives,- HeaderDirectives,- HostDirectives,- MarshallingDirectives,- MethodDirectives,- MiscDirectives,- ParameterDirectives,- ParameterDirectivesInstances,- PathDirectives,- RangeDirectives,- RespondWithDirectives,- RouteDirectives,- SchemeDirectives,- SecurityDirectives,- TimeoutDirectives,- WebSocketDirectives,- ImplicitPathMatcherConstruction,- PathMatchers,- RouteConcatenation
Deprecated.
HttpApp this doesn't reflect the latest APIs. Since Akka HTTP 10.2.0.
DEPRECATED, consider https://github.com/apache/pekko-http-quickstart-scala.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 interface org.apache.pekko.http.scaladsl.server.directives.FileAndResourceDirectivesFileAndResourceDirectives.DirectoryRenderer, FileAndResourceDirectives.DirectoryRenderer$, FileAndResourceDirectives.LowLevelDirectoryRenderer, FileAndResourceDirectives.ResourceFile, FileAndResourceDirectives.ResourceFile$Nested classes/interfaces inherited from interface org.apache.pekko.http.scaladsl.server.directives.FormFieldDirectivesFormFieldDirectives.FieldSpec, FormFieldDirectives.FieldSpec$, FormFieldDirectives.Impl$Nested classes/interfaces inherited from interface org.apache.pekko.http.scaladsl.server.directives.ParameterDirectivesParameterDirectives.ParamSpec, ParameterDirectives.ParamSpec$Nested classes/interfaces inherited from interface org.apache.pekko.http.scaladsl.server.directives.PathDirectivesPathDirectives.TrailingRetryRejection$Nested classes/interfaces inherited from interface org.apache.pekko.http.scaladsl.server.PathMatchersPathMatchers.HexIntNumber$, PathMatchers.HexLongNumber$, PathMatchers.IntNumber$, PathMatchers.LongNumber$, PathMatchers.NumberMatcher<T>, PathMatchers.PathEnd$, PathMatchers.Remaining$, PathMatchers.RemainingPath$, PathMatchers.Segment$, PathMatchers.Slash$Nested classes/interfaces inherited from interface org.apache.pekko.http.scaladsl.server.RouteConcatenationRouteConcatenation.RouteWithConcatenation
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionscala.util.Try<Http.ServerBinding>binding()Deprecated.It tries to retrieve theServerBindingif the server has been successfully started.PathMatcher<scala.Tuple1<Object>>Deprecated.Deprecated.Accessor for nested Scala objectDeprecated.Accessor for nested Scala objectDeprecated.Accessor for nested Scala objectPathMatcher<scala.Tuple1<UUID>>JavaUUID()Deprecated.Deprecated.Accessor for nested Scala objectPathMatcher<scala.runtime.BoxedUnit>Neutral()Deprecated.PathEnd()Deprecated.Accessor for nested Scala objectprotected voidpostHttpBinding(Http.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(scala.util.Try<org.apache.pekko.Done> attempt, org.apache.pekko.actor.ActorSystem system) Deprecated.Hook that will be called just after the server termination.Deprecated.Accessor for nested Scala objectDeprecated.Accessor for nested Scala objectprotected abstract scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> routes()Deprecated.Override to implement the routes that will be served by this http server.Segment()Deprecated.Accessor for nested Scala objectPathMatcher<scala.Tuple1<scala.collection.immutable.List<String>>>Segments()Deprecated.Slash()Deprecated.Accessor for nested Scala objectvoidstartServer(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 providedActorSystem.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, org.apache.pekko.actor.ActorSystem system) Deprecated.Start a server on the specified host and port, using the provided settings andActorSystem.voidstartServer(String host, int port, ServerSettings settings, scala.Option<org.apache.pekko.actor.ActorSystem> system) Deprecated.Start a server on the specified host and port, using the provided settings andActorSystemif present.protected AtomicReference<org.apache.pekko.actor.ActorSystem>Deprecated.ActorSystemused to start this server.protected scala.concurrent.Future<org.apache.pekko.Done>waitForShutdownSignal(org.apache.pekko.actor.ActorSystem system, scala.concurrent.ExecutionContext ec) Deprecated.Hook that lets the user specify the future that will signal the shutdown of the server whenever completed.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.AttributeDirectivesattribute, optionalAttributeMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.BasicDirectivescancelRejection, cancelRejections, cancelRejections, extract, extractActorSystem, extractDataBytes, 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, textract, toStrictEntity, toStrictEntity, tprovide, withExecutionContext, withLog, withMaterializer, withSettingsMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.CacheConditionDirectivesconditional, conditional, conditional, conditionalMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.CodingDirectivesdecodeRequest, decodeRequestWith, decodeRequestWith, encodeResponse, encodeResponseWith, requestEncodedWith, responseEncodingAccepted, withPrecompressedMediaTypeSupportMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.CookieDirectivescookie, deleteCookie, deleteCookie, findCookie, optionalCookie, setCookieMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.DebuggingDirectiveslogRequest, logRequestResult, logResultMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.ExecutionDirectiveshandleExceptions, handleRejectionsMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.FileAndResourceDirectives_defaultClassLoader, conditionalFor, getFromBrowseableDirectories, getFromBrowseableDirectory, getFromDirectory, getFromFile, getFromFile, getFromFile, getFromResource, getFromResource, getFromResourceDirectory, listDirectoryContentsMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.FileUploadDirectivesfileUpload, fileUploadAll, storeUploadedFile, storeUploadedFilesMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.FormFieldDirectivesformFieldMap, formFieldMultiMap, formFieldSeqMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.FormFieldDirectivesInstancesformField, formField, formField, formField, formField, formField, formField, formField, formField, formField, formField, formField, formField, formField, formField, formField, formField, formField, formField, formField, formField, formField, formFields, formFields, formFields, formFields, formFields, formFields, formFields, formFields, formFields, formFields, formFields, formFields, formFields, formFields, formFields, formFields, formFields, formFields, formFields, formFields, formFields, formFieldsMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.FramedEntityStreamingDirectivesasSourceOf, asSourceOf, asSourceOfInternalMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.FutureDirectivescompleteOrRecoverWith, onComplete, onCompleteWithBreaker, onSuccessMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.HeaderDirectivescheckSameOrigin, headerValue, headerValueByName, headerValueByType, headerValuePF, optionalHeaderValue, optionalHeaderValueByName, optionalHeaderValueByType, optionalHeaderValuePF, optionalValueMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.HostDirectivesextractHost, host, host, hostMethods inherited from interface org.apache.pekko.http.scaladsl.server.ImplicitPathMatcherConstruction_regex2PathMatcher, _segmentStringToPathMatcher, _stringExtractionPair2PathMatcher, _stringNameOptionReceptacle2PathMatcher, _valueMap2PathMatcherMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.MarshallingDirectivesas, completeWith, entity, handleWith, instanceOfMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.MethodDirectivesdelete, extractMethod, get, head, method, options, overrideMethodWithParameter, patch, post, putMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.MiscDirectivesextractClientIP, rejectEmptyResponse, requestEntityEmpty, requestEntityPresent, selectPreferredLanguage, validate, withoutSizeLimit, withSizeLimitMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.ParameterDirectivesparameterMap, parameterMultiMap, parameterSeqMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.ParameterDirectivesInstancesparameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameters, parameters, parameters, parameters, parameters, parameters, parameters, parameters, parameters, parameters, parameters, parameters, parameters, parameters, parameters, parameters, parameters, parameters, parameters, parameters, parameters, parametersMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.PathDirectivesignoreTrailingSlash, path, pathEnd, pathEndOrSingleSlash, pathPrefix, pathPrefixTest, pathSingleSlash, pathSuffix, pathSuffixTest, rawPathPrefix, rawPathPrefixTest, redirectToNoTrailingSlashIfPresent, redirectToTrailingSlashIfMissingMethods inherited from interface org.apache.pekko.http.scaladsl.server.PathMatchersnot, nothingMatcher, Segments, Segments, separateOnSlashesMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.RangeDirectiveswithRangeSupportMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.RespondWithDirectivesrespondWithDefaultHeader, respondWithDefaultHeaders, respondWithDefaultHeaders, respondWithHeader, respondWithHeaders, respondWithHeadersMethods inherited from interface org.apache.pekko.http.scaladsl.server.RouteConcatenation_enhanceRouteWithConcatenation, concatMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.RouteDirectivescomplete, complete, complete, failWith, handle, handle, handle, handleSync, handleSync, handleSync, redirect, reject, rejectMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.SchemeDirectivesextractScheme, schemeMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.SecurityDirectivesauthenticateBasic, authenticateBasicAsync, authenticateBasicPF, authenticateBasicPFAsync, authenticateOAuth2, authenticateOAuth2Async, authenticateOAuth2PF, authenticateOAuth2PFAsync, authenticateOrRejectWithChallenge, authenticateOrRejectWithChallenge, authorize, authorize, authorizeAsync, authorizeAsync, extractCredentials, extractCredentialsAndAuthenticateOrRejectWithChallengeMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.TimeoutDirectivesextractRequestTimeout, withoutRequestTimeout, withRequestTimeout, withRequestTimeout, withRequestTimeout, withRequestTimeoutResponseMethods inherited from interface org.apache.pekko.http.scaladsl.common.ToNameReceptacleEnhancements_string2NR, _symbol2NRMethods inherited from interface org.apache.pekko.http.scaladsl.server.directives.WebSocketDirectivesextractOfferedWsProtocols, extractWebSocketUpgrade, handleWebSocketMessages, handleWebSocketMessagesForOptionalProtocol, handleWebSocketMessagesForProtocol
- 
Constructor Details- 
HttpApppublic HttpApp()Deprecated.
 
- 
- 
Method Details- 
DoubleNumberDeprecated.- Specified by:
- DoubleNumberin interface- PathMatchers
 
- 
HexIntNumberDeprecated.Description copied from interface:PathMatchersAccessor for nested Scala object- Specified by:
- HexIntNumberin interface- PathMatchers
- Returns:
- (undocumented)
 
- 
HexLongNumberDeprecated.Description copied from interface:PathMatchersAccessor for nested Scala object- Specified by:
- HexLongNumberin interface- PathMatchers
- Returns:
- (undocumented)
 
- 
IntNumberDeprecated.Description copied from interface:PathMatchersAccessor for nested Scala object- Specified by:
- IntNumberin interface- PathMatchers
- Returns:
- (undocumented)
 
- 
JavaUUIDDeprecated.- Specified by:
- JavaUUIDin interface- PathMatchers
 
- 
LongNumberDeprecated.Description copied from interface:PathMatchersAccessor for nested Scala object- Specified by:
- LongNumberin interface- PathMatchers
- Returns:
- (undocumented)
 
- 
NeutralDeprecated.- Specified by:
- Neutralin interface- PathMatchers
 
- 
PathEndDeprecated.Description copied from interface:PathMatchersAccessor for nested Scala object- Specified by:
- PathEndin interface- PathMatchers
- Returns:
- (undocumented)
 
- 
RemainingDeprecated.Description copied from interface:PathMatchersAccessor for nested Scala object- Specified by:
- Remainingin interface- PathMatchers
- Returns:
- (undocumented)
 
- 
RemainingPathDeprecated.Description copied from interface:PathMatchersAccessor for nested Scala object- Specified by:
- RemainingPathin interface- PathMatchers
- Returns:
- (undocumented)
 
- 
SegmentDeprecated.Description copied from interface:PathMatchersAccessor for nested Scala object- Specified by:
- Segmentin interface- PathMatchers
- Returns:
- (undocumented)
 
- 
SegmentsDeprecated.- Specified by:
- Segmentsin interface- PathMatchers
 
- 
SlashDeprecated.Description copied from interface:PathMatchersAccessor for nested Scala object- Specified by:
- Slashin interface- PathMatchers
- Returns:
- (undocumented)
 
- 
bindingDeprecated.It tries to retrieve theServerBindingif the server has been successfully started. It fails otherwise. You can use this method to attempt to retrieve theServerBindingat any point in time to, for example, stop the server due to unexpected circumstances.- Returns:
- (undocumented)
 
- 
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.- Parameters:
- binding- (undocumented)
 
- 
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.- Parameters:
- cause- (undocumented)
 
- 
postServerShutdownprotected void postServerShutdown(scala.util.Try<org.apache.pekko.Done> attempt, 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. Theattemptparameter is represented with aTrytype that is successful only if the server was successfully shut down.- Parameters:
- attempt- (undocumented)
- system- (undocumented)
 
- 
routesDeprecated.Override to implement the routes that will be served by this http server.- Returns:
- (undocumented)
 
- 
startServerDeprecated.Start a server on the specified host and port. Note that this method is blocking- Parameters:
- host- (undocumented)
- port- (undocumented)
 
- 
startServerDeprecated.Start a server on the specified host and port, using the providedActorSystem. Note that this method is blocking- Parameters:
- system- ActorSystem to use for starting the app, if- nullis passed in a new default ActorSystem will be created instead, which will be terminated when the server is stopped.
- host- (undocumented)
- port- (undocumented)
 
- 
startServerDeprecated.Start a server on the specified host and port, using the provided settings. Note that this method is blocking.- Parameters:
- host- (undocumented)
- port- (undocumented)
- settings- (undocumented)
 
- 
startServerpublic void startServer(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 andActorSystem. Note that this method is blocking.- Parameters:
- system- ActorSystem to use for starting the app, if- nullis passed in a new default ActorSystem will be created instead, which will be terminated when the server is stopped.
- host- (undocumented)
- port- (undocumented)
- settings- (undocumented)
 
- 
startServerpublic void startServer(String host, int port, ServerSettings settings, scala.Option<org.apache.pekko.actor.ActorSystem> system) Deprecated.Start a server on the specified host and port, using the provided settings andActorSystemif present. Note that this method is blocking.- Parameters:
- system- ActorSystem to use for starting the app, if- Noneis passed in a new default ActorSystem will be created instead, which will be terminated when the server is stopped.
- host- (undocumented)
- port- (undocumented)
- settings- (undocumented)
 
- 
systemReferenceDeprecated.ActorSystemused to start this server. Stopping this system will interfere with the proper functioning condition of the server.- Returns:
- (undocumented)
 
- 
waitForShutdownSignalprotected scala.concurrent.Future<org.apache.pekko.Done> waitForShutdownSignal(org.apache.pekko.actor.ActorSystem system, scala.concurrent.ExecutionContext ec) Deprecated.Hook that lets the user specify the future that will signal the shutdown of the server whenever completed.- Parameters:
- system- (undocumented)
- ec- (undocumented)
- Returns:
- (undocumented)
 
 
-