|
|
@ -159,7 +159,7 @@ public class AnnotationProcessor {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Method[] annotatedMethods = clazz.getDeclaredMethods();
|
|
|
|
Method[] annotatedMethods = clazz.getDeclaredMethods();
|
|
|
|
resourceList = getApiResources(rootContext, subContext, annotatedMethods);
|
|
|
|
resourceList = getApiResources(rootContext, annotatedMethods);
|
|
|
|
apiResourceConfig.setResources(resourceList);
|
|
|
|
apiResourceConfig.setResources(resourceList);
|
|
|
|
} catch (Throwable throwable) {
|
|
|
|
} catch (Throwable throwable) {
|
|
|
|
log.error("Error encountered while scanning for annotations", throwable);
|
|
|
|
log.error("Error encountered while scanning for annotations", throwable);
|
|
|
@ -211,13 +211,11 @@ public class AnnotationProcessor {
|
|
|
|
* Get Resources for each API
|
|
|
|
* Get Resources for each API
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param resourceRootContext
|
|
|
|
* @param resourceRootContext
|
|
|
|
* @param apiRootContext
|
|
|
|
|
|
|
|
* @param annotatedMethods
|
|
|
|
* @param annotatedMethods
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
* @throws Throwable
|
|
|
|
* @throws Throwable
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private List<APIResource> getApiResources(String resourceRootContext, String apiRootContext,
|
|
|
|
private List<APIResource> getApiResources(String resourceRootContext, Method[] annotatedMethods) throws Throwable {
|
|
|
|
Method[] annotatedMethods) throws Throwable {
|
|
|
|
|
|
|
|
List<APIResource> resourceList = new ArrayList<>();
|
|
|
|
List<APIResource> resourceList = new ArrayList<>();
|
|
|
|
String subCtx = null;
|
|
|
|
String subCtx = null;
|
|
|
|
for (Method method : annotatedMethods) {
|
|
|
|
for (Method method : annotatedMethods) {
|
|
|
@ -228,8 +226,10 @@ public class AnnotationProcessor {
|
|
|
|
Annotation methodContextAnno = method.getAnnotation(pathClazz);
|
|
|
|
Annotation methodContextAnno = method.getAnnotation(pathClazz);
|
|
|
|
if (methodContextAnno != null) {
|
|
|
|
if (methodContextAnno != null) {
|
|
|
|
subCtx = invokeMethod(pathClazzMethods[0], methodContextAnno, STRING);
|
|
|
|
subCtx = invokeMethod(pathClazzMethods[0], methodContextAnno, STRING);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
subCtx = "/*";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
resource.setUriTemplate(makeContextURLReady(apiRootContext) + makeContextURLReady(subCtx));
|
|
|
|
resource.setUriTemplate(makeContextURLReady(subCtx));
|
|
|
|
|
|
|
|
|
|
|
|
resource.setUri(APIPublisherUtil.getServerBaseUrl() + makeContextURLReady(resourceRootContext) +
|
|
|
|
resource.setUri(APIPublisherUtil.getServerBaseUrl() + makeContextURLReady(resourceRootContext) +
|
|
|
|
makeContextURLReady(subCtx));
|
|
|
|
makeContextURLReady(subCtx));
|
|
|
@ -266,7 +266,6 @@ public class AnnotationProcessor {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
resourceList.add(resource);
|
|
|
|
resourceList.add(resource);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
subCtx = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resourceList;
|
|
|
|
return resourceList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|