Author: mwringe
Date: 2010-11-22 11:28:06 -0500 (Mon, 22 Nov 2010)
New Revision: 5205
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/DirectResourceServingHandler.java
Log:
GTNWSRP-169: check if we are receiving a mime type of application/javascript or
application/x-javascript and set requires rewriting if true.
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/DirectResourceServingHandler.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/DirectResourceServingHandler.java 2010-11-22
14:46:50 UTC (rev 5204)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/DirectResourceServingHandler.java 2010-11-22
16:28:06 UTC (rev 5205)
@@ -105,7 +105,10 @@
ResourceContext resourceContext;
MediaType type = MediaType.create(contentType);
- if (TypeDef.TEXT.equals(type.getType()))
+
+ //TODO: handle this better, we should probably have a class in the common module to
determine if the MediaType should be treated as a text
+ // file or as binary content. We also need to implement the algorithm to determine
the character encoding.
+ if (TypeDef.TEXT.equals(type.getType()) ||
(TypeDef.APPLICATION.equals(type.getType()) &&
(type.getSubtype().getName().contains("javascript"))))
{
// determine the charset of the content, if any
String charset = "UTF-8";
@@ -126,7 +129,7 @@
// process markup if needed
SubtypeDef subtype = type.getSubtype();
- if (SubtypeDef.HTML.equals(subtype) || SubtypeDef.CSS.equals(subtype) ||
SubtypeDef.JAVASCRIPT.equals(subtype) || SubtypeDef.XML.equals(subtype))
+ if (SubtypeDef.HTML.equals(subtype) || SubtypeDef.CSS.equals(subtype) ||
subtype.getName().contains("javascript") || SubtypeDef.XML.equals(subtype))
{
resourceContext.setRequiresRewriting(true);
}
Show replies by date