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
c3114e65
Unverified
Commit
c3114e65
authored
Aug 10, 2017
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.3.x'
parents
e4e29e13
c2aa60f2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
1 deletion
+57
-1
SendResponseFilter.java
...k/cloud/netflix/zuul/filters/post/SendResponseFilter.java
+6
-1
RibbonRoutingFilter.java
...cloud/netflix/zuul/filters/route/RibbonRoutingFilter.java
+5
-0
SendResponseFilterTests.java
...ud/netflix/zuul/filters/post/SendResponseFilterTests.java
+6
-0
RibbonRoutingFilterTests.java
.../netflix/zuul/filters/route/RibbonRoutingFilterTests.java
+40
-0
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/post/SendResponseFilter.java
View file @
c3114e65
...
...
@@ -73,12 +73,17 @@ public class SendResponseFilter extends ZuulFilter {
super
();
// To support Servlet API 3.1 we need to check if setContentLengthLong exists
try
{
HttpServletResponse
.
class
.
getMethod
(
"setContentLengthLong"
);
//TODO: remove in 2.0
HttpServletResponse
.
class
.
getMethod
(
"setContentLengthLong"
,
long
.
class
);
}
catch
(
NoSuchMethodException
e
)
{
useServlet31
=
false
;
}
}
/* for testing */
boolean
isUseServlet31
()
{
return
useServlet31
;
}
private
ThreadLocal
<
byte
[]>
buffers
=
new
ThreadLocal
<
byte
[]>()
{
@Override
protected
byte
[]
initialValue
()
{
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RibbonRoutingFilter.java
View file @
c3114e65
...
...
@@ -70,6 +70,7 @@ public class RibbonRoutingFilter extends ZuulFilter {
this
.
requestCustomizers
=
requestCustomizers
;
// To support Servlet API 3.1 we need to check if getContentLengthLong exists
try
{
//TODO: remove in 2.0
HttpServletRequest
.
class
.
getMethod
(
"getContentLengthLong"
);
}
catch
(
NoSuchMethodException
e
)
{
useServlet31
=
false
;
...
...
@@ -80,6 +81,10 @@ public class RibbonRoutingFilter extends ZuulFilter {
this
(
new
ProxyRequestHelper
(),
ribbonCommandFactory
,
null
);
}
/* for testing */
boolean
isUseServlet31
()
{
return
useServlet31
;
}
@Override
public
String
filterType
()
{
return
ROUTE_TYPE
;
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/post/SendResponseFilterTests.java
View file @
c3114e65
...
...
@@ -39,6 +39,7 @@ import com.netflix.zuul.constants.ZuulConstants;
import
com.netflix.zuul.context.Debug
;
import
com.netflix.zuul.context.RequestContext
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
hamcrest
.
Matchers
.
equalTo
;
import
static
org
.
junit
.
Assert
.
assertThat
;
...
...
@@ -75,6 +76,11 @@ public class SendResponseFilterTests {
}
@Test
public
void
useServlet31Works
()
{
assertThat
(
new
SendResponseFilter
().
isUseServlet31
()).
isTrue
();
}
@Test
public
void
characterEncodingNotOverridden
()
throws
Exception
{
String
characterEncoding
=
"UTF-16"
;
String
content
=
"\u00a5"
;
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/route/RibbonRoutingFilterTests.java
0 → 100644
View file @
c3114e65
/*
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
springframework
.
cloud
.
netflix
.
zuul
.
filters
.
route
;
import
java.util.Collections
;
import
org.junit.Test
;
import
org.springframework.cloud.netflix.ribbon.support.RibbonRequestCustomizer
;
import
org.springframework.cloud.netflix.zuul.filters.ProxyRequestHelper
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
Mockito
.
mock
;
/**
* @author Spencer Gibb
*/
public
class
RibbonRoutingFilterTests
{
@Test
public
void
useServlet31Works
()
{
RibbonCommandFactory
factory
=
mock
(
RibbonCommandFactory
.
class
);
RibbonRoutingFilter
filter
=
new
RibbonRoutingFilter
(
new
ProxyRequestHelper
(),
factory
,
Collections
.<
RibbonRequestCustomizer
>
emptyList
());
assertThat
(
filter
.
isUseServlet31
()).
isTrue
();
}
}
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