int counter = 0;
for (ResourceRecord record : resourceRecords) {
try {
final String resourceClassName = record.getMetadata().getResourceClass().getName();
final ClassMetadata resourceMetadata = record.getMetadata();
final String resourcePath = resourceMetadata.getPath();
for (MethodMetadata methodMetadata : resourceMetadata.getResourceMethods()) {
++counter;
try {
String path = resourcePath;
String httpMethod = methodMetadata.getHttpMethod();
String consumes = constructMediaTypeString(methodMetadata.getConsumes());
String produces = constructMediaTypeString(methodMetadata.getProduces());
String methodName =
constructMethodString(methodMetadata.getReflectionMethod());
/* path is null so regular resource method */
f.format("%n%1$-80s %2$-13s %3$-20s %4$-20s %5$s.%6$s",
path,
httpMethod,
consumes,
produces,
resourceClassName,
methodName);
} catch (Exception e) {
logger.trace("Could not print the entire method metadata for {}",
resourceClassName,
e);
}
if (counter % LogUtilities.BREAK_POINT == 0) {
if (isTrace) {
if (isLogForOneResource) {
logger
.trace("Resource information for {}:{}", resourceMetadata.getResourceClass().getName(), sb); //$NON-NLS-1$
} else {
logger.trace(Messages.getMessage("registeredResources", sb)); //$NON-NLS-1$
}
} else {
if (isLogForOneResource) {
logger
.debug("Resource information for {}:{}", resourceMetadata.getResourceClass().getName(), sb); //$NON-NLS-1$
} else {
logger.debug(Messages.getMessage("registeredResources", sb)); //$NON-NLS-1$
}
}
sb = new StringBuffer();
f = new Formatter(sb);
f.format("%n%1$-80s %2$-13s %3$-20s %4$-20s %5$s",
"Path",
"HTTP Method",
"Consumes",
"Produces",
"Resource Method");
}
}
for (SubResourceRecord subResourceRecord : record.getSubResourceRecords()) {
++counter;
try {
MethodMetadata method = subResourceRecord.getMetadata();
StringBuilder path = new StringBuilder(resourcePath);
if (!resourcePath.endsWith("/")) {
path.append("/");
}
path.append(method.getPath());
String httpMethod = method.getHttpMethod();
if (httpMethod == null) {
httpMethod = "(Sub-Locator)";
}
String consumes = constructMediaTypeString(method.getConsumes());
String produces = constructMediaTypeString(method.getProduces());
String methodName = constructMethodString(method.getReflectionMethod());
f.format("%n%1$-80s %2$-13s %3$-20s %4$-20s %5$s.%6$s",
path,
httpMethod,
consumes,
produces,
resourceClassName,
methodName);
} catch (Exception e) {
logger.trace("Could not print the entire method metadata for {}",
resourceClassName,
e);
}
if (counter % LogUtilities.BREAK_POINT == 0) {
if (isTrace) {
if (isLogForOneResource) {
logger
.trace("Resource information for {}:{}", resourceMetadata.getResourceClass().getName(), sb); //$NON-NLS-1$
} else {
logger.trace(Messages.getMessage("registeredResources", sb)); //$NON-NLS-1$
}
} else {
if (isLogForOneResource) {
logger
.debug("Resource information for {}:{}", resourceMetadata.getResourceClass().getName(), sb); //$NON-NLS-1$
} else {
logger.debug(Messages.getMessage("registeredResources", sb)); //$NON-NLS-1$
}
}
sb = new StringBuffer();