incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r502039 [3/39] - in /incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad: ./ trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/ trinidad-api/src/main...
Date Wed, 31 Jan 2007 23:29:36 GMT
Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/BaseLafRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/BaseLafRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/BaseLafRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/BaseLafRenderer.java Wed Jan 31 15:29:21 2007
@@ -22,6 +22,8 @@
 
 import javax.faces.component.UIComponent;
 
+import javax.faces.context.FacesContext;
+
 import org.apache.myfaces.trinidad.context.RequestContext;
 
 import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
@@ -673,24 +675,6 @@
   }
 
 
-  /**
-   * encodes a given URL
-   * @param context the context from which to get the URLEncoder
-   * @param url the URL to encode. this must be a String object
-   * @return the encoded form of the URL, by calling the encodeURL method
-   *  in the URLEncoder
-   * @see UIXRenderingContext#getURLEncoder()
-   * @see org.apache.myfaces.trinidadinternal.share.url.URLEncoder#encodeURL(String)
-   */
-  protected static String encodeURL(
-          UIXRenderingContext context,
-          Object           url
-          )
-  {
-    return context.getURLEncoder().encodeURL((url != null)
-            ? url.toString()
-            : null);
-  }
 
   protected static String appendURLArgument(
           String baseURL,
@@ -719,18 +703,61 @@
     return BaseLafUtils.appendURLArguments( baseURL, keysAndValues);
   }
 
-  protected void renderEncodedURIAttribute(
-          UIXRenderingContext context,
-          String           name,
-          Object           value) throws IOException
+  protected String encodeActionURL(
+   UIXRenderingContext context,
+   Object       value) throws IOException
   {
     if (value != null)
     {
-      value = encodeURL(context, value);
-      context.getResponseWriter().writeURIAttribute(name, value, null);
+      FacesContext facesContext = context.getFacesContext();
+      if(facesContext != null)
+      {
+        return facesContext.getExternalContext().encodeActionURL(value.toString());
+      }
+      return value.toString();
+    }
+    return null;
+  }
+  
+  protected String encodeResourceURL(
+   UIXRenderingContext context,
+   Object       value) throws IOException
+  {
+    if (value != null)
+    {
+      FacesContext facesContext = context.getFacesContext();
+      if(facesContext != null)
+      {
+        return facesContext.getExternalContext().encodeResourceURL(value.toString());
+      }
+      return value.toString();
+    }
+    return null;
+  }  
+  
+  protected void renderEncodedActionURI(
+   UIXRenderingContext context,
+   String       name,
+   Object       value) throws IOException
+  {
+    if (value != null)
+    {
+      String encodedURL = encodeActionURL(context, value);
+      context.getResponseWriter().writeURIAttribute(name, encodedURL, null);
     }
   }
 
