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
76d0c018
Commit
76d0c018
authored
Mar 20, 2015
by
unknown
Committed by
Dave Syer
Mar 24, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure ZuulProperties.servletPath is applied to routes
Fixes gh-271, fixes gh-272
parent
e60a0fc4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
ProxyRouteLocator.java
...amework/cloud/netflix/zuul/filters/ProxyRouteLocator.java
+12
-1
FormZuulServletProxyApplicationTests.java
...ud/netflix/zuul/FormZuulServletProxyApplicationTests.java
+1
-1
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/ProxyRouteLocator.java
View file @
76d0c018
...
...
@@ -56,7 +56,13 @@ public class ProxyRouteLocator implements RouteLocator {
public
ProxyRouteLocator
(
String
servletPath
,
DiscoveryClient
discovery
,
ZuulProperties
properties
)
{
this
.
servletPath
=
servletPath
;
if
(
StringUtils
.
hasText
(
servletPath
))
{
// a servletPath is passed explicitly
this
.
servletPath
=
servletPath
;
}
else
{
//set Zuul servlet path
this
.
servletPath
=
properties
.
getServletPath
()
!=
null
?
properties
.
getServletPath
()
:
""
;
}
this
.
discovery
=
discovery
;
this
.
properties
=
properties
;
}
...
...
@@ -89,17 +95,22 @@ public class ProxyRouteLocator implements RouteLocator {
}
public
ProxyRouteSpec
getMatchingRoute
(
String
path
)
{
log
.
info
(
"Finding route for path: "
+
path
);
String
location
=
null
;
String
targetPath
=
null
;
String
id
=
null
;
String
prefix
=
this
.
properties
.
getPrefix
();
log
.
debug
(
"servletPath="
+
this
.
servletPath
);
if
(
StringUtils
.
hasText
(
this
.
servletPath
)
&&
!
this
.
servletPath
.
equals
(
"/"
)
&&
path
.
startsWith
(
this
.
servletPath
))
{
path
=
path
.
substring
(
this
.
servletPath
.
length
());
}
log
.
debug
(
"path="
+
path
);
Boolean
retryable
=
this
.
properties
.
getRetryable
();
for
(
Entry
<
String
,
ZuulRoute
>
entry
:
this
.
routes
.
get
().
entrySet
())
{
String
pattern
=
entry
.
getKey
();
log
.
debug
(
"Matching pattern:"
+
pattern
);
if
(
this
.
pathMatcher
.
match
(
pattern
,
path
))
{
ZuulRoute
route
=
entry
.
getValue
();
id
=
route
.
getId
();
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/FormZuulServletProxyApplicationTests.java
View file @
76d0c018
...
...
@@ -65,7 +65,7 @@ import static org.junit.Assert.assertEquals;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringApplicationConfiguration
(
classes
=
FormZuulServletProxyApplication
.
class
)
@WebAppConfiguration
@IntegrationTest
({
"server.port:0"
,
"zuul.routes.simple:/
zuul/
simple/**"
})
@IntegrationTest
({
"server.port:0"
,
"zuul.routes.simple:/simple/**"
})
@DirtiesContext
public
class
FormZuulServletProxyApplicationTests
{
...
...
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