| package {{apiPackage}}; | |
| import static org.springframework.http.MediaType.*; | |
| import java.util.List; | |
| import java.util.Map; | |
| {{#imports}}import {{import}}; | |
| {{/imports}} | |
| import org.apache.servicecomb.provider.rest.common.RestSchema; | |
| import org.springframework.http.HttpStatus; | |
| import org.springframework.http.ResponseEntity; | |
| import org.springframework.web.bind.annotation.PathVariable; | |
| import org.springframework.web.bind.annotation.RequestBody; | |
| import org.springframework.web.bind.annotation.RequestHeader; | |
| import org.springframework.web.bind.annotation.RequestMapping; | |
| import org.springframework.web.bind.annotation.RequestMethod; | |
| import org.springframework.web.bind.annotation.RequestParam; | |
| import org.springframework.web.bind.annotation.RequestPart; | |
| import org.springframework.web.multipart.MultipartFile; | |
| @RestSchema(schemaId = "{{#camelcase}}{{classname}}{{/camelcase}}") | |
| @RequestMapping(value = "{{#getRelativeBasePath}}{{basePath}}{{/getRelativeBasePath}}", produces = {APPLICATION_JSON_VALUE}) | |
| {{#operations}} | |
| public class {{classname}} { | |
| {{#operation}} | |
| @RequestMapping(value = "{{path}}", {{#hasProduces}}produces = { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}} {{#hasConsumes}}consumes = { {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}method = RequestMethod.{{httpMethod}}) | |
| public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>libraries/SpringMVC/queryParams}}{{>libraries/SpringMVC/pathParams}}{{>libraries/SpringMVC/headerParams}}{{>libraries/SpringMVC/bodyParams}}{{>libraries/SpringMVC/formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { | |
| // do something | |
| return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); | |
| } | |
| {{/operation}} | |
| } | |
| {{/operations}} |