+  protected void renderEncodedResourceURI(
+   UIXRenderingContext context,
+   String       name,
+   Object       value) throws IOException
+  {
+    if (value != null)
+    {
+      String encodedURL = encodeResourceURL(context, value);
+      context.getResponseWriter().writeURIAttribute(name, encodedURL, null);
+    }
+  }
 
   /**
    * Returns the Agent capability specified by the key

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/ButtonRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/ButtonRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/ButtonRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/ButtonRenderer.java Wed Jan 31 15:29:21 2007
@@ -646,7 +646,7 @@
 
         if (isLink)
         {
-           renderEncodedURIAttribute(context, "href", destination);
+           renderEncodedActionURI(context, "href", destination);
            renderAttribute(context, node, "target", TARGET_FRAME_ATTR);
 
           // Don't render access key on Netscape... Netscape doesn't
@@ -702,4 +702,5 @@
     new AlternateRenderer();
 
 }
+
 

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/GeneratedImageRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/GeneratedImageRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/GeneratedImageRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/GeneratedImageRenderer.java Wed Jan 31 15:29:21 2007
@@ -129,7 +129,7 @@
     if (hasLink)
     {
       writer.startElement("a", component);
-      renderEncodedURIAttribute(context, "href", destination);
+      renderEncodedActionURI(context, "href", destination);
       renderAttribute(context, node, "target", TARGET_FRAME_ATTR);
 
       // Don't render access key on Netscape... Netscape doesn't

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/GlobalButtonRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/GlobalButtonRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/GlobalButtonRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/GlobalButtonRenderer.java Wed Jan 31 15:29:21 2007
@@ -75,7 +75,7 @@
 
     if (isLink)
     {
-      renderEncodedURIAttribute(context, HREF_ATTRIBUTE, destination);
+      renderEncodedActionURI(context, HREF_ATTRIBUTE, destination);
       renderAttribute(context, node,
                       TARGET_FRAME_ATTRIBUTE, TARGET_FRAME_ATTR);
 
@@ -86,7 +86,7 @@
     {
       writer.startElement(IMAGE_ELEMENT, null);
       renderStyleClassAttribute(context, AF_MENU_BUTTONS_IMAGE_STYLE_CLASS);
-      renderURIAttribute(context, SOURCE_ATTRIBUTE, iconURI);
+      renderEncodedResourceURI(context, SOURCE_ATTRIBUTE, iconURI);
       renderAltAndTooltipForImage(context, shortDesc);
       renderAttribute(context, BORDER_ATTRIBUTE, 0);
       renderAttribute(context, node, WIDTH_ATTRIBUTE, WIDTH_ATTR);

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/HeaderRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/HeaderRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/HeaderRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/HeaderRenderer.java Wed Jan 31 15:29:21 2007
@@ -236,7 +236,7 @@
         writer.startElement(IMAGE_ELEMENT, null);
         writer.writeAttribute(ALT_ATTRIBUTE, EMPTY_STRING_ATTRIBUTE_VALUE, null);   
         renderStyleClassAttribute(context, AF_PANEL_HEADER_ICON_STYLE_CLASS);
-        renderURIAttribute(context, SOURCE_ATTRIBUTE, iconURI);
+        renderEncodedResourceURI(context, SOURCE_ATTRIBUTE, iconURI);
         writer.endElement(IMAGE_ELEMENT);
       }
     }

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/HtmlLafRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/HtmlLafRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/HtmlLafRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/HtmlLafRenderer.java Wed Jan 31 15:29:21 2007
@@ -226,9 +226,12 @@
       return;
 
     ResponseWriter writer = context.getResponseWriter();
-
-    writer.writeAttribute(attribute,
-                          LafIconProvider.getCacheImageURI(context) + uri,
+    String cachedImgURI = LafIconProvider.getCacheImageURI(context) + uri;
+    FacesContext facesContext = context.getFacesContext();
+    if(facesContext != null)
+      cachedImgURI = facesContext.getExternalContext().encodeResourceURL(cachedImgURI);
+    writer.writeURIAttribute(attribute,
+                          cachedImgURI,
 						  null);
   }
 }

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/IconButtonRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/IconButtonRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/IconButtonRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/IconButtonRenderer.java Wed Jan 31 15:29:21 2007
@@ -79,7 +79,7 @@
 
       Object destination = getDestination(context, node);
       if (destination != null)
-        renderEncodedURIAttribute(context, HREF_ATTRIBUTE, destination);
+        renderEncodedActionURI(context, HREF_ATTRIBUTE, destination);
     }
   }
 
@@ -95,7 +95,7 @@
     {
       ResponseWriter writer = context.getResponseWriter();
       writer.startElement("img", null);
-      writer.writeURIAttribute("src", source, null);
+      renderEncodedResourceURI(context, "src", source);
       writer.writeAttribute("border", "0", null);
       renderAltAndTooltipForImage(context, getShortDesc(context, node));
       writer.writeAttribute("align", getVAlign(context, node), null);

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java Wed Jan 31 15:29:21 2007
@@ -741,7 +741,7 @@
 
       // Convert iconURL to an absolute uri
       if (isIconAbsoluteURI)
-        renderURIAttribute(context, SOURCE_ATTRIBUTE, icon);
+        renderEncodedResourceURI(context, SOURCE_ATTRIBUTE, icon);
       else
         writeAbsoluteImageURI(context, SOURCE_ATTRIBUTE, icon);
         

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/HeaderRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/HeaderRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/HeaderRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/HeaderRenderer.java Wed Jan 31 15:29:21 2007
@@ -150,7 +150,7 @@
         {
             writer.startElement(IMAGE_ELEMENT, null);
             writer.writeAttribute(ALT_ATTRIBUTE, EMPTY_STRING_ATTRIBUTE_VALUE, null);
-            renderURIAttribute(context, SOURCE_ATTRIBUTE, iconURI);
+            renderEncodedResourceURI(context, SOURCE_ATTRIBUTE, iconURI);
             writer.endElement(IMAGE_ELEMENT);
         }
 

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ButtonRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ButtonRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ButtonRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ButtonRenderer.java Wed Jan 31 15:29:21 2007
@@ -22,6 +22,8 @@
 
 import javax.faces.component.UIComponent;
 
+import javax.faces.context.FacesContext;
+
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors;
 import org.apache.myfaces.trinidadinternal.ui.NodeUtils;
 import org.apache.myfaces.trinidadinternal.ui.UINode;
@@ -270,7 +272,11 @@
 
         if (destination != null)
         {
-          destination = encodeURL(context, destination);
+          String destinationBeforeEncode = destination;
+          FacesContext facesContext = context.getFacesContext();
+          if(facesContext != null)
+            destination = facesContext.getExternalContext().encodeActionURL(destination);
+
           Object targetFrame = getTargetFrame(context, node);
 
           // if destination starts with "javascript:",
@@ -286,8 +292,8 @@
                         destination    +
                         "'";
           }
-          else if ( destination.length() < 11 ||
-                    !"javascript:".equalsIgnoreCase(destination.substring(0,11)))
+          else if ( destinationBeforeEncode.length() < 11 ||
+                    !"javascript:".equalsIgnoreCase(destinationBeforeEncode.substring(0,11)))
           {
             onClickJS = "document.location='" + destination + "'";
           }

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/CommandItemRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/CommandItemRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/CommandItemRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/CommandItemRenderer.java Wed Jan 31 15:29:21 2007
@@ -88,7 +88,7 @@
       
       if ( destination != null)
       {
-        value = '#' + encodeURL(context, destination);
+        value = '#' + encodeActionURL(context, destination);
       }
       else if ( value != null)
       {

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ImageRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ImageRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ImageRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ImageRenderer.java Wed Jan 31 15:29:21 2007
@@ -184,7 +184,7 @@
   {
     Object source = _getLocalSource(context, node);
 
-    renderURIAttribute(context, SOURCE_ATTRIBUTE, source);
+    renderEncodedResourceURI(context, SOURCE_ATTRIBUTE, source);
     renderAltAndTooltipForImage(context, getShortDesc(context, node));
     renderAttribute(context, node, WIDTH_ATTRIBUTE,  WIDTH_ATTR);
     renderAttribute(context, node, HEIGHT_ATTRIBUTE, HEIGHT_ATTR);
@@ -277,7 +277,7 @@
 
     if (hasLink)
     {
-      renderEncodedURIAttribute(context, HREF_ATTRIBUTE, destination);
+      renderEncodedActionURI(context, HREF_ATTRIBUTE, destination);
 
       if (supportsAccessKeys(context))
       {

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/LinkRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/LinkRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/LinkRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/LinkRenderer.java Wed Jan 31 15:29:21 2007
@@ -198,7 +198,7 @@
       if (!isJavascript ||
           supportsScripting(context))
       {
-        renderEncodedURIAttribute(context, "href", destination);
+        renderEncodedActionURI(context, "href", destination);
       }
     }
 

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/NavigationBarRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/NavigationBarRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/NavigationBarRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/NavigationBarRenderer.java Wed Jan 31 15:29:21 2007
@@ -514,7 +514,8 @@
         // First, non-formSubmitted mode.
         if (formName == null)
         {
-          onChange = _getChoiceOnChange(_getDestinationString(context, navBar),
+          onChange = _getChoiceOnChange(context,
+                                        _getDestinationString(context, navBar),
                                         sourceKey,
                                         eventKey,
                                         name,
@@ -565,6 +566,7 @@
   }
 
   private String _getChoiceOnChange(
+    UIXRenderingContext context,
     String destination,
     String sourceKey,
     String eventKey,
@@ -608,13 +610,20 @@
       startScript = _CHOICE_ON_CHANGE_START;
       endScript = _CHOICE_ON_CHANGE_END;
     }
-
-    StringBuffer buffer = new StringBuffer(initialSize          +
-                                           startScript.length() +
-                                           endScript.length());
+    
+    int bufferlength = initialSize + startScript.length() + endScript.length();
+    StringBuffer buffer = new StringBuffer(bufferlength);
+    StringBuffer urlBuffer = new StringBuffer(initialSize);
 
     buffer.append(startScript);
-    appendURLArguments(buffer, destination, keysAndValues);
+    
+    appendURLArguments(urlBuffer, destination, keysAndValues);
+    String url = urlBuffer.toString();
+    FacesContext facesContext = context.getFacesContext();
+    if(facesContext != null)
+      url = facesContext.getExternalContext().encodeActionURL(url);
+    
+    buffer.append(url);
     buffer.append(endScript);
 
     return buffer.toString();
@@ -1339,7 +1348,8 @@
         int count = choice.getIndexedChildCount(context);
         if (count > 1)
         {
-          onChange = _getChoiceOnChange(destination,
+          onChange = _getChoiceOnChange(context, 
+                                        destination,
                                         sourceKey,
                                         eventKey,
                                         name,

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ScriptRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ScriptRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ScriptRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ScriptRenderer.java Wed Jan 31 15:29:21 2007
@@ -75,7 +75,7 @@
       }
 
       writer.writeAttribute("language", "javascript", null);
-      writer.writeURIAttribute("src", source, null);
+      renderEncodedResourceURI(context, "src", source);
       _renderDeferAttribute(context, node);
       // Bug #3426092:
       // render the type="text/javascript" attribute in accessibility mode

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafRenderer.java Wed Jan 31 15:29:21 2007
@@ -22,6 +22,8 @@
 import java.util.Iterator;
 
 import javax.faces.component.UIComponent;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 import javax.faces.convert.Converter;
 import javax.faces.validator.Validator;
@@ -470,7 +472,7 @@
   {
     return true;
   }
-
+  
   public static void renderStyleAndClass(
     UIXRenderingContext context,
     String           inlineStyle,
@@ -1434,7 +1436,7 @@
         if (supportsNavigation(context))
         {
           writer.startElement("a", null);
-          renderEncodedURIAttribute(context, HREF_ATTRIBUTE, destination);
+          renderEncodedActionURI(context, HREF_ATTRIBUTE, destination);
           writer.writeAttribute("onclick", onClick, null);
           writer.writeAttribute("target", targetFrame, null);
 
@@ -1461,7 +1463,7 @@
       // get the correct alignment to use for the agent
       writer.writeAttribute("align", imgAlign, null);
 
-      writer.writeAttribute("src", iconAbsoluteURI, null);
+      renderEncodedResourceURI(context, "src", iconAbsoluteURI);
       writer.writeAttribute("border", "0", null);
       if (isBlock)
       {
@@ -1507,9 +1509,11 @@
 
     ResponseWriter writer = context.getResponseWriter();
 
-    writer.writeAttribute(attribute,
-                          getBaseImageURI(context) + uri,
-                                                  null);
+    String encodedUri = getBaseImageURI(context) + uri;
+    FacesContext facesContext = context.getFacesContext();
+    if (facesContext != null)
+      encodedUri = facesContext.getExternalContext().encodeResourceURL(encodedUri);
+    writer.writeURIAttribute(attribute, encodedUri, null);
   }
 
 

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java Wed Jan 31 15:29:21 2007
@@ -27,7 +27,6 @@
 import java.util.Stack;
 
 import javax.faces.component.UIComponent;
-import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 
@@ -46,9 +45,7 @@
 import org.apache.myfaces.trinidadinternal.share.url.FormEncoder;
 import org.apache.myfaces.trinidadinternal.style.ParsedPropertyKey;
 import org.apache.myfaces.trinidadinternal.style.Style;
-import org.apache.myfaces.trinidadinternal.style.StyleContext;
 import org.apache.myfaces.trinidadinternal.style.StyleMap;
-import org.apache.myfaces.trinidadinternal.style.StyleProvider;
 import org.apache.myfaces.trinidadinternal.style.util.StyleUtils;
 import org.apache.myfaces.trinidadinternal.ui.AttributeKey;
 import org.apache.myfaces.trinidadinternal.ui.MutableUINode;
@@ -313,18 +310,8 @@
     // try to get it now
     if (styleClasses == null)
     {
-      ExternalContext external =
-        context.getFacesContext().getExternalContext();
-
-      if (!"true".equals(
-           external.getInitParameter(
-             Configuration.DISABLE_CONTENT_COMPRESSION)))
-      {
-        StyleContext styleContext = context.getStyleContext();
-        StyleProvider provider = context.getStyleContext().getStyleProvider();
-        styleClasses = StyleUtils.getShortStyleClasses(styleContext, provider);
-
-      }
+      RenderingContext arc = RenderingContext.getCurrentInstance();
+      styleClasses = context.getSkin().getStyleClassMap(arc);
 
       if (styleClasses == null)
         styleClasses = _NULL_STYLE_CLASSES;

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/FormattedTextParser.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/FormattedTextParser.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/FormattedTextParser.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/FormattedTextParser.java Wed Jan 31 15:29:21 2007
@@ -726,7 +726,10 @@
       RenderingContext arc = RenderingContext.getCurrentInstance();
       if (!Boolean.FALSE.equals(arc.getAgent().getCapabilities().get(
                TrinidadAgent.CAP_NAVIGATION)))
+      {  
+        href = context.getExternalContext().encodeActionURL(href);
         context.getResponseWriter().writeURIAttribute("href", href, null);
+      }
     }
 
     @Override

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/PseudoFacesContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/PseudoFacesContext.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/PseudoFacesContext.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/PseudoFacesContext.java Wed Jan 31 15:29:21 2007
@@ -18,17 +18,7 @@
  */
 package org.apache.myfaces.trinidadinternal.webapp;
 
