|
|
|
@ -52,7 +52,6 @@ import java.util.*;
|
|
|
|
|
|
|
|
|
|
public class AnnotationProcessor {
|
|
|
|
|
|
|
|
|
|
public static final String WILD_CARD = "/*";
|
|
|
|
|
private static final Log log = LogFactory.getLog(AnnotationProcessor.class);
|
|
|
|
|
private static final String AUTH_TYPE = "Application & Application User";
|
|
|
|
|
private static final String STRING_ARR = "string_arr";
|
|
|
|
@ -60,6 +59,7 @@ public class AnnotationProcessor {
|
|
|
|
|
private static final String PACKAGE_ORG_APACHE = "org.apache";
|
|
|
|
|
private static final String PACKAGE_ORG_CODEHAUS = "org.codehaus";
|
|
|
|
|
private static final String PACKAGE_ORG_SPRINGFRAMEWORK = "org.springframework";
|
|
|
|
|
public static final String WILD_CARD = "/*";
|
|
|
|
|
private static final String SWAGGER_ANNOTATIONS_INFO = "info";
|
|
|
|
|
private static final String SWAGGER_ANNOTATIONS_TAGS = "tags";
|
|
|
|
|
private static final String SWAGGER_ANNOTATIONS_EXTENSIONS = "extensions";
|
|
|
|
@ -132,27 +132,6 @@ public class AnnotationProcessor {
|
|
|
|
|
log.error("An error has occurred while loading classes ", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Find the URL pointing to "/WEB-INF/classes" This method may not work in conjunction with IteratorFactory
|
|
|
|
|
* if your servlet container does not extract the /WEB-INF/classes into a real file-based directory
|
|
|
|
|
*
|
|
|
|
|
* @param servletContext
|
|
|
|
|
* @return null if cannot determin /WEB-INF/classes
|
|
|
|
|
*/
|
|
|
|
|
private static URL findWebInfClassesPath(ServletContext servletContext) {
|
|
|
|
|
String path = servletContext.getRealPath("/WEB-INF/classes");
|
|
|
|
|
if (path == null) return null;
|
|
|
|
|
File fp = new File(path);
|
|
|
|
|
if (fp.exists() == false) return null;
|
|
|
|
|
try {
|
|
|
|
|
URI uri = fp.toURI();
|
|
|
|
|
return uri.toURL();
|
|
|
|
|
} catch (MalformedURLException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Set<String> scanStandardContext(String className) throws IOException {
|
|
|
|
|
ExtendedAnnotationDB db = new ExtendedAnnotationDB();
|
|
|
|
|
db.addIgnoredPackages(PACKAGE_ORG_APACHE);
|
|
|
|
@ -511,6 +490,26 @@ public class AnnotationProcessor {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Find the URL pointing to "/WEB-INF/classes" This method may not work in conjunction with IteratorFactory
|
|
|
|
|
* if your servlet container does not extract the /WEB-INF/classes into a real file-based directory
|
|
|
|
|
*
|
|
|
|
|
* @param servletContext
|
|
|
|
|
* @return null if cannot determin /WEB-INF/classes
|
|
|
|
|
*/
|
|
|
|
|
private static URL findWebInfClassesPath(ServletContext servletContext) {
|
|
|
|
|
String path = servletContext.getRealPath("/WEB-INF/classes");
|
|
|
|
|
if (path == null) return null;
|
|
|
|
|
File fp = new File(path);
|
|
|
|
|
if (fp.exists() == false) return null;
|
|
|
|
|
try {
|
|
|
|
|
URI uri = fp.toURI();
|
|
|
|
|
return uri.toURL();
|
|
|
|
|
} catch (MalformedURLException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private APIResource getAPiOperationExtensions(Annotation currentMethod, APIResource apiResource) throws Throwable {
|
|
|
|
|
InvocationHandler methodHandler = Proxy.getInvocationHandler(currentMethod);
|
|
|
|
|
Annotation[] extensions = (Annotation[]) methodHandler.invoke(currentMethod,
|
|
|
|
|