File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1919import java .io .IOException ;
2020import java .net .URL ;
2121import java .util .HashMap ;
22+ import java .util .HashSet ;
2223import java .util .Objects ;
2324
2425/**
@@ -71,9 +72,20 @@ public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent in
7172 * @param responseType One of the supported response types
7273 */
7374 private String encode (Document doc , String responseType ) throws IOException {
75+ final FeatureMap exportOptions = Factory .newFeatureMap ();
76+
77+ // Take *all* annotation types.
78+ final AnnotationSet defaultAnnots = doc .getAnnotations ();
79+ final HashSet <String > annotationTypes = new HashSet <>();
80+ for (Annotation annotation : defaultAnnots .inDocumentOrder ()) {
81+ annotationTypes .add (annotation .getType ());
82+ }
83+ exportOptions .put ("annotationTypes" , annotationTypes );
84+
7485 final ByteArrayOutputStream baos = new ByteArrayOutputStream ();
7586 if (responseType .equals ("application/json" )) {
76- gateJsonExporter .export (doc , baos );
87+ gateJsonExporter .setAnnotationTypes (doc .getAnnotationSetNames ());
88+ gateJsonExporter .export (doc , baos , exportOptions );
7789 return baos .toString ();
7890 }
7991 else {
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ public void testApplicationJsonResponse() throws Exception {
6666 APIGatewayProxyRequestEvent input = new APIGatewayProxyRequestEvent ()
6767 .withHttpMethod ("POST" )
6868 .withHeaders (Collections .unmodifiableMap (inputHeaders ))
69- .withBody ("My name is Lambda Function and I approve this test ." );
69+ .withBody ("Today is Monday ." );
7070 final TestContext context = new TestContext ();
7171 final APIGatewayProxyResponseEvent result = app .handleRequest (input , context );
7272 assertEquals (result .getStatusCode ().intValue (), 200 );
You can’t perform that action at this time.
0 commit comments