-import java.io.InputStream;
-import java.net.URL;
-
-import java.util.AbstractMap;
-import java.util.Collections;
 import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-import java.security.Principal;
 
 import javax.faces.application.Application;
 import javax.faces.application.FacesMessage;
@@ -37,16 +27,8 @@
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseStream;
 import javax.faces.context.ResponseWriter;
-
 import javax.faces.render.RenderKit;
 
-//import javax.servlet.ServletContext;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
 /**
  * Pseudo FacesContext, vended by the filter for code that 
  * needs to run before (or after) the FacesServlet, but needs
@@ -57,12 +39,10 @@
  */
 class PseudoFacesContext extends FacesContext
 {
-  public PseudoFacesContext(
-    ServletRequest  request,
-    ServletResponse response)
+  public PseudoFacesContext(ExternalContext ec)
   {
-    _external = new External((HttpServletRequest) request,
-                             (HttpServletResponse) response);
+    assert ec!= null;
+    _external = ec;
   }
 
   @Override
@@ -181,281 +161,4 @@
 
 
   private final ExternalContext _external;
-
-  private static final class External extends ExternalContext
-  {
-    public External(
-      HttpServletRequest  request,
-      HttpServletResponse response)
-    {
-      _request  = request;
-      _response = response;
-    }
-    
-    // Can't very well have a ServletContext before a servlet!!!
-    @Override
-    public Object getContext() { throw new UnsupportedOperationException(); }
-    @Override
-    public Object getRequest() { return _request; }
-    @Override
-    public Object getResponse() { return _response; }
-    @Override
-    public Object getSession(boolean create)
-    {
-      return _request.getSession(create);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public Map<String, Object> getSessionMap()
-    {
-      Object o = getSession(true);
-      if (o == null)
-        return Collections.EMPTY_MAP;
-
-      return new SessionMap((HttpSession) o);
-    }
-
-    @Override
-    public String getRequestContextPath()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public String getRequestServletPath()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public String getInitParameter(String name)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public String encodeResourceURL(String url)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public String encodeActionURL(String url)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Map<String, Object> getRequestMap()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Map<String, Object> getApplicationMap()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void dispatch(String path)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public String encodeNamespace(String name)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public String getAuthType()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    // -= Simon Lessard =- 
-    // FIXME: Odd... JSF 1.2 does not give generics type for this map
-    @SuppressWarnings("unchecked")
-    @Override
-    public Map getInitParameterMap()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public String getRemoteUser()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Map<String, Object> getRequestCookieMap()
-    {
-      throw new UnsupportedOperationException();
-    }
-    
-    @Override
-    public Map<String, String> getRequestHeaderMap()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Map<String, String[]> getRequestHeaderValuesMap()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Locale getRequestLocale()
-    {
-      throw new UnsupportedOperationException();
-    }
-    
-    @Override
-    public Iterator<Locale> getRequestLocales()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Map<String, String> getRequestParameterMap()
-    {
-      return new ParameterMap(_request);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public Iterator<String> getRequestParameterNames()
-    {
-      return _request.getParameterMap().keySet().iterator();
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public Map<String, String[]> getRequestParameterValuesMap()
-    {
-      return _request.getParameterMap();
-    }
-
-    @Override
-    public String getRequestPathInfo()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public URL getResource(String path)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public InputStream getResourceAsStream(String path)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Set<String> getResourcePaths(String path)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Principal getUserPrincipal()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean isUserInRole(String role)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void log(String message)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void log(String message, Throwable exception)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void redirect(String url)
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    private HttpServletRequest  _request;
-    private HttpServletResponse _response;
-  }
-
-  private static final class ParameterMap extends AbstractMap<String, String>
-  {
-    public ParameterMap(ServletRequest request)
-    {
-      _request = request;
-    }
-    
-    @Override
-    public String get(Object key)
-    {
-      return _request.getParameter((String) key);
-    }
-        
-    @Override
-    public Set<Map.Entry<String, String>> entrySet()
-    {
-      throw new UnsupportedOperationException();
-    }
-    
-    private ServletRequest _request;
-  }
-
-  private static final class SessionMap extends AbstractMap<String, Object>
-  {
-    public SessionMap(HttpSession session)
-    {
-      _session = session;
-    }
-    
-    @Override
-    public Object get(Object key)
-    {
-      return _session.getAttribute((String) key);
-    }
-    
-    @Override
-    public Object put(String key, Object value)
-    {
-      Object old = _session.getAttribute(key);
-      _session.setAttribute(key, value);
-      return old;
-    }
-    
-    @Override
-    public Object remove(Object key)
-    {
-      Object old = _session.getAttribute((String) key);
-      _session.removeAttribute((String) key);
-      return old;
-    }
-    
-    @Override
-    public Set<Map.Entry<String, Object>> entrySet()
-    {
-      throw new UnsupportedOperationException();
-    }
-    
-    private HttpSession _session;
-  }
 }

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/TrinidadFilterImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/TrinidadFilterImpl.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/TrinidadFilterImpl.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/TrinidadFilterImpl.java Wed Jan 31 15:29:21 2007
@@ -19,14 +19,11 @@
 package org.apache.myfaces.trinidadinternal.webapp;
 
 import java.io.IOException;
-import java.io.InputStream;
-
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
-
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
@@ -40,19 +37,14 @@
 import javax.servlet.http.HttpServletResponseWrapper;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
-import org.apache.myfaces.trinidad.context.RequestContext;
-import org.apache.myfaces.trinidad.context.RequestContextFactory;
-import org.apache.myfaces.trinidad.model.UploadedFile;
 import org.apache.myfaces.trinidad.util.ClassLoaderUtils;
-
-import org.apache.myfaces.trinidadinternal.context.RequestContextFactoryImpl;
+import org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl;
+import org.apache.myfaces.trinidadinternal.config.dispatch.DispatchResponseConfiguratorImpl;
+import org.apache.myfaces.trinidadinternal.config.dispatch.DispatchServletResponse;
+import org.apache.myfaces.trinidadinternal.config.upload.FileUploadConfiguratorImpl;
+import org.apache.myfaces.trinidadinternal.config.upload.UploadRequestWrapper;
 import org.apache.myfaces.trinidadinternal.context.RequestContextImpl;
-import org.apache.myfaces.trinidadinternal.context.TrinidadPhaseListener;
-import org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler;
-import org.apache.myfaces.trinidadinternal.share.util.MultipartFormItem;
-import org.apache.myfaces.trinidad.skin.SkinFactory;
-import org.apache.myfaces.trinidadinternal.skin.SkinFactoryImpl;
-import org.apache.myfaces.trinidadinternal.skin.SkinUtils;
+import org.apache.myfaces.trinidadinternal.context.external.ServletExternalContext;
 
 /**
  * Actual implementation of the Trinidad servlet filter.
@@ -91,68 +83,26 @@
       context.getExternalContext().getRequestMap().get(_IS_RETURNING_KEY));
   }
 
-
-
-  /**
-   * Sets the maximum number of bytes that MultipartFormItem.writeFile()
-   * will be allowed to write.  This value may be set immediately
-   * before or between calls to MultipartFormItem.writeFile().  If
-   * any call to writeFile() exceeds this value, an EOFException
-   * will be thrown.
-   * <p>
-   * @param maxAllowedBytes the maximum number of bytes that
-   * MultipartFormItem.writeFile() will be allowed to write.  Defaults
-   * to 128MB.
-   * @see org.apache.myfaces.trinidadinternal.share.util.MultipartFormItem#writeFile
-   */
-  public void setMaximumAllowedBytes(long maxAllowedBytes)
-  {
-    _maxAllowedBytes = Math.max(0L, maxAllowedBytes);
-  }
-
-  /**
-   * Gets the maximum number of bytes that MultipartFormItem.writeFile()
-   * will be allowed to write.
-   */
-  public long getMaximumAllowedBytes()
-  {
-    return _maxAllowedBytes;
-  }
-
-  public void init(
-    FilterConfig filterConfig) throws ServletException
+  public void init(FilterConfig filterConfig) throws ServletException
   {
-    if (RequestContextFactory.getFactory() == null)
-      RequestContextFactory.setFactory(new RequestContextFactoryImpl());
-
     _servletContext = filterConfig.getServletContext();
-
-    // Create a new SkinFactory if needed.
-    if (SkinFactory.getFactory() == null)
-      SkinFactory.setFactory(new SkinFactoryImpl());
-
-    // register the base skins
-    SkinUtils.registerBaseSkins();
-    
+            
+    //There is some functionality that still might require servlet-only filter services.
     _filters = ClassLoaderUtils.getServices(TrinidadFilterImpl.class.getName());
     for(Filter f:_filters)
     {
       f.init(filterConfig);
     }
-    // after the 'services' filters are initialized, then register
-    // the skin extensions & skin additions found in trinidad-skins.xml. 
-    // This gives a chance to the 'services' filters to create more base
-    // skins that the skins in trinidad-skins.xml can extend.
-    SkinUtils.registerSkinExtensions(_servletContext);
-
   }
 
   public void destroy()
   {
+    //Destroy filter services
     for(Filter f:_filters)
     {
       f.destroy();
     }
+
     _filters = null;
   }
 
@@ -162,6 +112,7 @@
     ServletResponse response,
     FilterChain     chain) throws IOException, ServletException
   {
+    //Execute the filter services
     if (!_filters.isEmpty())
       chain = new FilterListChain(_filters, chain);
 
@@ -169,110 +120,28 @@
     // properly installed.
     request.setAttribute(_FILTER_EXECUTED_KEY, Boolean.TRUE);
 
-
-    // If someone didn't release the RequestContext on an earlier request,
-    // then it'd still be around, and trying to create a new one
-    // would trigger an exception.  We don't want to take down
-    // this thread for all eternity, so clean up after poorly-behaved code.
-    RequestContext context = RequestContext.getCurrentInstance();
-    if (context != null)
-    {
-      if (_LOG.isWarning())
-        _LOG.warning("RequestContext had not been properly released on earlier " +
-                     "request.");
-      context.release();
-    }
-
-    RequestContextFactory factory = RequestContextFactory.getFactory();
-    assert(factory != null);
-
-    // See if we've got a cached RequestContext instance;  if so,
-    // reattach it
-    Object cachedRequestContext = 
-      request.getAttribute(TrinidadPhaseListener.CACHED_REQUEST_CONTEXT);
-
-    // Catch both the null scenario and the 
-    // RequestContext-from-a-different-classloader scenario
-    if (cachedRequestContext instanceof RequestContext)
-    {
-      context = (RequestContext) cachedRequestContext;
-      context.attach();
-    }
-    else
+    ExternalContext externalContext = new ServletExternalContext(_servletContext, request, response);    
+    GlobalConfiguratorImpl config = GlobalConfiguratorImpl.getInstance();
+    config.beginRequest(externalContext);
+    
+    //To maintain backward compatibilty, wrap the request at the filter level
+    Map<String, String[]> addedParams = (Map<String, String[]>) externalContext.getRequestMap().
+      get(FileUploadConfiguratorImpl._PARAMS);
+    
+    if(addedParams != null)
     {
-      context = factory.createContext(_servletContext, request);
-      request.setAttribute(TrinidadPhaseListener.CACHED_REQUEST_CONTEXT,
-                           context);
+      FileUploadConfiguratorImpl.apply(externalContext);
+      request = new UploadRequestWrapper((HttpServletRequest)request, addedParams);
     }
-
-    assert(RequestContext.getCurrentInstance() == context);
-
+    
     try
     {
-      // Only handle multipart and HTTP requests
-      if (!MultipartFormHandler.isMultipartRequest(request) ||
-          !(request instanceof HttpServletRequest))
-      {
-        _doFilterImpl(request, response, chain);
-      }
-      else
-      {
-        MultipartFormHandler mfh = new MultipartFormHandler(request);
-        mfh.setMaximumAllowedBytes(getMaximumAllowedBytes());
-        mfh.setCharacterEncoding(request.getCharacterEncoding());
-
-        HashMap<String, String[]> parameters = new HashMap<String, String[]>();
-
-        // Copy over all parameters that were already present (for example,
-        // query parameters)
-        parameters.putAll(request.getParameterMap());
-
-        MultipartFormItem item;
-        UploadedFiles files = new UploadedFiles(request);
-        while ((item = mfh.getNextPart()) != null)
-        {
-          String name = item.getName();
-          String value = null;
-          // No filename - it's not a file uploaded field
-          if (item.getFilename() == null)
-          {
-            value = item.getValue();
-            Object oldValue = parameters.get(name);
-            if (oldValue == null)
-            {
-              parameters.put(name, new String[]{value});
-            }
-            else
-            {
-              String[] oldArray = (String[]) oldValue;
-              String[] newArray = new String[oldArray.length + 1];
-              System.arraycopy(oldArray, 0, newArray, 1, oldArray.length);
-              newArray[0] = value;
-              parameters.put(name, newArray);
-            }
-          }
-          // Upload a file
-          else if (item.getFilename().length() > 0)
-          {
-            _doUploadFile(context, request, files, item);
-          }
-        }
-
-        request = new UploadRequestWrapper((HttpServletRequest) request,
-                                           parameters);
-
-        _doFilterImpl(request, response, chain);
-
-        files.dispose();
-      }
+      
+      _doFilterImpl(request, response, chain);
     }
     finally
     {
-      if (context != null)
-      {
-        context.release();
-        assert(RequestContext.getCurrentInstance() == null);
-      }
+      config.endRequest(externalContext);
     }
   }
 
@@ -283,12 +152,17 @@
     ServletResponse response,
     FilterChain     chain) throws IOException, ServletException
   {
+    // -= Scott O'Bryan =-
+    // This is used for PPR.  Not needed in Portal Environment at the moment
+    // At some point we may want to make this a configurator
     HttpServletResponse monitor
-      = new MonitorRedirectServletResponse((HttpServletResponse) response,
-                                           request);
-
-    ServletResponse dispatch
-      = new DispatchServletResponse(monitor, (HttpServletRequest)request);
+      = new MonitorRedirectServletResponse((HttpServletResponse) response, request);
+    
+    // -= Scott O'Bryan =-
+    // Added for backward compatibility
+    ExternalContext ec = new ServletExternalContext(_servletContext, request, monitor);
+    HttpServletResponse dispatch = new DispatchServletResponse(ec);
+    DispatchResponseConfiguratorImpl.apply(ec);
 
     _invokeDoFilter(request, dispatch, chain);
 
@@ -301,6 +175,12 @@
     //        However, the Servlet specification suggest <String, Object> so this 
     //        could lead to some nasty problems one day. Especially if JEE spec includes 
     //        generics for its Servlet API soon.
+    //
+    // -= Scott O'Bryan =- 
+    // TODO: The following should be made available to the Portal.  This is not trivial 
+    //       because this just re-invokes the filter chain with a new set of parameters.
+    //       In the portal environment, this must rerun the portlet without the use of 
+    //       filters until Portlet 2.0.
     Map<String, String[]> launchParameters = (Map<String, String[]>)
       request.getAttribute(RequestContextImpl.LAUNCH_PARAMETERS);
     if (launchParameters != null)
@@ -322,7 +202,8 @@
     // Set up a PseudoFacesContext with the actual request and response
     // so that RequestContext can be more functional in the interval
     // between now and when the FacesServlet starts.
-    PseudoFacesContext pfc = new PseudoFacesContext(request, response);
+    PseudoFacesContext pfc = new PseudoFacesContext(
+      new ServletExternalContext(_servletContext, request, response));
     _PSEUDO_FACES_CONTEXT.set(pfc);
     try
     {
@@ -334,28 +215,6 @@
     }
   }
 
-  private void _doUploadFile(
-    RequestContext   context,
-    ServletRequest    request,
-    UploadedFiles     files,
-    MultipartFormItem item) throws IOException
-  {
-    UploadedFile temp = new TempUploadedFile(item);
-
-    UploadedFile file =
-      context.getUploadedFileProcessor().processFile(request, temp);
-
-    if (file != null)
-    {
-      // Store the file.
-      files.__put(item.getName(), file);
-
-      if (_LOG.isFine())
-        _LOG.fine("Uploaded file " + file.getFilename() + "(" +
-                  file.getLength() + " bytes) for ID " + item.getName());
-    }
-  }
-
   /**
    * A ServletResponseWrapper that will catch partial page redirects
    * and handle them correctly.
@@ -428,50 +287,6 @@
     }
   }
 
-  static private class TempUploadedFile implements UploadedFile
-  {
-    public TempUploadedFile(MultipartFormItem item)
-    {
-      _item = item;
-      assert(item.getValue() == null);
-    }
-
-    public String getFilename()
-    {
-      return _item.getFilename();
-    }
-
-    public String getContentType()
-    {
-      return _item.getContentType();
-    }
-
-    public long getLength()
-    {
-      // The length is not known yet.
-      return -1L;
-    }
-
-    public Object getOpaqueData()
-    {
-      return null;
-    }
-
-    public InputStream getInputStream() throws IOException
-    {
-      return _item.getInputStream();
-    }
-
-    public void dispose()
-    {
-      throw new UnsupportedOperationException();
-    }
-
-    private MultipartFormItem _item;
-  }
-
-  private long _maxAllowedBytes = 1L << 27;
-
   private ServletContext _servletContext;
   private List<Filter> _filters = null;
 
@@ -493,5 +308,6 @@
     protected PseudoFacesContext initialValue() { return null; }
   };
 
-  private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(TrinidadFilterImpl.class);
+  private static final TrinidadLogger _LOG =
+    TrinidadLogger.createTrinidadLogger(TrinidadFilterImpl.class);
 }

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.xss
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.xss?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.xss (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.xss Wed Jan 31 15:29:21 2007
@@ -1174,16 +1174,16 @@
     <property name="cursor">pointer</property>
   </style>
   <style selector="af|navigationPane::bar-active-enabled af|navigationPane::bar-content">
-    <property name="color">black</property>
+    <includeStyle name="AFTextForeground"/>
   </style>
   <style selector="af|navigationPane::bar-inactive-enabled af|navigationPane::bar-content">
-    <property name="color">black</property>
+    <includeStyle name="AFTextForeground"/>  
   </style>
   <style selector="af|navigationPane::bar-active-enabled af|navigationPane::bar-content a">
-    <property name="color">black</property>
+    <includeStyle name="AFTextForeground"/>  
   </style>
   <style selector="af|navigationPane::bar-inactive-enabled af|navigationPane::bar-content a">
-    <property name="color">black</property>
+    <includeStyle name="AFTextForeground"/>
   </style>
   <style selector="af|navigationPane::bar-active-enabled af|navigationPane::bar-content a:hover">
     <property name="text-decoration">underline</property>
@@ -1349,11 +1349,13 @@
   <style selector="af|navigationPane::tabs-inactive">
     <property name="cursor">pointer</property>
   </style>
-  <style selector="af|navigationPane af|navigationPane::tabs-active:disabled">
+  <style selector="af|navigationPane::tabs-active:disabled">
     <property name="cursor">default</property>
+    <property name="color">gray</property>
   </style>
-  <style selector="af|navigationPane af|navigationPane::tabs-inactive:disabled">
+  <style selector="af|navigationPane::tabs-inactive:disabled">
     <property name="cursor">default</property>
+    <property name="color">gray</property>
   </style>
   <style selector="af|navigationPane::tabs-start">
     <includeStyle name=".p_AFOverlappingTabTopHeight"/>
@@ -1426,18 +1428,18 @@
   <style selector="af|navigationPane::tabs-mid">
     <includeStyle name="AFDefaultFont"/>
     <property name="padding-left">3px</property>
-    <property name="color">#000000</property>
+    <includeStyle name="AFTextForeground"/>
     <property name="white-space">nowrap</property>
   </style>
   <style selector="af|navigationPane::tabs-mid A">
     <includeStyle name="AFDefaultFont"/>
-    <property name="color">#000000</property>
+    <includeStyle name="AFTextForeground"/>
     <property name="text-decoration">none</property>
   </style>
-  <style selector="af|navigationPane af|navigationPane::tabs-active:disabled af|navigationPane::tabs-mid">
+  <style selector="af|navigationPane::tabs-active:disabled af|navigationPane::tabs-mid">
     <property name="color">gray</property>
   </style>
-  <style selector="af|navigationPane af|navigationPane::tabs-inactive:disabled af|navigationPane::tabs-mid">
+  <style selector="af|navigationPane::tabs-inactive:disabled af|navigationPane::tabs-mid">
     <property name="color">gray</property>
   </style>
   <style selector="af|navigationPane::tabs-bottom-mid">
@@ -1474,11 +1476,9 @@
   <style selector="af|navigationPane::tabs-active af|navigationPane::tabs-mid">
     <property name="background-image">url('../../images/tab3-mid-selected.gif')</property>
     <property name="font-weight">bold</property>
-    <property name="color">#585955</property>
   </style>
   <style selector="af|navigationPane::tabs-active af|navigationPane::tabs-mid A">
     <property name="font-weight">bold</property>
-    <property name="color">#585955</property>
   </style>
   <style selector="af|navigationPane::tabs-active af|navigationPane::tabs-bottom-mid">
     <property name="background-image">url('../../images/tab3-bot-mid-selected.gif')</property>
@@ -1515,10 +1515,10 @@
   </style>
   <style selector="af|navigationPane::tabs-inactive af|navigationPane::tabs-mid">
     <property name="background-image">url('../../images/tab3-mid-deselected.gif')</property>
-    <property name="color">#000000</property>
+    <includeStyle name="AFTextForeground"/>
   </style>
   <style selector="af|navigationPane::tabs-inactive af|navigationPane::tabs-mid A">
-    <property name="color">#000000</property>
+    <includeStyle name="AFTextForeground"/>
   </style>
   <style selector="af|navigationPane::tabs-inactive af|navigationPane::tabs-bottom-mid">
     <property name="background-image">url('../../images/tab3-bot-deselected.gif')</property>

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/RequestContextTest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/RequestContextTest.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/RequestContextTest.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/RequestContextTest.java Wed Jan 31 15:29:21 2007
@@ -125,6 +125,6 @@
   {
     // =-=AEW Would be better to create it with a mock context so we
     // can test parsing
-    return (new RequestContextFactoryImpl()).createContext(null, null);
+    return (new RequestContextFactoryImpl()).createContext(null);
   }
 }



Mime
View raw message