myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1795578 - in /myfaces/test/trunk: test12/src/main/java/org/apache/myfaces/test/mock/ test20/src/main/java/org/apache/myfaces/test/mock/ test23/src/main/resources/
Date Fri, 19 May 2017 01:05:30 GMT
Author: lu4242
Date: Fri May 19 01:05:30 2017
New Revision: 1795578

URL: http://svn.apache.org/viewvc?rev=1795578&view=rev
Log:
Add methods that are abstract in JSF 2.3 spec to make it out easier

Added:
    myfaces/test/trunk/test23/src/main/resources/
Modified:
    myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext.java
    myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockViewHandler.java
    myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockPartialViewContext.java

Modified: myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext.java?rev=1795578&r1=1795577&r2=1795578&view=diff
==============================================================================
--- myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext.java
(original)
+++ myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockExternalContext.java
Fri May 19 01:05:30 2017
@@ -465,6 +465,34 @@ public class MockExternalContext extends
         response.sendRedirect(requestURI);
         FacesContext.getCurrentInstance().responseComplete();
     }
+    
+    public String encodeWebsocketURL(String baseUrl)
+    {
+        Integer port = 8080;
+        port = (port == 0) ? null : port;
+        if (port != null && 
+            !port.equals(request.getServerPort()))
+        {
+            String scheme = "http";
+            String serverName = request.getServerName();
+            String url;
+            try
+            {
+                url = new URL(scheme, serverName, port, baseUrl).toExternalForm();
+                url = url.replaceFirst("http", "ws");
+                return url;
+            }
+            catch (MalformedURLException ex)
+            {
+                //If cannot build the url, return the base one unchanged
+                return baseUrl;
+            }
+        }
+        else
+        {
+            return baseUrl;
+        }
+    }
 
     /**
      * <p>Iterator implementation that wraps an enumeration

Modified: myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockViewHandler.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockViewHandler.java?rev=1795578&r1=1795577&r2=1795578&view=diff
==============================================================================
--- myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockViewHandler.java
(original)
+++ myfaces/test/trunk/test12/src/main/java/org/apache/myfaces/test/mock/MockViewHandler.java
Fri May 19 01:05:30 2017
@@ -158,5 +158,12 @@ public class MockViewHandler extends Vie
     {
 
     }
+    
+    public String getWebsocketURL(FacesContext context, String channelAndToken)
+    {
+        String url = context.getExternalContext().getRequestContextPath() + 
+                "/javax.faces.push/"+channelAndToken;
+        return url;
+    }
 
 }

Modified: myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockPartialViewContext.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockPartialViewContext.java?rev=1795578&r1=1795577&r2=1795578&view=diff
==============================================================================
--- myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockPartialViewContext.java
(original)
+++ myfaces/test/trunk/test20/src/main/java/org/apache/myfaces/test/mock/MockPartialViewContext.java
Fri May 19 01:05:30 2017
@@ -55,6 +55,7 @@ public class MockPartialViewContext exte
     private Boolean _partialRequest = null;
     private Boolean _renderAll = null;
     private PartialResponseWriter _partialResponseWriter = null;
+    private List<String> _evalScripts = new ArrayList<String>();
 
     public MockPartialViewContext(FacesContext context)
     {
@@ -312,6 +313,12 @@ public class MockPartialViewContext exte
         _partialRequest = null;
         _renderAll = null;
         _facesContext = null;
+        _evalScripts = new ArrayList<String>();
+    }
+    
+    public List<String> getEvalScripts()
+    {
+        return _evalScripts;
     }
 
     private static String[] splitShortString(String str, char separator)



Mime
View raw message