incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r453662 - /incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/DispatchServletResponse.java
Date Fri, 06 Oct 2006 16:30:26 GMT
Author: awiner
Date: Fri Oct  6 09:30:25 2006
New Revision: 453662

URL: http://svn.apache.org/viewvc?view=rev&rev=453662
Log:
ADFFACES-217: NPE if ServletResponse.setContentTpe(null) is called.  Patch from Venkata Guddanti

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/DispatchServletResponse.java

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/DispatchServletResponse.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/DispatchServletResponse.java?view=diff&rev=453662&r1=453661&r2=453662
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/DispatchServletResponse.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/DispatchServletResponse.java
Fri Oct  6 09:30:25 2006
@@ -39,30 +39,32 @@
   public void setContentType(
     String contentTypeAndCharset)
   {
-    Matcher matcher = _CONTENT_TYPE_PATTERN.matcher(contentTypeAndCharset);
-    if (matcher.matches())
+    if(contentTypeAndCharset != null)
     {
-      String contentType = matcher.group(1);
-      String charset = (matcher.groupCount() > 1) ? matcher.group(2) : null; 
-      
-      // capture the content type on the request
-      _request.setAttribute(_CONTENT_TYPE_KEY, contentType);
-
-      // TODO: use Agent APIs when available
-      if ("application/xhtml+xml".equals(contentType))
+      Matcher matcher = _CONTENT_TYPE_PATTERN.matcher(contentTypeAndCharset);
+      if (matcher.matches())
       {
-        String userAgent = _request.getHeader("User-agent");
-        if (userAgent.indexOf("compatible; MSIE") != -1)
+        String contentType = matcher.group(1);
+        String charset = (matcher.groupCount() > 1) ? matcher.group(2) : null; 
+        
+        // capture the content type on the request
+        _request.setAttribute(_CONTENT_TYPE_KEY, contentType);
+  
+        // TODO: use Agent APIs when available
+        if ("application/xhtml+xml".equals(contentType))
         {
-          // IE must serve XHTML as text/html
-          contentTypeAndCharset = "text/html";
-
-          if (charset != null)
-            contentTypeAndCharset += ";charset=" + charset;
+          String userAgent = _request.getHeader("User-agent");
+          if (userAgent.indexOf("compatible; MSIE") != -1)
+          {
+            // IE must serve XHTML as text/html
+            contentTypeAndCharset = "text/html";
+  
+            if (charset != null)
+              contentTypeAndCharset += ";charset=" + charset;
+          }
         }
       }
     }
-
     super.setContentType(contentTypeAndCharset);
   }
   



Mime
View raw message