Hi,
I'm currently implementing some JSP pages for my Sling components. How
can I define a specific HTTP response content type for my dynamic JSP
pages? I want my page to be delivered with text/css MIME type.
I've created a new component my_component. Below MyComponent I've
added a JSP with the name my_component.css.jsp. my_component.css.jsp
has the following content:
---snip---
<%...@page contentType="text/css; charset=utf-8"%>
.my_demo_css {
/* further dynamic CSS code comes here */
}
---snip---
I can access my component with a URL like
http://localhost:4502/.../my_content.css. But the HTTP response from
Sling is delivered with a text/html content type.
Generally I'm not sure how Sling determines the response content type
for a delivered page. When I understand the documentation [1] right
then Sling uses the file extension to determine the MIME type for the
content type? But which extension is meant here? Is it the "file
extension" of the URL? Or is it the extension of my files in the JCR?
I've also tries to set the content type in the JSP manually:
---snip---
<% response.setContentType("text/css; charset=utf-8"); %>
---snip---
This doesen't work either. To me it seems like (maybe Sling)
overwrites the content type after my JSP is fully rendered. Can this
be the case?
Thank you for your help.
- Markus
[1] http://sling.apache.org/site/mime-type-support-commonsmime.html