You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public {{classname}}Controller(ObjectMapper objectMapper, HttpServletRequest request) {
83
+
this.objectMapper = objectMapper;
84
+
this.request = request;
85
+
}
86
+
{{#jdk8}}
87
+
88
+
@Override
89
+
public Optional<ObjectMapper> getObjectMapper() {
90
+
return Optional.ofNullable(objectMapper);
91
+
}
92
+
93
+
@Override
94
+
public Optional<HttpServletRequest> getRequest() {
95
+
return Optional.ofNullable(request);
96
+
}
97
+
{{/jdk8}}
98
+
99
+
{{/isDelegate}}
100
+
{{^jdk8}}
101
+
{{#operation}}
102
+
{{#contents}}
103
+
public {{#async}}Callable<{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#parameters}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/parameters}}) {
104
+
{{^isDelegate}}
105
+
{{^async}}
106
+
String accept = request.getHeader("Accept");
107
+
{{#examples}}
108
+
if (accept != null && accept.contains("{{{contentType}}}")) {
109
+
try {
110
+
return new ResponseEntity<{{>returnTypes}}>(objectMapper.readValue("{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.NOT_IMPLEMENTED);
111
+
} catch (IOException e) {
112
+
log.error("Couldn't serialize response for content type {{{contentType}}}", e);
113
+
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.INTERNAL_SERVER_ERROR);
114
+
}
115
+
}
116
+
117
+
{{/examples}}
118
+
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.NOT_IMPLEMENTED);
119
+
{{/async}}
120
+
{{#async}}
121
+
return new Callable<ResponseEntity<{{>returnTypes}}>>() {
122
+
@Override
123
+
public ResponseEntity<{{>returnTypes}}> call() {
124
+
String accept = request.getHeader("Accept");
125
+
{{#examples}}
126
+
if (accept != null && accept.contains("{{{contentType}}}")) {
127
+
try {
128
+
return new ResponseEntity<{{>returnTypes}}>(objectMapper.readValue("{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.NOT_IMPLEMENTED);
129
+
} catch (IOException e) {
130
+
log.error("Couldn't serialize response for content type {{{contentType}}}", e);
131
+
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.INTERNAL_SERVER_ERROR);
132
+
}
133
+
}
134
+
135
+
{{/examples}}
136
+
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.NOT_IMPLEMENTED);
0 commit comments