http-status-codes

Mule - unable to route message based on http.status

人走茶凉 提交于 2020-01-16 18:44:10
问题 I'm trying to create a choice router in my Mule application that will do something based on the response code received from an HTTP Outbound Endpoint. My config is as below - I followed the answers provided in this previous question: <set-variable variableName="http.disable.status.code.exception.check" value="true" doc:name="Variable"/> <http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="hello" contentType="text/xml" method="POST" doc:name="HTTP"/>

Spring Boot in standalone Tomcat ignores exceptions set in DeferredResults

五迷三道 提交于 2020-01-16 11:30:22
问题 I'm running a Spring Boot 1.2.1 application in standalone Tomcat. I have two controller mappings, which both for simplicity always throw an exception. The first one is for a GET request and it returns a String for the view name: @RequestMapping(value = { "/index" }, method = RequestMethod.GET) public String init() throws MyRequestProcessingException { if (true) { throw new MyRequestProcessingException( "Something went wrong processing request"); } return "init"; } This is the exception

$.post form with facebox and redirect

老子叫甜甜 提交于 2020-01-16 11:27:26
问题 Using Facebox with .NET (Web Forms) is painful--this primarily HTML site was designed by someone else. I may have IIS (7.5) issues as well. This Facebox pop-up is in a separate file, login.html, that is called from index.html: $k('a[rel*=example_2]').facebox_1({ loading_image : '/images/loading.gif', close_image : '/images/closelabel.gif' }); and the link to open it <a href="login.html" title="Log In" rel="example_2" id='login'>Log In </a> The form to be submitted with username and password

Set one ProducesResponseType typeof for several HttpStatusCodes

心已入冬 提交于 2020-01-14 08:32:35
问题 I am setting the ProducesResponseType so as to have it documented with Swagger. If the response is succesful (OK => 200), then it produces a IEnumerable. [ProducesResponseType(typeof(IEnumerable<MyModel>), 200)] But when I get an exception, I catch it, and then generate an object of my custom APIError class. When I populate the object, I can set different HttpStatusCodes, but in the end, what I want is to be able to set that ProducesResponseType is my APIError class for all the remaining

Set one ProducesResponseType typeof for several HttpStatusCodes

China☆狼群 提交于 2020-01-14 08:32:12
问题 I am setting the ProducesResponseType so as to have it documented with Swagger. If the response is succesful (OK => 200), then it produces a IEnumerable. [ProducesResponseType(typeof(IEnumerable<MyModel>), 200)] But when I get an exception, I catch it, and then generate an object of my custom APIError class. When I populate the object, I can set different HttpStatusCodes, but in the end, what I want is to be able to set that ProducesResponseType is my APIError class for all the remaining

Set one ProducesResponseType typeof for several HttpStatusCodes

巧了我就是萌 提交于 2020-01-14 08:32:03
问题 I am setting the ProducesResponseType so as to have it documented with Swagger. If the response is succesful (OK => 200), then it produces a IEnumerable. [ProducesResponseType(typeof(IEnumerable<MyModel>), 200)] But when I get an exception, I catch it, and then generate an object of my custom APIError class. When I populate the object, I can set different HttpStatusCodes, but in the end, what I want is to be able to set that ProducesResponseType is my APIError class for all the remaining

http status code for failed email send

☆樱花仙子☆ 提交于 2020-01-13 19:53:07
问题 Consider an API call that creates a user. On success, the user is created and a confirmation email is sent. The response status code is 201. If the user is not created, the response status code is 422. What should the response status code be if user is created BUT sending the confirmation email failed? 回答1: The core of the problem lies in mixing a RESTful resource creation and an RPC-style action. The creation of the user, in a RESTful world, would be the atomic operation and return 201 or

http status code for failed email send

假如想象 提交于 2020-01-13 19:52:05
问题 Consider an API call that creates a user. On success, the user is created and a confirmation email is sent. The response status code is 201. If the user is not created, the response status code is 422. What should the response status code be if user is created BUT sending the confirmation email failed? 回答1: The core of the problem lies in mixing a RESTful resource creation and an RPC-style action. The creation of the user, in a RESTful world, would be the atomic operation and return 201 or

Spring: return @ResponseBody “ResponseEntity<List<JSONObject>>”

…衆ロ難τιáo~ 提交于 2020-01-11 19:56:14
问题 In controller I create json array. If I return List<JSONObject> it is ok: @RequestMapping(value="", method=RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE) public @ResponseBody List<JSONObject> getAll() { List<Entity> entityList = entityManager.findAll(); List<JSONObject> entities = new ArrayList<JSONObject>(); for (Entity n : entityList) { JSONObject entity = new JSONObject(); entity.put("id", n.getId()); entity.put("address", n.getAddress()); entities.add(entity); } return

Spring: return @ResponseBody “ResponseEntity<List<JSONObject>>”

我的梦境 提交于 2020-01-11 19:56:11
问题 In controller I create json array. If I return List<JSONObject> it is ok: @RequestMapping(value="", method=RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE) public @ResponseBody List<JSONObject> getAll() { List<Entity> entityList = entityManager.findAll(); List<JSONObject> entities = new ArrayList<JSONObject>(); for (Entity n : entityList) { JSONObject entity = new JSONObject(); entity.put("id", n.getId()); entity.put("address", n.getAddress()); entities.add(entity); } return