Skip to content

Commit 520d123

Browse files
committed
fixed sections issue in introspection
1 parent 8492e5a commit 520d123

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/internal/introspection/application/ApplicationIntrospector.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ private static void addEnpoints(Application application, Reference baseRef,
7373
// Look for the endpoint to which this application is attached.
7474
Endpoint endpoint = ComponentIntrospector.getEndpoint(
7575
component.getDefaultHost(), application, scheme);
76-
// add sections
77-
contract.setSections(collectInfo.getSections());
7876
if (endpoint != null) {
7977
definition.getEndpoints().add(endpoint);
8078
}

modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/internal/introspection/application/ResourceCollector.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public static void collectResource(CollectInfo collectInfo,
9292
for (IntrospectionHelper helper : introspectionHelper) {
9393
helper.processResource(resource, directory.getClass());
9494
}
95+
addSectionsForResource(collectInfo, resource);
9596
collectInfo.addResource(resource);
9697
}
9798

@@ -151,6 +152,7 @@ public static void collectResource(
151152
if (!operations.isEmpty()) {
152153
sortOperationsByMethod(operations);
153154
resource.setOperations(operations);
155+
addSectionsForResource(collectInfo, resource);
154156
collectInfo.addResource(resource);
155157
} else {
156158
LOGGER.warning("Resource " + resource.getName()
@@ -411,13 +413,6 @@ private static Resource getResource(CollectInfo collectInfo,
411413
resource.setName(name);
412414
}
413415

414-
// add sections in collect info
415-
for (String section : resource.getSections()) {
416-
if (collectInfo.getSection(section) == null) {
417-
collectInfo.addSection(new Section(section));
418-
}
419-
}
420-
421416
Template template = new Template(basePath);
422417
for (String variable : template.getVariableNames()) {
423418
PathVariable pathVariable = new PathVariable();
@@ -432,6 +427,15 @@ private static Resource getResource(CollectInfo collectInfo,
432427
return resource;
433428
}
434429

430+
private static void addSectionsForResource(CollectInfo collectInfo,
431+
Resource resource) {
432+
for (String section : resource.getSections()) {
433+
if (collectInfo.getSection(section) == null) {
434+
collectInfo.addSection(new Section(section));
435+
}
436+
}
437+
}
438+
435439
private static void sortOperationsByMethod(ArrayList<Operation> operations) {
436440
Collections.sort(operations, new Comparator<Operation>() {
437441
public int compare(Operation o1, Operation o2) {

0 commit comments

Comments
 (0)