private List<ContainerInitializer> jspInitializers() { JettyJasperInitializer sci = new JettyJasperInitializer(); ContainerInitializer initializer = new ContainerInitializer( (ServletContainerInitializer) sci, null); List<ContainerInitializer> initializers = new ArrayList<ContainerInitializer>(); initializers.add(initializer); return initializers; }
ContainerInitializer initializer = new ContainerInitializer(); initializer.setTarget(service); initializers.add(initializer); if (annotation != null) if (classes != null) initializer.setInterestedTypes(classes);
if (i.getAnnotatedTypeNames() != null) Set<String> annotatedClassNames = new HashSet<String>(i.getAnnotatedTypeNames()); for (String name : annotatedClassNames) i.addApplicableTypeName(name); if (i.getInterestedTypes() != null) for (Class c : i.getInterestedTypes()) i.callStartup(_context);
Set<String> annotatedClassNames = getAnnotatedTypeNames(); if (annotatedClassNames != null && !annotatedClassNames.isEmpty()) addApplicableTypeName(name); addInheritedTypes(classMap, (Set<String>)classMap.get(name)); if (getInterestedTypes() != null) for (Class<?> c : getInterestedTypes()) addInheritedTypes(classMap, (Set<String>)classMap.get(c.getName()));
/** * Handle finding a class that is annotated with the annotation we were constructed with. * @see org.eclipse.jetty.annotations.AnnotationParser.DiscoverableAnnotationHandler#handleClass(java.lang.String, int, int, java.lang.String, java.lang.String, java.lang.String[], java.lang.String, java.util.List) */ public void handleClass(String className, int version, int access, String signature, String superName, String[] interfaces, String annotationName, List<Value> values) { _initializer.addAnnotatedTypeName(className); }
private void addInheritedTypes(Map<String, Set<String>> classMap,Set<String> names) { if (names == null || names.isEmpty()) return; for (String s : names) { //add the name of the class addApplicableTypeName(s); //walk the hierarchy and find all types that extend or implement the class addInheritedTypes(classMap, (Set<String>)classMap.get(s)); } } }
void addInheritedTypes (MultiMap classMap, ContainerInitializer initializer, List<String> applicableTypes) { for (String s : applicableTypes) { //add the name of the class that extends or implements initializer.addApplicableTypeName(s); //walk the hierarchy and find all types that extend or implement it List<String> implementsOrExtends = (List<String>)classMap.getValues(s); if (implementsOrExtends != null && !implementsOrExtends.isEmpty()) addInheritedTypes (classMap, initializer, implementsOrExtends); } }
/** * Call the doStart method of the ServletContainerInitializers * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart() */ @Override public void doStart() { List<ContainerInitializer> initializers = (List<ContainerInitializer>)_context.getAttribute(AnnotationConfiguration.CONTAINER_INITIALIZERS); if (initializers == null) return; for (ContainerInitializer i : initializers) { try { if (LOG.isDebugEnabled()) LOG.debug("Calling ServletContainerInitializer "+i.getTarget().getClass().getName()); i.callStartup(_context); } catch (Exception e) { LOG.warn(e); throw new RuntimeException(e); } } } }
ContainerInitializer initializer = new ContainerInitializer(); initializer.setTarget(service); initializers.add(initializer); if (annotation != null) if (classes != null) initializer.setInterestedTypes(classes);
if (i.getAnnotatedTypeNames() != null) Set<String> annotatedClassNames = new HashSet<String>(i.getAnnotatedTypeNames()); for (String name : annotatedClassNames) i.addApplicableTypeName(name); if (i.getInterestedTypes() != null) for (Class c : i.getInterestedTypes()) i.callStartup(_context);
public void handleMethod(String className, String methodName, int access, String params, String signature, String[] exceptions, String annotation, List<Value> values) { _initializer.addAnnotatedTypeName(className); }
void addInheritedTypes (MultiMap classMap, ContainerInitializer initializer, List<String> applicableTypes) { for (String s : applicableTypes) { //add the name of the class that extends or implements initializer.addApplicableTypeName(s); //walk the hierarchy and find all types that extend or implement it List<String> implementsOrExtends = (List<String>)classMap.getValues(s); if (implementsOrExtends != null && !implementsOrExtends.isEmpty()) addInheritedTypes (classMap, initializer, implementsOrExtends); } }
private void createWebAppContext() { contexts = new ContextHandlerCollection(); WebAppContext context; // Add web-app. Check to see if we're in development mode. If so, we don't // add the normal web-app location, but the web-app in the project directory. boolean developmentMode = Boolean.getBoolean("developmentMode"); if( developmentMode ) { System.out.println(LocaleUtils.getLocalizedString("admin.console.devmode")); context = new WebAppContext(contexts, pluginDir.getParentFile().getParentFile().getParentFile().getParent() + File.separator + "src" + File.separator + "web", "/"); } else { context = new WebAppContext(contexts, pluginDir.getAbsoluteFile() + File.separator + "webapp", "/"); } // Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs). final List<ContainerInitializer> initializers = new ArrayList<>(); initializers.add(new ContainerInitializer(new JasperInitializer(), null)); context.setAttribute("org.eclipse.jetty.containerInitializers", initializers); context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager()); // The index.html includes a redirect to the index.jsp and doesn't bypass // the context security when in development mode context.setWelcomeFiles(new String[]{"index.html"}); // Make sure the context initialization is done when in development mode if( developmentMode ) { context.addBean( new ServletContainerInitializersStarter( context ), true ); } }
ContainerInitializer initializer = new ContainerInitializer(); initializer.setTarget(service); initializers.add(initializer); if (annotation != null) if (classes != null) initializer.setInterestedTypes(classes);
if (i.getAnnotatedTypeNames() != null) Set<String> annotatedClassNames = new HashSet<String>(i.getAnnotatedTypeNames()); for (String name : annotatedClassNames) i.addApplicableTypeName(name); if (i.getInterestedTypes() != null) for (Class c : i.getInterestedTypes()) i.callStartup(_context);
public void handleMethod(String className, String methodName, int access, String params, String signature, String[] exceptions, String annotation, List<Value> values) { _initializer.addAnnotatedTypeName(className); }
void addInheritedTypes (MultiMap classMap, ContainerInitializer initializer, List<String> applicableTypes) { for (String s : applicableTypes) { //add the name of the class that extends or implements initializer.addApplicableTypeName(s); //walk the hierarchy and find all types that extend or implement it List<String> implementsOrExtends = (List<String>)classMap.getValues(s); if (implementsOrExtends != null && !implementsOrExtends.isEmpty()) addInheritedTypes (classMap, initializer, implementsOrExtends); } }
/** * Creates a Jetty context handler that can be used to expose the cross-domain functionality as implemented by * {@link FlashCrossDomainServlet}. * * Note that an invocation of this method will not register the handler (and thus make the related functionality * available to the end user). Instead, the created handler is returned by this method, and will need to be * registered with the embedded Jetty webserver by the caller. * * @return A Jetty context handler (never null). */ protected Handler createCrossDomainHandler() { final ServletContextHandler context = new ServletContextHandler( null, "/crossdomain.xml", ServletContextHandler.SESSIONS ); // Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs). final List<ContainerInitializer> initializers = new ArrayList<>(); initializers.add( new ContainerInitializer( new JasperInitializer(), null ) ); context.setAttribute( "org.eclipse.jetty.containerInitializers", initializers ); context.setAttribute( InstanceManager.class.getName(), new SimpleInstanceManager() ); // Generic configuration of the context. context.setAllowNullPathInfo( true ); // Add the functionality-providers. context.addServlet( new ServletHolder( new FlashCrossDomainServlet() ), "" ); return context; }
public void handleField(String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation, List<Value> values) { _initializer.addAnnotatedTypeName(className); }
initializers.add( new ContainerInitializer( new JasperInitializer(), null ) ); context.setAttribute( "org.eclipse.jetty.containerInitializers", initializers ); context.setAttribute( InstanceManager.class.getName(), new SimpleInstanceManager() );