Skip to content

Commit a02b6f3

Browse files
committed
Fixed issue ocpsoft#147
1 parent 7c283fd commit a02b6f3

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

‎integration-faces-tests/src/test/java/org/ocpsoft/rewrite/faces/jsession/JSessionIdTest.java‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.jboss.arquillian.junit.Arquillian;
2525
import org.jboss.arquillian.test.api.ArquillianResource;
2626
import org.jboss.shrinkwrap.api.spec.WebArchive;
27-
import org.junit.Ignore;
2827
import org.junit.Test;
2928
import org.junit.runner.RunWith;
3029
import org.ocpsoft.rewrite.faces.annotation.RewriteFacesAnnotationsTest;
@@ -92,8 +91,6 @@ public void withCookiesAndNavigateOutcome() throws Exception
9291
}
9392

9493
@Test
95-
// see: https://github.com/ocpsoft/rewrite/issues/147
96-
@Ignore
9794
public void withoutCookiesAndStandardOutcome() throws Exception
9895
{
9996

@@ -113,8 +110,6 @@ public void withoutCookiesAndStandardOutcome() throws Exception
113110
}
114111

115112
@Test
116-
// see: https://github.com/ocpsoft/rewrite/issues/147
117-
@Ignore
118113
public void withoutCookiesAndNavigateOutcome() throws Exception
119114
{
120115

‎integration-faces/src/main/java/org/ocpsoft/rewrite/faces/RewriteNavigationHandler.java‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,21 @@ private boolean redirect(final FacesContext context, final String outcome)
129129
else if (outcome != null && outcome.startsWith(REDIRECT_PREFIX)) {
130130

131131
// strip the prefix to get the context-relative URL
132-
String url = outcome.substring(REDIRECT_PREFIX.length());
132+
String relativeUrl = outcome.substring(REDIRECT_PREFIX.length());
133+
134+
// add the context path
135+
String absoluteUrl = prependContextPath(externalContext, relativeUrl);
133136

134137
// rewrite the URL
135-
String encodedUrl = externalContext.encodeActionURL(url);
138+
String rewrittenUrl = externalContext.encodeActionURL(absoluteUrl);
136139

137140
// send the redirect
138141
try {
139-
String absoluteUrl = prependContextPath(externalContext, encodedUrl);
140-
externalContext.redirect(absoluteUrl);
142+
externalContext.redirect(rewrittenUrl);
141143
return true;
142144
}
143145
catch (IOException e) {
144-
throw new RewriteException("Could not redirect to [" + encodedUrl + "]", e);
146+
throw new RewriteException("Could not redirect to [" + rewrittenUrl + "]", e);
145147
}
146148

147149
}

0 commit comments

Comments
 (0)