/** * Initialization procedure * * @param servletContext * The {@link ServletContext} of the web application. * @param classLoader * The {@link ClassLoader} to use for loading classes * @param packageFilter * The {@link PackageFilter} used to check if a package has to be * scanned. */ public AbstractClassFinder(ServletContext servletContext, ClassLoader classLoader, PackageFilter packageFilter) { this.servletContext = servletContext; this.classLoader = classLoader; this.packageFilter = packageFilter; this.byteCodeAnnotationFilter = new ByteCodeAnnotationFilter(); }
String result = stripKnownPrefix(path, CLASSES_FOLDER); result = stripKnownPrefix(path, classesFolderPath);
/** * Checks if a supplied class has to be processed by checking the package * name against the {@link PackageFilter}. * * @param className * FQCN of the class * @return <code>true</code> for classes to process, <code>false</code> for * classes to ignore */ protected boolean mustProcessClass(String className) { // the default package String packageName = ""; // find last dot in class name to determine the package name int packageEndIndex = className.lastIndexOf("."); if (packageEndIndex != -1) { packageName = className.substring(0, packageEndIndex); } // check filter return packageFilter.isAllowedPackage(packageName); }
ActionSpec actionSpec = new ActionSpec(); actionSpec.setMethod(method); actionSpec.setOnPostback(actionAnnotation.onPostback()); actionSpec.setInheritable(actionAnnotation.inheritable()); actionSpec.setPhaseId(actionAnnotation.phaseId()); if (!isBlank(actionAnnotation.mappingId())) actionSpec.setMappingIds(new String[] { actionAnnotation.mappingId().trim() }); actionSpec.setMappingIds(classMappingIds);
PackageFilter packageFilter = new PackageFilter(packageFilters); LazyBeanNameFinder beanNameFinder = new LazyBeanNameFinder(servletContext); PrettyAnnotationHandler annotationHandler = new PrettyAnnotationHandler(beanNameFinder); classFinders.add(new WebClassesFinder(servletContext, classloader, packageFilter)); if ((jarConfig != null) && jarConfig.trim().equalsIgnoreCase("true")) classFinders.add(new WebLibFinder(servletContext, classloader, packageFilter)); finder.findClasses(annotationHandler); annotationHandler.build(builder); return builder.build();
/** * Searches for {@link URLAction} or {@link URLActions} annotations on a * method. * * @param method Method to scan * @param classMappingIds The mapping IDs of the class this method belongs to */ private void processMethodAnnotations(Method method, String[] classMappingIds) { // is there a @URLAction annotation on the class? URLAction actionAnnotation = method.getAnnotation(URLAction.class); if (actionAnnotation != null) { processPrettyActionAnnotation(actionAnnotation, method, classMappingIds); } // is there a @URLAction container annotation on the class? URLActions actionsAnnotation = method.getAnnotation(URLActions.class); if (actionsAnnotation != null) { // process all @URLAction annotations for (URLAction child : actionsAnnotation.actions()) { processPrettyActionAnnotation(child, method, classMappingIds); } } }
public void findClasses(PrettyAnnotationHandler handler) { try { // we start the recursive scan in the classes folder URL classesFolderUrl = servletContext.getResource(CLASSES_FOLDER); // abort if classes folder is missing if (classesFolderUrl == null) { log.warn("Cannot find classes folder: " + CLASSES_FOLDER); return; } // call recursive directory processing method processDirectory(classesFolderUrl, classesFolderUrl, handler); } catch (MalformedURLException e) { throw new IllegalStateException("Invalid URL: " + e.getMessage(), e); } }
PackageFilter packageFilter = new PackageFilter(packageFilters); LazyBeanNameFinder beanNameFinder = new LazyBeanNameFinder(servletContext); PrettyAnnotationHandler annotationHandler = new PrettyAnnotationHandler(beanNameFinder); classFinders.add(new WebClassesFinder(servletContext, classloader, packageFilter)); if ((jarConfig != null) && jarConfig.trim().equalsIgnoreCase("true")) classFinders.add(new WebLibFinder(servletContext, classloader, packageFilter)); finder.findClasses(annotationHandler); annotationHandler.build(builder); return builder.build();
/** * Searches for {@link URLAction} or {@link URLActions} annotations on a * method. * * @param method Method to scan * @param classMappingIds The mapping IDs of the class this method belongs to */ private void processMethodAnnotations(Method method, String[] classMappingIds) { // is there a @URLAction annotation on the class? URLAction actionAnnotation = method.getAnnotation(URLAction.class); if (actionAnnotation != null) { processPrettyActionAnnotation(actionAnnotation, method, classMappingIds); } // is there a @URLAction container annotation on the class? URLActions actionsAnnotation = method.getAnnotation(URLActions.class); if (actionsAnnotation != null) { // process all @URLAction annotations for (URLAction child : actionsAnnotation.actions()) { processPrettyActionAnnotation(child, method, classMappingIds); } } }
/** * Initialization procedure * * @param servletContext * The {@link ServletContext} of the web application. * @param classLoader * The {@link ClassLoader} to use for loading classes * @param packageFilter * The {@link PackageFilter} used to check if a package has to be * scanned. */ public AbstractClassFinder(ServletContext servletContext, ClassLoader classLoader, PackageFilter packageFilter) { this.servletContext = servletContext; this.classLoader = classLoader; this.packageFilter = packageFilter; this.byteCodeAnnotationFilter = new ByteCodeAnnotationFilter(); }
/** * Checks if a supplied class has to be processed by checking the package * name against the {@link PackageFilter}. * * @param className * FQCN of the class * @return <code>true</code> for classes to process, <code>false</code> for * classes to ignore */ protected boolean mustProcessClass(String className) { // the default package String packageName = ""; // find last dot in class name to determine the package name int packageEndIndex = className.lastIndexOf("."); if (packageEndIndex != -1) { packageName = className.substring(0, packageEndIndex); } // check filter return packageFilter.isAllowedPackage(packageName); }
String result = stripKnownPrefix(path, CLASSES_FOLDER); result = stripKnownPrefix(path, classesFolderPath);
public void findClasses(PrettyAnnotationHandler handler) { try { // we start the recursive scan in the classes folder URL classesFolderUrl = servletContext.getResource(CLASSES_FOLDER); // abort if classes folder is missing if (classesFolderUrl == null) { log.warn("Cannot find classes folder: " + CLASSES_FOLDER); return; } // call recursive directory processing method processDirectory(classesFolderUrl, classesFolderUrl, handler); } catch (MalformedURLException e) { throw new IllegalStateException("Invalid URL: " + e.getMessage(), e); } }
PackageFilter packageFilter = new PackageFilter(packageFilters); LazyBeanNameFinder beanNameFinder = new LazyBeanNameFinder(servletContext); PrettyAnnotationHandler annotationHandler = new PrettyAnnotationHandler(beanNameFinder); classFinders.add(new WebClassesFinder(servletContext, classloader, packageFilter)); if ((jarConfig != null) && jarConfig.trim().equalsIgnoreCase("true")) classFinders.add(new WebLibFinder(servletContext, classloader, packageFilter)); finder.findClasses(annotationHandler); annotationHandler.build(builder); return builder.build();
/** * Searches for {@link URLAction} or {@link URLActions} annotations on a method. * * @param method Method to scan * @param classMappingIds The mapping IDs of the class this method belongs to */ private void processMethodAnnotations(Method method, String[] classMappingIds) { // is there a @URLAction annotation on the class? URLAction actionAnnotation = method.getAnnotation(URLAction.class); if (actionAnnotation != null) { processPrettyActionAnnotation(actionAnnotation, method, classMappingIds); } // is there a @URLAction container annotation on the class? URLActions actionsAnnotation = method.getAnnotation(URLActions.class); if (actionsAnnotation != null) { // process all @URLAction annotations for (URLAction child : actionsAnnotation.actions()) { processPrettyActionAnnotation(child, method, classMappingIds); } } }
/** * Initialization procedure * * @param servletContext * The {@link ServletContext} of the web application. * @param classLoader * The {@link ClassLoader} to use for loading classes * @param packageFilter * The {@link PackageFilter} used to check if a package has to be * scanned. */ public AbstractClassFinder(ServletContext servletContext, ClassLoader classLoader, PackageFilter packageFilter) { this.servletContext = servletContext; this.classLoader = classLoader; this.packageFilter = packageFilter; this.byteCodeAnnotationFilter = new ByteCodeAnnotationFilter(); }
/** * Checks if a supplied class has to be processed by checking the package * name against the {@link PackageFilter}. * * @param className * FQCN of the class * @return <code>true</code> for classes to process, <code>false</code> for * classes to ignore */ protected boolean mustProcessClass(String className) { // the default package String packageName = ""; // find last dot in class name to determine the package name int packageEndIndex = className.lastIndexOf("."); if (packageEndIndex != -1) { packageName = className.substring(0, packageEndIndex); } // check filter return packageFilter.isAllowedPackage(packageName); }
String result = stripKnownPrefix(path, CLASSES_FOLDER); result = stripKnownPrefix(path, classesFolderPath);
public void findClasses(PrettyAnnotationHandler handler) { try { // we start the recursive scan in the classes folder URL classesFolderUrl = servletContext.getResource(CLASSES_FOLDER); // abort if classes folder is missing if (classesFolderUrl == null) { log.warn("Cannot find classes folder: " + CLASSES_FOLDER); return; } // call recursive directory processing method processDirectory(classesFolderUrl, classesFolderUrl, handler); } catch (MalformedURLException e) { throw new IllegalStateException("Invalid URL: " + e.getMessage(), e); } }
/** * Searches for {@link URLAction} or {@link URLActions} annotations on a * method. * * @param method Method to scan * @param classMappingIds The mapping IDs of the class this method belongs to */ private void processMethodAnnotations(Method method, String[] classMappingIds) { // is there a @URLAction annotation on the class? URLAction actionAnnotation = method.getAnnotation(URLAction.class); if (actionAnnotation != null) { processPrettyActionAnnotation(actionAnnotation, method, classMappingIds); } // is there a @URLAction container annotation on the class? URLActions actionsAnnotation = method.getAnnotation(URLActions.class); if (actionsAnnotation != null) { // process all @URLAction annotations for (URLAction child : actionsAnnotation.actions()) { processPrettyActionAnnotation(child, method, classMappingIds); } } }