Hi, Am Donnerstag, den 17.01.2008, 14:09 +0100 schrieb Bertrand Delacretaz: > Hi, > > I've added this (in revision 612806) to SlingScriptServlet.service(), > to use an X-Sling-Warning HTTP header to indicate an abnormal > non-critical condition:
This is certainly of value during development. But I think, this (at least this concrete example) is of little to no use for end users. They cannot do anything about it any way. I would rather have some logging entry or so... > > final String contentType = request.getResponseContentType(); > if(contentType == null) { > res.addHeader("X-Sling-Warning", > request.getClass().getSimpleName() + " does not provide a > Content-Type"); > res.setContentType("text/plain"); > } else { > res.setContentType(contentType); > } > > In such a case (response Content-Type is not as expected), having the > X-Sling-Warning header right next to other headers makes is easy to > spot the problem, when troubleshooting one's app. Well, I don't think, this to be a problem, because setting the content type on behalf of the script may be seen as convenience but also as tampering with what the script does... So in this case, we probably would rather just not do anything if the request.getResponseContentType() is not set. > What do you think of using such X-Sling-... headers where it makes sense? I am not really sure, whether it would really help or just be another place to look at besides the log (and yes, logging must of course be enhanced !). Regards Felix