Package org.apache.nifi.web.server
Class JettyServer
java.lang.Object
org.apache.nifi.web.server.JettyServer
- All Implemented Interfaces:
ExtensionUiLoader,NiFiServer
Encapsulates the Jetty instance.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classExtension of Jetty'sAppclass to allow use of an already createdWebAppContext.private static final recordprivate static classTask that asynchronously processes any bundles that were submitted to have extension UIs loaded.private static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Stringprivate final Map<BundleCoordinate, List<org.eclipse.jetty.deploy.App>> private ClusterDetailsFactoryprivate UiExtensionMappingprivate Collection<org.eclipse.jetty.ee10.webapp.WebAppContext> private static final Stringprivate Collection<ContentViewer> private Collection<org.eclipse.jetty.ee10.webapp.WebAppContext> private static final Stringprivate static final Stringprivate static final Stringprivate DecommissionTaskprivate static final Stringprivate static final Stringprivate final org.eclipse.jetty.deploy.DeploymentManagerprivate DiagnosticsFactoryprivate static final Durationprivate ExtensionMappingprivate final JettyServer.ExtensionUiLoadTaskprivate final BlockingQueue<Bundle> private static final Stringprivate static final Stringprivate static final Stringprivate static final org.slf4j.Loggerprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate NarAutoLoaderprivate ExternalResourceProviderServiceprivate NiFiPropertiesprivate static final RequestFilterProviderprivate static final RequestFilterProviderprivate org.eclipse.jetty.server.Serverprivate static final Stringprivate SSLContextprivate StatusHistoryDumpFactoryprivate Bundleprivate static final Stringprivate static final intprivate org.eclipse.jetty.ee10.webapp.WebAppContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddDocsServlets(org.eclipse.jetty.ee10.webapp.WebAppContext webAppContext) private Map<String, ExternalResourceProvider> buildExternalResourceProviders(SSLContext sslContext, ExtensionManager extensionManager, Predicate<ExternalResourceDescriptor> filter) private voidprivate booleancontainsUiExtensionType(List<UiExtension> componentUiExtensionsForType, UiExtensionType extensionType) Returns whether or not the specified ui extensions already contains an extension of the specified type.private ExternalResourceProvidercreateProviderInstance(ExtensionManager extensionManager, String providerClass, String providerId, ExternalResourceProviderInitializationContext context) In case the provider class is not an implementation ofExternalResourceProviderthe method tries to instantiate it as aNarProvider.private StringextractComponentType(String line) Extracts the component type.private FileReturns a File object for the directory containing NIFI documentation.private org.eclipse.jetty.ee10.servlet.ErrorPageErrorHandlerprivate Fileprivate FilegetWebAppTempDirectory(File warFile) private voididentifyUiExtensionsForComponents(Map<UiExtensionType, List<String>> uiExtensions, File warFile) Identifies all known UI extensions and stores them in the specified map.voidinit()voidinitialize(NiFiProperties properties, Bundle systemBundle, Set<Bundle> bundles, ExtensionMapping extensionMapping) voidloadExtensionUis(Collection<Bundle> bundles) private org.eclipse.jetty.server.HandlerloadInitialWars(Set<Bundle> bundles) private org.eclipse.jetty.ee10.webapp.WebAppContextloadWar(File warFile, String contextPath, ClassLoader parentClassLoader) private JettyServer.ExtensionUiInfoprivate voidperformInjectionForComponentUis(Collection<org.eclipse.jetty.ee10.webapp.WebAppContext> componentUiExtensionWebContexts, NiFiWebConfigurationContext configurationContext, org.eclipse.jetty.ee10.servlet.FilterHolder securityFilter) private voidperformInjectionForContentViewerUis(Collection<org.eclipse.jetty.ee10.webapp.WebAppContext> contentViewerWebContexts, org.springframework.web.context.WebApplicationContext webApiApplicationContext, org.eclipse.jetty.ee10.servlet.FilterHolder securityFilter) private voidprocessExtensionUiBundle(Bundle bundle) private voidreadUiExtensions(Map<UiExtensionType, List<String>> uiExtensions, UiExtensionType uiExtensionType, JarFile jarFile, JarEntry jarEntry) voidstart()private voidvoidstop()private voidunloadApp(BundleCoordinate bundleCoordinate, org.eclipse.jetty.deploy.App app) voidunloadExtensionUis(Collection<Bundle> bundles) private voidunloadExtensionUis(Bundle bundle)
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
ALLOWED_CONTEXT_PATHS_PARAMETER
- See Also:
-
CONTAINER_JAR_PATTERN
- See Also:
-
CONTEXT_PATH_ALL
- See Also:
-
CONTEXT_PATH_NIFI
- See Also:
-
CONTEXT_PATH_NIFI_API
- See Also:
-
REQUIRED_CONTEXT_PATHS
-
REQUEST_FILTER_PROVIDER
-
REST_API_REQUEST_FILTER_PROVIDER
-
NAR_PROVIDER_PREFIX
- See Also:
-
NAR_PROVIDER_POLL_INTERVAL_PROPERTY
- See Also:
-
NAR_PROVIDER_CONFLICT_RESOLUTION
- See Also:
-
NAR_PROVIDER_RESTRAIN_PROPERTY
- See Also:
-
NAR_PROVIDER_IMPLEMENTATION_PROPERTY
- See Also:
-
DEFAULT_NAR_PROVIDER_POLL_INTERVAL
- See Also:
-
DEFAULT_NAR_PROVIDER_CONFLICT_RESOLUTION
- See Also:
-
NAR_DEPENDENCIES_PATH
- See Also:
-
WAR_EXTENSION
- See Also:
-
WEB_APP_MAX_FORM_CONTENT_SIZE
private static final int WEB_APP_MAX_FORM_CONTENT_SIZE- See Also:
-
APPLICATION_PATH
- See Also:
-
HTTPS_SCHEME
- See Also:
-
HTTP_SCHEME
- See Also:
-
HOST_UNSPECIFIED
- See Also:
-
SPRING_SECURITY_FILTER_CHAIN
- See Also:
-
EXTENSION_UI_POLL_INTERVAL
-
deploymentManager
private final org.eclipse.jetty.deploy.DeploymentManager deploymentManager -
server
private org.eclipse.jetty.server.Server server -
props
-
sslContext
-
systemBundle
-
bundles
-
extensionMapping
-
narAutoLoader
-
narProviderService
-
diagnosticsFactory
-
decommissionTask
-
statusHistoryDumpFactory
-
clusterDetailsFactory
-
webApiContext
private org.eclipse.jetty.ee10.webapp.WebAppContext webApiContext -
contentViewerWebContexts
-
contentViewers
-
componentUiExtensions
-
componentUiExtensionWebContexts
-
appsByBundleCoordinate
-
extensionUisToLoad
-
extensionUiLoadTask
-
-
Constructor Details
-
JettyServer
public JettyServer()Default no-arg constructor for ServiceLoader
-
-
Method Details
-
init
public void init() -
clearWorkingDirectory
private void clearWorkingDirectory() -
loadInitialWars
-
loadExtensionUis
- Specified by:
loadExtensionUisin interfaceExtensionUiLoader
-
processExtensionUiBundle
-
unloadExtensionUis
- Specified by:
unloadExtensionUisin interfaceExtensionUiLoader
-
unloadExtensionUis
-
unloadApp
-
loadWars
-
containsUiExtensionType
private boolean containsUiExtensionType(List<UiExtension> componentUiExtensionsForType, UiExtensionType extensionType) Returns whether or not the specified ui extensions already contains an extension of the specified type.- Parameters:
componentUiExtensionsForType- ui extensions for the typeextensionType- type of ui extension- Returns:
- whether or not the specified ui extensions already contains an extension of the specified type
-
findWars
-
readUiExtensions
private void readUiExtensions(Map<UiExtensionType, List<String>> uiExtensions, UiExtensionType uiExtensionType, JarFile jarFile, JarEntry jarEntry) throws IOException- Throws:
IOException
-
identifyUiExtensionsForComponents
private void identifyUiExtensionsForComponents(Map<UiExtensionType, List<String>> uiExtensions, File warFile) Identifies all known UI extensions and stores them in the specified map.- Parameters:
uiExtensions- extensionswarFile- war
-
extractComponentType
Extracts the component type. Trims the line and considers comments. Returns null if no type was found.- Parameters:
line- line- Returns:
- type
-
loadWar
private org.eclipse.jetty.ee10.webapp.WebAppContext loadWar(File warFile, String contextPath, ClassLoader parentClassLoader) -
getWebAppTempDirectory
-
addDocsServlets
private void addDocsServlets(org.eclipse.jetty.ee10.webapp.WebAppContext webAppContext) -
getDocsDir
Returns a File object for the directory containing NIFI documentation.Formerly, if the docsDirectory did not exist NIFI would fail to start with an IllegalStateException and a rather unhelpful log message. NIFI-2184 updates the process such that if the docsDirectory does not exist an attempt will be made to create the directory. If that is successful NIFI will no longer fail and will start successfully barring any other errors. The side effect of the docsDirectory not being present is that the documentation links under the 'General' portion of the help page will not be accessible, but at least the process will be running.
- Returns:
- A File object to the documentation directory; else startUpFailure called.
-
getWebApiDocsDir
-
getApplicationUrls
-
start
public void start()- Specified by:
startin interfaceNiFiServer
-
buildExternalResourceProviders
private Map<String,ExternalResourceProvider> buildExternalResourceProviders(SSLContext sslContext, ExtensionManager extensionManager, Predicate<ExternalResourceDescriptor> filter) throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException -
createProviderInstance
private ExternalResourceProvider createProviderInstance(ExtensionManager extensionManager, String providerClass, String providerId, ExternalResourceProviderInitializationContext context) throws InstantiationException, IllegalAccessException, ClassNotFoundException, InvocationTargetException, NoSuchMethodException In case the provider class is not an implementation ofExternalResourceProviderthe method tries to instantiate it as aNarProvider.NarProviderinstances are wrapped into an adapter in order to envelope the support. -
getDiagnosticsFactory
- Specified by:
getDiagnosticsFactoryin interfaceNiFiServer
-
getThreadDumpFactory
- Specified by:
getThreadDumpFactoryin interfaceNiFiServer
-
getDecommissionTask
- Specified by:
getDecommissionTaskin interfaceNiFiServer
-
getClusterDetailsFactory
- Specified by:
getClusterDetailsFactoryin interfaceNiFiServer
-
getStatusHistoryDumpFactory
- Specified by:
getStatusHistoryDumpFactoryin interfaceNiFiServer
-
performInjectionForComponentUis
private void performInjectionForComponentUis(Collection<org.eclipse.jetty.ee10.webapp.WebAppContext> componentUiExtensionWebContexts, NiFiWebConfigurationContext configurationContext, org.eclipse.jetty.ee10.servlet.FilterHolder securityFilter) -
performInjectionForContentViewerUis
private void performInjectionForContentViewerUis(Collection<org.eclipse.jetty.ee10.webapp.WebAppContext> contentViewerWebContexts, org.springframework.web.context.WebApplicationContext webApiApplicationContext, org.eclipse.jetty.ee10.servlet.FilterHolder securityFilter) -
startUpFailure
-
initialize
public void initialize(NiFiProperties properties, Bundle systemBundle, Set<Bundle> bundles, ExtensionMapping extensionMapping) - Specified by:
initializein interfaceNiFiServer
-
stop
public void stop()- Specified by:
stopin interfaceNiFiServer
-
getErrorHandler
private org.eclipse.jetty.ee10.servlet.ErrorPageErrorHandler getErrorHandler()
-