You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2009/02/05 17:26:46 UTC

svn commit: r741164 - in /myfaces/tobago/trunk: ./ core/ core/src/main/java/org/apache/myfaces/tobago/servlet/ core/src/main/java/org/apache/myfaces/tobago/util/ example/demo/src/main/xslt/ extension/tobago-taglib-extension/src/main/java/org/apache/myf...

Author: bommel
Date: Thu Feb  5 16:26:46 2009
New Revision: 741164

URL: http://svn.apache.org/viewvc?rev=741164&view=rev
Log:
Try to fix content type problems
fixed ClassCastException in MenuExtensionTags
update to servlet 2.4
ensure to add source artifact to normal build in core

Added:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/servlet/DebugContentTypeFilter.java   (with props)
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/servlet/DebugContentTypeResponse.java   (with props)
Modified:
    myfaces/tobago/trunk/core/pom.xml
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java
    myfaces/tobago/trunk/example/demo/src/main/xslt/facelet2jsp.xsl
    myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java
    myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java
    myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension12/MenuCheckboxExtensionTag.java
    myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension12/MenuRadioExtensionTag.java
    myfaces/tobago/trunk/pom.xml

Modified: myfaces/tobago/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/pom.xml?rev=741164&r1=741163&r2=741164&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/pom.xml (original)
+++ myfaces/tobago/trunk/core/pom.xml Thu Feb  5 16:26:46 2009
@@ -224,6 +224,16 @@
           </archive>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-source-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-source</id>
+            <goals><goal>jar</goal></goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 

Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/servlet/DebugContentTypeFilter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/servlet/DebugContentTypeFilter.java?rev=741164&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/servlet/DebugContentTypeFilter.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/servlet/DebugContentTypeFilter.java Thu Feb  5 16:26:46 2009
@@ -0,0 +1,58 @@
+package org.apache.myfaces.tobago.servlet;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.FilterChain;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class DebugContentTypeFilter implements Filter {
+  private static final Log LOG = LogFactory.getLog(DebugContentTypeFilter.class);
+
+  public void init(FilterConfig filterConfig) throws ServletException {
+    if (LOG.isInfoEnabled()) {
+      LOG.info("init " + getClass().getName());
+    }
+  }
+
+  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("do Filter " + getClass().getName());
+    }
+    if (response instanceof HttpServletResponse) {
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("wrapping response " + getClass().getName());
+      }
+      chain.doFilter(request, new DebugContentTypeResponse((HttpServletResponse) response));
+    } else {
+      chain.doFilter(request, response);
+    }
+  }
+
+  public void destroy() {
+
+  }
+}

Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/servlet/DebugContentTypeFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/servlet/DebugContentTypeFilter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/servlet/DebugContentTypeResponse.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/servlet/DebugContentTypeResponse.java?rev=741164&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/servlet/DebugContentTypeResponse.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/servlet/DebugContentTypeResponse.java Thu Feb  5 16:26:46 2009
@@ -0,0 +1,69 @@
+package org.apache.myfaces.tobago.servlet;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.servlet.http.HttpServletResponseWrapper;
+import javax.servlet.http.HttpServletResponse;
+
+public class DebugContentTypeResponse extends HttpServletResponseWrapper {
+  private static final Log LOG = LogFactory.getLog(DebugContentTypeResponse.class);
+
+  public DebugContentTypeResponse(HttpServletResponse response) {
+    super(response);
+  }
+
+  @Override
+  public void setContentType(String type) {
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Setting Content-Type to '" + type + "'.", new Exception());
+    }
+    super.setContentType(type);
+  }
+
+  @Override
+  public String getContentType() {
+    String type = super.getContentType();
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Getting Content-Type '" + type + "'.", new Exception());
+    }
+    return type;
+  }
+
+  @Override
+  public void setHeader(String name, String value) {
+    if ("Content-Type".equals(name)) {
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Setting Content-Type to '" + value + "'.", new Exception());
+      }
+    }
+    super.setHeader(name, value);
+  }
+
+  @Override
+  public void addHeader(String name, String value) {
+    if ("Content-Type".equals(name)) {
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Setting Content-Type to '" + value + "'.", new Exception());
+      }
+    }
+    super.addHeader(name, value);
+  }
+}

Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/servlet/DebugContentTypeResponse.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/servlet/DebugContentTypeResponse.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java?rev=741164&r1=741163&r2=741164&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ResponseUtils.java Thu Feb  5 16:26:46 2009
@@ -51,8 +51,13 @@
       if (!response.containsHeader("Content-Type")) {
         response.setContentType(contentType);
       } else {
-        if (LOG.isInfoEnabled()) {
-          LOG.info("Reponse already contains Header Content-Type. Ignore setting Content-Type to " + contentType);
+        String responseContentType = response.getContentType();
+        if (!responseContentType.equalsIgnoreCase(contentType)) {
+          response.setContentType(contentType);
+          if (LOG.isInfoEnabled()) {
+            LOG.info("Reponse already contains Header Content-Type '" + responseContentType
+                + "'. Setting Content-Type to '" + contentType + "'");
+          }
         }
       }
     }

