Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
1fe28af3
Commit
1fe28af3
authored
Oct 20, 2015
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue with forward:... routes
We have to ensure that the ZuulController is not mapped on a forward otherwise we just go back through the same code path and render nothing.
parent
6d559102
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
4 deletions
+12
-4
ZuulConfiguration.java
...springframework/cloud/netflix/zuul/ZuulConfiguration.java
+1
-1
SendForwardFilter.java
...k/cloud/netflix/zuul/filters/route/SendForwardFilter.java
+4
-3
ZuulHandlerMapping.java
...gframework/cloud/netflix/zuul/web/ZuulHandlerMapping.java
+6
-0
SendForwardFilterTests.java
...oud/netflix/zuul/filters/post/SendForwardFilterTests.java
+1
-0
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/ZuulConfiguration.java
View file @
1fe28af3
...
...
@@ -29,11 +29,11 @@ import org.springframework.cloud.netflix.zuul.filters.RouteLocator;
import
org.springframework.cloud.netflix.zuul.filters.SimpleRouteLocator
;
import
org.springframework.cloud.netflix.zuul.filters.ZuulProperties
;
import
org.springframework.cloud.netflix.zuul.filters.post.SendErrorFilter
;
import
org.springframework.cloud.netflix.zuul.filters.post.SendForwardFilter
;
import
org.springframework.cloud.netflix.zuul.filters.post.SendResponseFilter
;
import
org.springframework.cloud.netflix.zuul.filters.pre.DebugFilter
;
import
org.springframework.cloud.netflix.zuul.filters.pre.FormBodyWrapperFilter
;
import
org.springframework.cloud.netflix.zuul.filters.pre.Servlet30WrapperFilter
;
import
org.springframework.cloud.netflix.zuul.filters.route.SendForwardFilter
;
import
org.springframework.cloud.netflix.zuul.web.ZuulController
;
import
org.springframework.cloud.netflix.zuul.web.ZuulHandlerMapping
;
import
org.springframework.context.ApplicationEvent
;
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/
post
/SendForwardFilter.java
→
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/
route
/SendForwardFilter.java
View file @
1fe28af3
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package
org
.
springframework
.
cloud
.
netflix
.
zuul
.
filters
.
post
;
package
org
.
springframework
.
cloud
.
netflix
.
zuul
.
filters
.
route
;
import
javax.servlet.RequestDispatcher
;
...
...
@@ -32,12 +32,12 @@ public class SendForwardFilter extends ZuulFilter {
@Override
public
String
filterType
()
{
return
"
post
"
;
return
"
route
"
;
}
@Override
public
int
filterOrder
()
{
return
20
00
;
return
5
00
;
}
@Override
...
...
@@ -57,6 +57,7 @@ public class SendForwardFilter extends ZuulFilter {
ctx
.
set
(
SEND_FORWARD_FILTER_RAN
,
true
);
if
(!
ctx
.
getResponse
().
isCommitted
())
{
dispatcher
.
forward
(
ctx
.
getRequest
(),
ctx
.
getResponse
());
ctx
.
getResponse
().
flushBuffer
();
}
}
}
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/web/ZuulHandlerMapping.java
View file @
1fe28af3
...
...
@@ -25,6 +25,8 @@ import org.springframework.cloud.netflix.zuul.filters.RouteLocator;
import
org.springframework.util.PatternMatchUtils
;
import
org.springframework.web.servlet.handler.AbstractUrlHandlerMapping
;
import
com.netflix.zuul.context.RequestContext
;
/**
* MVC HandlerMapping that maps incoming request paths to remote services.
*
...
...
@@ -60,6 +62,10 @@ public class ZuulHandlerMapping extends AbstractUrlHandlerMapping {
if
(
PatternMatchUtils
.
simpleMatch
(
ignored
,
urlPath
))
{
return
null
;
}
RequestContext
ctx
=
RequestContext
.
getCurrentContext
();
if
(
ctx
.
containsKey
(
"forward.to"
))
{
return
null
;
}
return
super
.
lookupHandler
(
urlPath
,
request
);
}
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/post/SendForwardFilterTests.java
View file @
1fe28af3
...
...
@@ -23,6 +23,7 @@ import javax.servlet.http.HttpServletRequest;
import
org.junit.After
;
import
org.junit.Test
;
import
org.springframework.cloud.netflix.zuul.filters.route.SendForwardFilter
;
import
org.springframework.mock.web.MockHttpServletRequest
;
import
org.springframework.mock.web.MockHttpServletResponse
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment