tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r917715 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/internal/services/ main/java/org/apache/tapestry5/services/ test/java/org/apache/tapestry5/urlrewriter/
Date Mon, 01 Mar 2010 21:02:18 GMT
Author: hlship
Date: Mon Mar  1 21:02:18 2010
New Revision: 917715

URL: http://svn.apache.org/viewvc?rev=917715&view=rev
Log:
TAP5-1034: Fix bad merge

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/URLRewriterLinkEncoderInterceptor.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/urlrewriter/IntegrationTests.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/URLRewriterLinkEncoderInterceptor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/URLRewriterLinkEncoderInterceptor.java?rev=917715&r1=917714&r2=917715&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/URLRewriterLinkEncoderInterceptor.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/URLRewriterLinkEncoderInterceptor.java
Mon Mar  1 21:02:18 2010
@@ -19,7 +19,6 @@
 import org.apache.tapestry5.services.ComponentEventRequestParameters;
 import org.apache.tapestry5.services.PageRenderRequestParameters;
 import org.apache.tapestry5.services.Request;
-import org.apache.tapestry5.services.Response;
 import org.apache.tapestry5.services.URLRewriter;
 import org.apache.tapestry5.urlrewriter.SimpleRequestWrapper;
 import org.apache.tapestry5.urlrewriter.URLRewriteContext;
@@ -36,16 +35,13 @@
 
     private final Request request;
 
-    private final Response response;
-
     private final ComponentEventLinkEncoder delegate;
 
-    public URLRewriterLinkEncoderInterceptor(URLRewriter urlRewriter, Request request, Response
response,
+    public URLRewriterLinkEncoderInterceptor(URLRewriter urlRewriter, Request request,
             ComponentEventLinkEncoder delegate)
     {
         this.urlRewriter = urlRewriter;
         this.request = request;
-        this.response = response;
         this.delegate = delegate;
     }
 
@@ -71,7 +67,7 @@
             }
         };
 
-        return rewriteIfNeeded(standardLink, rewriteContext, forForm);
+        return rewriteIfNeeded(standardLink, rewriteContext);
     }
 
     public Link createPageRenderLink(final PageRenderRequestParameters parameters)
@@ -96,7 +92,7 @@
             }
         };
 
-        return rewriteIfNeeded(standardLink, rewriteContext, false);
+        return rewriteIfNeeded(standardLink, rewriteContext);
     }
 
     public ComponentEventRequestParameters decodeComponentEventRequest(Request request)
@@ -109,7 +105,7 @@
         return delegate.decodePageRenderRequest(request);
     }
 
-    private Link rewriteIfNeeded(Link link, URLRewriteContext context, boolean forForm)
+    private Link rewriteIfNeeded(Link link, URLRewriteContext context)
     {
         SimpleRequestWrapper fakeRequest = new SimpleRequestWrapper(request, link.getBasePath());
 
@@ -126,9 +122,7 @@
 
         boolean absolute = originalServerName.equals(rewrittenServerName) == false;
 
-        String newPath = rewritten.getPath();
-
-        String baseURI = absolute ? fullUrl(rewritten) : newPath;
+        String baseURI = absolute ? fullUrl(rewritten) : rewritten.getContextPath() + rewritten.getPath();
 
         return link.copyWithBasePath(baseURI);
     }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=917715&r1=917714&r2=917715&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
Mon Mar  1 21:02:18 2010
@@ -2736,7 +2736,7 @@
         if (!urlRewriter.hasLinkRules())
             return null;
 
-        return new URLRewriterLinkEncoderInterceptor(urlRewriter, request, response, encoder);
+        return new URLRewriterLinkEncoderInterceptor(urlRewriter, request, encoder);
     }
 
     /**

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/urlrewriter/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/urlrewriter/IntegrationTests.java?rev=917715&r1=917714&r2=917715&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/urlrewriter/IntegrationTests.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/urlrewriter/IntegrationTests.java
Mon Mar  1 21:02:18 2010
@@ -69,19 +69,20 @@
     public void test_url_rewriter_using_context() throws InterruptedException
     {
         open("/RewriteWithContext");
-        assertAttribute("//a[@class='page']/@href","/rpage/2sseccusetirwer");
-        assertAttribute("//a[@class='event']/@href", "/cevent/txetnochtiwetirwer:kcilc");
-        assertAttribute("//a[@class='action']/@href","/cevent/txetnochtiwetirwer.knilgnitcaeht");
+        assertAttribute("//a[@class='page']/@href","rpage/2sseccusetirwer");
+        assertAttribute("//a[@class='event']/@href", "cevent/txetnochtiwetirwer:kcilc");
+        assertAttribute("//a[@class='action']/@href","cevent/txetnochtiwetirwer.knilgnitcaeht");
 
+        open("/RewriteWithContext");
         clickAndWait("//a[@class='page']");
         assertTextPresent("URL Rewriting that relies on the RewriteContext evidently works.");
 
         //note that we should be able to get back to rewritewithcontext via rpage encoding/decoding...
-        open("/rpage/txetnochtiwetirwer");
+        open("/RewriteWithContext");
         clickAndWait("//a[@class='event']");
         assertTextPresent("URL Rewriting that relies on the RewriteContext evidently works.");
 
-        open("/rpage/txetnochtiwetirwer");
+        open("/RewriteWithContext");
         clickAndWait("//a[@class='action']");
         assertTextPresent("URL Rewriting that relies on the RewriteContext evidently works.");
     }



Mime
View raw message