Modified: myfaces/tobago/trunk/example/demo/src/main/xslt/facelet2jsp.xsl
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/xslt/facelet2jsp.xsl?rev=741164&r1=741163&r2=741164&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/xslt/facelet2jsp.xsl (original)
+++ myfaces/tobago/trunk/example/demo/src/main/xslt/facelet2jsp.xsl Thu Feb  5 16:26:46 2009
@@ -39,6 +39,7 @@
     </xsl:comment>
 
     <jsp:root version="2.0">
+      <jsp:directive.page contentType="text/html; charset=utf-8"/>   
       <layout:overview>
         <jsp:params>
           <xsl:apply-templates select="ui:param" mode="parameter"/>

Modified: myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java?rev=741164&r1=741163&r2=741164&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java (original)
+++ myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java Thu Feb  5 16:26:46 2009
@@ -20,7 +20,7 @@
 import org.apache.myfaces.tobago.apt.annotation.ExtensionTag;
 import org.apache.myfaces.tobago.apt.annotation.Tag;
 import org.apache.myfaces.tobago.component.Facets;
-import org.apache.myfaces.tobago.component.UICommand;
+import org.apache.myfaces.tobago.component.AbstractUICommand;
 import static org.apache.myfaces.tobago.component.Attributes.RENDERED_PARTIALLY;
 import org.apache.myfaces.tobago.internal.taglib.MenuItemTag;
 import org.apache.myfaces.tobago.internal.taglib.SelectBooleanCheckboxTag;
