2424import org .ocpsoft .rewrite .servlet .config .HttpConfigurationProvider ;
2525import org .ocpsoft .rewrite .servlet .config .Path ;
2626import org .ocpsoft .rewrite .servlet .config .Resource ;
27+ import org .ocpsoft .rewrite .servlet .config .Response ;
2728import org .ocpsoft .rewrite .transform .Transform ;
2829import org .ocpsoft .rewrite .transform .less .Less ;
2930import org .ocpsoft .rewrite .transform .markup .Asciidoc ;
@@ -45,6 +46,7 @@ public Configuration getConfiguration(ServletContext context)
4546 .and (Path .matches ("/markdown/{name}.html" ))
4647 .and (Resource .exists ("/markdown/{name}.md" )))
4748 .perform (Forward .to ("/markdown/{name}.md" )
49+ .and (Response .setContentType ("text/html" ))
4850 .and (Transform .with (Markdown .fullDocument ()
4951 .withTitle ("Markdown Demo" )
5052 .addStylesheet (context .getContextPath () + "/common/bootstrap.css" )
@@ -56,6 +58,7 @@ public Configuration getConfiguration(ServletContext context)
5658 .and (Path .matches ("/textile/{name}.html" ))
5759 .and (Resource .exists ("/textile/{name}.textile" )))
5860 .perform (Forward .to ("/textile/{name}.textile" )
61+ .and (Response .setContentType ("text/html" ))
5962 .and (Transform .with (Textile .fullDocument ()
6063 .withTitle ("Textile Demo" )
6164 .addStylesheet (context .getContextPath () + "/common/bootstrap.css" )
@@ -67,6 +70,7 @@ public Configuration getConfiguration(ServletContext context)
6770 .and (Path .matches ("/asciidoc/{name}.html" ))
6871 .and (Resource .exists ("/asciidoc/{name}.asciidoc" )))
6972 .perform (Forward .to ("/asciidoc/{name}.asciidoc" )
73+ .and (Response .setContentType ("text/html" ))
7074 .and (Transform .with (Asciidoc .fullDocument ()
7175 .withTitle ("AsciiDoc Demo" )
7276 .addStylesheet (context .getContextPath () + "/common/bootstrap.css" )
@@ -78,6 +82,7 @@ public Configuration getConfiguration(ServletContext context)
7882 .and (Path .matches ("/less/{name}.css" ))
7983 .and (Resource .exists ("/less/{name}.less" )))
8084 .perform (Forward .to ("/less/{name}.less" )
85+ .and (Response .setContentType ("text/css" ))
8186 .and (Transform .with (Less .compiler ())))
8287
8388 // Sass
@@ -86,6 +91,7 @@ public Configuration getConfiguration(ServletContext context)
8691 .and (Path .matches ("/sass/{name}.css" ))
8792 .and (Resource .exists ("/sass/{name}.scss" )))
8893 .perform (Forward .to ("/sass/{name}.scss" )
94+ .and (Response .setContentType ("text/css" ))
8995 .and (Transform .with (Sass .compiler ())));
9096
9197 }
0 commit comments