use of org.springframework.http.ResponseEntity in project weixin-java-pay-demo by binarywang.
the class WxErrorController method error.
/**
* Supports other formats like JSON, XML
*
* @param request
*/
@RequestMapping(value = ERROR_PATH)
@ResponseBody
public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
Map<String, Object> body = this.getErrorAttributes(request, this.getTraceParameter(request));
HttpStatus status = this.getStatus(request);
return new ResponseEntity<>(body, status);
}
use of org.springframework.http.ResponseEntity in project weixin-java-mp-demo-springboot by binarywang.
the class WxErrorController method error.
/**
* Supports other formats like JSON, XML
*
* @param request
*/
@RequestMapping(value = ERROR_PATH)
@ResponseBody
public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
Map<String, Object> body = this.getErrorAttributes(request, this.getTraceParameter(request));
HttpStatus status = this.getStatus(request);
return new ResponseEntity<>(body, status);
}
use of org.springframework.http.ResponseEntity in project open-kilda by telstra.
the class TopologyController method network.
/**
* Dumps topology.
*
* @param correlationId correlation ID header value
* @return network topology
*/
@RequestMapping(value = "/network", method = RequestMethod.GET, produces = APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<Topology> network(@RequestHeader(value = CORRELATION_ID, defaultValue = DEFAULT_CORRELATION_ID) String correlationId) {
logger.debug("Get topology: {}={}", CORRELATION_ID, correlationId);
Topology topology = topologyService.network(correlationId);
return new ResponseEntity<>(topology, new HttpHeaders(), HttpStatus.OK);
}
use of org.springframework.http.ResponseEntity in project open-kilda by telstra.
the class FlowController method pathFlow.
/**
* Gets flow path.
*
* @param flowId flow id
* @param correlationId correlation ID header value
* @return list of flow
*/
@ApiOperation(value = "Gets flow path", response = FlowPathPayload.class)
@ApiResponses(value = { @ApiResponse(code = 200, response = FlowPathPayload.class, message = "Operation is successful"), @ApiResponse(code = 400, response = MessageError.class, message = "Invalid input data"), @ApiResponse(code = 401, response = MessageError.class, message = "Unauthorized"), @ApiResponse(code = 403, response = MessageError.class, message = "Forbidden"), @ApiResponse(code = 404, response = MessageError.class, message = "Not found"), @ApiResponse(code = 500, response = MessageError.class, message = "General error"), @ApiResponse(code = 503, response = MessageError.class, message = "Service unavailable") })
@RequestMapping(value = "/flows/path/{flow-id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<FlowPathPayload> pathFlow(@PathVariable(name = "flow-id") String flowId, @RequestHeader(value = CORRELATION_ID, defaultValue = DEFAULT_CORRELATION_ID) String correlationId) {
logger.debug("Flow path: {}={}, {}={}", CORRELATION_ID, correlationId, FLOW_ID, flowId);
FlowPathPayload response = flowService.pathFlow(flowId, correlationId);
return new ResponseEntity<>(response, new HttpHeaders(), HttpStatus.OK);
}
use of org.springframework.http.ResponseEntity in project open-kilda by telstra.
the class FlowController method updateFlow.
/**
* Updates existing flow.
*
* @param flow flow
* @param flowId flow id
* @param correlationId correlation ID header value
* @return flow
*/
@ApiOperation(value = "Updates flow", response = FlowPayload.class)
@ApiResponses(value = { @ApiResponse(code = 200, response = FlowPayload.class, message = "Operation is successful"), @ApiResponse(code = 400, response = MessageError.class, message = "Invalid input data"), @ApiResponse(code = 401, response = MessageError.class, message = "Unauthorized"), @ApiResponse(code = 403, response = MessageError.class, message = "Forbidden"), @ApiResponse(code = 404, response = MessageError.class, message = "Not found"), @ApiResponse(code = 500, response = MessageError.class, message = "General error"), @ApiResponse(code = 503, response = MessageError.class, message = "Service unavailable") })
@RequestMapping(value = "/flows/{flow-id}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<FlowPayload> updateFlow(@PathVariable(name = "flow-id") String flowId, @RequestBody FlowPayload flow, @RequestHeader(value = CORRELATION_ID, defaultValue = DEFAULT_CORRELATION_ID) String correlationId) {
logger.debug("Update flow: {}={}, {}={}, flow={}", CORRELATION_ID, correlationId, FLOW_ID, flowId, flow);
FlowPayload response = flowService.updateFlow(flow, correlationId);
return new ResponseEntity<>(response, new HttpHeaders(), HttpStatus.OK);
}
Aggregations