@@ -131,7 +131,7 @@
     if (renderedPartially == null) {
       // Move attribute renderedPartially from selectOne to menuCommand component
       UIComponent selectBooleanComponent = selectBooleanCheckbox.getComponentInstance();
-      UICommand command = (UICommand) menuCommandTag.getComponentInstance();
+      AbstractUICommand command = (AbstractUICommand) menuCommandTag.getComponentInstance();
       ValueBinding binding = selectBooleanComponent.getValueBinding(RENDERED_PARTIALLY);
       if (binding != null) {
         command.setValueBinding(RENDERED_PARTIALLY, binding);

Modified: myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java?rev=741164&r1=741163&r2=741164&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java (original)
+++ myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java Thu Feb  5 16:26:46 2009
@@ -20,7 +20,7 @@
 import org.apache.myfaces.tobago.apt.annotation.ExtensionTag;
 import org.apache.myfaces.tobago.apt.annotation.Tag;
 import org.apache.myfaces.tobago.component.Facets;
-import org.apache.myfaces.tobago.component.UICommand;
+import org.apache.myfaces.tobago.component.AbstractUICommand;
 import static org.apache.myfaces.tobago.component.Attributes.RENDERED_PARTIALLY;
 import org.apache.myfaces.tobago.internal.taglib.MenuItemTag;
 import org.apache.myfaces.tobago.internal.taglib.SelectOneRadioTag;
@@ -139,7 +139,7 @@
     if (renderedPartially == null) {
       // Move attribute renderedPartially from selectOne to menuCommand component
       UIComponent selectOneComponent = selectOneRadio.getComponentInstance();
-      UICommand command = (UICommand) menuCommandTag.getComponentInstance();
+      AbstractUICommand command = (AbstractUICommand) menuCommandTag.getComponentInstance();
       ValueBinding binding = selectOneComponent.getValueBinding(RENDERED_PARTIALLY);
       if (binding != null) {
         command.setValueBinding(RENDERED_PARTIALLY, binding);

Modified: myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension12/MenuCheckboxExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension12/MenuCheckboxExtensionTag.java?rev=741164&r1=741163&r2=741164&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension12/MenuCheckboxExtensionTag.java (original)
+++ myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension12/MenuCheckboxExtensionTag.java Thu Feb  5 16:26:46 2009
@@ -23,8 +23,8 @@
 import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
 import org.apache.myfaces.tobago.component.Facets;
-import org.apache.myfaces.tobago.component.UICommand;
 import org.apache.myfaces.tobago.component.Attributes;
+import org.apache.myfaces.tobago.component.AbstractUICommand;
 import org.apache.myfaces.tobago.internal.taglib.MenuItemTag;
 import org.apache.myfaces.tobago.internal.taglib.SelectBooleanCheckboxTag;
 
@@ -127,7 +127,7 @@
     if (renderedPartially == null) {
       // Move attribute renderedPartially from selectOne to menuCommand component
       UIComponent selectBooleanComponent = selectBooleanCheckbox.getComponentInstance();
-      UICommand command = (UICommand) menuCommandTag.getComponentInstance();
+      AbstractUICommand command = (AbstractUICommand) menuCommandTag.getComponentInstance();
       javax.el.ValueExpression expression = selectBooleanComponent.getValueExpression(Attributes.RENDERED_PARTIALLY);
       if (expression != null) {
         command.setValueExpression(Attributes.RENDERED_PARTIALLY, expression);

Modified: myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension12/MenuRadioExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension12/MenuRadioExtensionTag.java?rev=741164&r1=741163&r2=741164&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension12/MenuRadioExtensionTag.java (original)
+++ myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension12/MenuRadioExtensionTag.java Thu Feb  5 16:26:46 2009
@@ -23,8 +23,8 @@
 import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
 import org.apache.myfaces.tobago.component.Facets;
-import org.apache.myfaces.tobago.component.UICommand;
 import org.apache.myfaces.tobago.component.Attributes;
+import org.apache.myfaces.tobago.component.AbstractUICommand;
 import org.apache.myfaces.tobago.internal.taglib.MenuItemTag;
 import org.apache.myfaces.tobago.internal.taglib.SelectOneRadioTag;
 
@@ -134,7 +134,7 @@
     if (renderedPartially == null) {
       // Move attribute renderedPartially from selectOne to menuCommand component
       UIComponent selectOneComponent = selectOneRadio.getComponentInstance();
-      UICommand command = (UICommand) menuCommandTag.getComponentInstance();
+      AbstractUICommand command = (AbstractUICommand) menuCommandTag.getComponentInstance();
       javax.el.ValueExpression expression = selectOneComponent.getValueExpression(Attributes.RENDERED_PARTIALLY);
       if (expression != null) {
         command.setValueExpression(Attributes.RENDERED_PARTIALLY, expression);

Modified: myfaces/tobago/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/pom.xml?rev=741164&r1=741163&r2=741164&view=diff
==============================================================================
--- myfaces/tobago/trunk/pom.xml (original)
+++ myfaces/tobago/trunk/pom.xml Thu Feb  5 16:26:46 2009
@@ -171,7 +171,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-javadoc-plugin</artifactId>
-        <version>2.2</version>
+        <version>2.5</version>
         <configuration>
           <aggregate>true</aggregate>
           <linksource>true</linksource>
@@ -451,7 +451,7 @@
       <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>servlet-api</artifactId>
-        <version>2.3</version>
+        <version>2.4</version>
         <scope>provided</scope>
       </dependency>
       <dependency>