private void performInjectionForComponentUis(final Collection<WebAppContext> componentUiExtensionWebContexts, final NiFiWebConfigurationContext configurationContext, final FilterHolder securityFilter) { if (CollectionUtils.isNotEmpty(componentUiExtensionWebContexts)) { for (final WebAppContext customUiContext : componentUiExtensionWebContexts) { // set the NiFi context in each custom ui servlet context final ServletContext customUiServletContext = customUiContext.getServletHandler().getServletContext(); customUiServletContext.setAttribute("nifi-web-configuration-context", configurationContext); // add the security filter to any ui extensions wars if (securityFilter != null) { customUiContext.addFilter(securityFilter, "/*", EnumSet.allOf(DispatcherType.class)); } } } }
final ServletContext webApiServletContext = webApiContext.getServletHandler().getServletContext(); final WebApplicationContext webApplicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(webApiServletContext); final NiFiWebConfigurationContext configurationContext = webApplicationContext.getBean("nifiWebConfigurationContext", NiFiWebConfigurationContext.class);
final ServletContext webApiServletContext = webApiContext.getServletHandler().getServletContext(); webApiServletContext.setAttribute("nifi-ui-extensions", componentUiExtensions); final ServletContext webContentViewerServletContext = webContentViewerContext.getServletHandler().getServletContext(); webContentViewerServletContext.setAttribute("nifi-content-access", contentAccess); final ServletContext webDocsServletContext = webDocsContext.getServletHandler().getServletContext(); webDocsServletContext.setAttribute("nifi-extension-mapping", extensionMapping);
private String getJspPackagePrefix () { String jspPackageName = (String)getServletHandler().getServletContext().getInitParameter(JSP_GENERATED_PACKAGE_NAME ); if (jspPackageName == null) jspPackageName = "org.apache.jsp"; return jspPackageName; }
private String getJspPackagePrefix () { String jspPackageName = (String)getServletHandler().getServletContext().getInitParameter(JSP_GENERATED_PACKAGE_NAME ); if (jspPackageName == null) jspPackageName = "org.apache.jsp"; return jspPackageName; }
/** * @return the package for all jsps */ public String getJspPackagePrefix () { String jspPackageName = null; if (getServletHandler() != null && getServletHandler().getServletContext() != null) jspPackageName = (String)getServletHandler().getServletContext().getInitParameter(JSP_GENERATED_PACKAGE_NAME ); if (jspPackageName == null) jspPackageName = "org.apache.jsp"; return jspPackageName; }
protected void illegalStateIfContextStarted() { if (_servletHandler!=null) { ServletContext context=_servletHandler.getServletContext(); if ((context instanceof ContextHandler.Context) && ((ContextHandler.Context)context).getContextHandler().isStarted()) throw new IllegalStateException("Started"); } }
protected void illegalStateIfContextStarted() { if (_servletHandler!=null) { ContextHandler.Context context=(ContextHandler.Context)_servletHandler.getServletContext(); if (context!=null && context.getContextHandler().isStarted()) throw new IllegalStateException("Started"); } }
protected void illegalStateIfContextStarted() { if (_servletHandler!=null) { ContextHandler.Context context=(ContextHandler.Context)_servletHandler.getServletContext(); if (context!=null && context.getContextHandler().isStarted()) throw new IllegalStateException("Started"); } }
protected void illegalStateIfContextStarted() { if (_servletHandler!=null) { ServletContext context=_servletHandler.getServletContext(); if ((context instanceof ContextHandler.Context) && ((ContextHandler.Context)context).getContextHandler().isStarted()) throw new IllegalStateException("Started"); } }
protected void illegalStateIfContextStarted() { if (_servletHandler!=null) { ServletContext context=_servletHandler.getServletContext(); if ((context instanceof ContextHandler.Context) && ((ContextHandler.Context)context).getContextHandler().isStarted()) throw new IllegalStateException("Started"); } }
protected void illegalStateIfContextStarted() { if (_servletHandler!=null) { ContextHandler.Context context=(ContextHandler.Context)_servletHandler.getServletContext(); if (context!=null && context.getContextHandler().isStarted()) throw new IllegalStateException("Started"); } }
protected void illegalStateIfContextStarted() { if (_servletHandler!=null) { ServletContext context=_servletHandler.getServletContext(); if ((context instanceof ContextHandler.Context) && ((ContextHandler.Context)context).getContextHandler().isStarted()) throw new IllegalStateException("Started"); } }
protected void illegalStateIfContextStarted() { if (_servletHandler!=null) { ServletContext context=_servletHandler.getServletContext(); if ((context instanceof ContextHandler.Context) && ((ContextHandler.Context)context).getContextHandler().isStarted()) throw new IllegalStateException("Started"); } }
private void makeUnavailable(UnavailableException e) { if (_unavailableEx==e && _unavailable!=0) return; _servletHandler.getServletContext().log("unavailable",e); _unavailableEx=e; _unavailable=-1; if (e.isPermanent()) _unavailable=-1; else { if (_unavailableEx.getUnavailableSeconds()>0) _unavailable=System.currentTimeMillis()+1000*_unavailableEx.getUnavailableSeconds(); else _unavailable=System.currentTimeMillis()+5000; // TODO configure } }
private void makeUnavailable(UnavailableException e) { if (_unavailableEx==e && _unavailable!=0) return; _servletHandler.getServletContext().log("unavailable",e); _unavailableEx=e; _unavailable=-1; if (e.isPermanent()) _unavailable=-1; else { if (_unavailableEx.getUnavailableSeconds()>0) _unavailable=System.currentTimeMillis()+1000*_unavailableEx.getUnavailableSeconds(); else _unavailable=System.currentTimeMillis()+5000; // TODO configure } }
private void makeUnavailable(UnavailableException e) { if (_unavailableEx==e && _unavailable!=0) return; _servletHandler.getServletContext().log("unavailable",e); _unavailableEx=e; _unavailable=-1; if (e.isPermanent()) _unavailable=-1; else { if (_unavailableEx.getUnavailableSeconds()>0) _unavailable=System.currentTimeMillis()+1000*_unavailableEx.getUnavailableSeconds(); else _unavailable=System.currentTimeMillis()+5000; // TODO configure } }
private void makeUnavailable(UnavailableException e) { if (_unavailableEx==e && _unavailable!=0) return; _servletHandler.getServletContext().log("unavailable",e); _unavailableEx=e; _unavailable=-1; if (e.isPermanent()) _unavailable=-1; else { if (_unavailableEx.getUnavailableSeconds()>0) _unavailable=System.currentTimeMillis()+1000*_unavailableEx.getUnavailableSeconds(); else _unavailable=System.currentTimeMillis()+5000; // TODO configure } }
private void makeUnavailable(UnavailableException e) { if (_unavailableEx==e && _unavailable!=0) return; _servletHandler.getServletContext().log("unavailable",e); _unavailableEx=e; _unavailable=-1; if (e.isPermanent()) _unavailable=-1; else { if (_unavailableEx.getUnavailableSeconds()>0) _unavailable=System.currentTimeMillis()+1000*_unavailableEx.getUnavailableSeconds(); else _unavailable=System.currentTimeMillis()+5000; // TODO configure } }
/** * Register a ServletRequestListener that will ensure tmp multipart * files are deleted when the request goes out of scope. * * @throws Exception */ protected void initMultiPart () throws Exception { //if this servlet can handle multipart requests, ensure tmp files will be //cleaned up correctly if (((Registration)getRegistration()).getMultipartConfig() != null) { //Register a listener to delete tmp files that are created as a result of this //servlet calling Request.getPart() or Request.getParts() ContextHandler ch = ((ContextHandler.Context)getServletHandler().getServletContext()).getContextHandler(); ch.addEventListener(new Request.MultiPartCleanerListener()); } }