Tomcat request timeout

With Tomcat 7, you can add the StuckThreadDetectionValve which will enable you to identify threads that are “stuck”. You can set-up the valve in the Context element of the applications where you want to do detecting: <Context …> … <Valve className=”org.apache.catalina.valves.StuckThreadDetectionValve” threshold=”60″ /> … </Context> This would write a WARN entry into the tomcat log … Read more

Node.js – get raw request body using Express

Edit 2: Release 1.15.2 of the body parser module introduces raw mode, which returns the body as a Buffer. By default, it also automatically handles deflate and gzip decompression. Example usage: var bodyParser = require(‘body-parser’); app.use(bodyParser.raw(options)); app.get(path, function(req, res) { // req.body is a Buffer object }); By default, the options object has the following … Read more

Angular 4.3.3 HttpClient : How get value from the header of a response?

You can observe the full response instead of the content only. To do so, you have to pass observe: response into the options parameter of the function call. http .get<MyJsonData>(‘/data.json’, {observe: ‘response’}) .subscribe(resp => { // Here, resp is of type HttpResponse<MyJsonData>. // You can inspect its headers: console.log(resp.headers.get(‘X-Custom-Header’)); // And access the body directly, … Read more

Javascript : Send JSON Object with Ajax?

With jQuery: $.post(“test.php”, { json_string:JSON.stringify({name:”John”, time:”2pm”}) }); Without jQuery: var xmlhttp = new XMLHttpRequest(); // new HttpRequest instance xmlhttp.open(“POST”, “/json-handler”); xmlhttp.setRequestHeader(“Content-Type”, “application/json”); xmlhttp.send(JSON.stringify({name:”John Rambo”, time:”2pm”}));

Get raw post data

Direct answer: you can not do that. PHP insists on parsing it itself, whenever it sees the multipart/form-data Content-Type. The raw data will not be available to you. Sadly. But you can hack around it. I hit a similar problem, a partner was sending incorrectly formatted data as multipart/form-data, PHP could not parse it and … Read more