Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
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
DEMO
spring-boot
Commits
13791cad
Commit
13791cad
authored
Feb 09, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use DefaultUriBuilderFactory instead of DefaultUriTemplateHandler
Closes gh-8247
parent
16b7bf7f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
13 deletions
+14
-13
LocalHostUriTemplateHandler.java
...ork/boot/test/web/client/LocalHostUriTemplateHandler.java
+5
-4
TestRestTemplate.java
...pringframework/boot/test/web/client/TestRestTemplate.java
+2
-2
TestRestTemplateTests.java
...framework/boot/test/web/client/TestRestTemplateTests.java
+4
-4
RootUriTemplateHandler.java
...ringframework/boot/web/client/RootUriTemplateHandler.java
+3
-3
No files found.
spring-boot-test/src/main/java/org/springframework/boot/test/web/client/LocalHostUriTemplateHandler.java
View file @
13791cad
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -20,7 +20,7 @@ import org.springframework.boot.bind.RelaxedPropertyResolver;
...
@@ -20,7 +20,7 @@ import org.springframework.boot.bind.RelaxedPropertyResolver;
import
org.springframework.boot.web.client.RootUriTemplateHandler
;
import
org.springframework.boot.web.client.RootUriTemplateHandler
;
import
org.springframework.core.env.Environment
;
import
org.springframework.core.env.Environment
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
import
org.springframework.web.util.DefaultUri
TemplateHandler
;
import
org.springframework.web.util.DefaultUri
BuilderFactory
;
import
org.springframework.web.util.UriTemplateHandler
;
import
org.springframework.web.util.UriTemplateHandler
;
/**
/**
...
@@ -58,12 +58,13 @@ public class LocalHostUriTemplateHandler extends RootUriTemplateHandler {
...
@@ -58,12 +58,13 @@ public class LocalHostUriTemplateHandler extends RootUriTemplateHandler {
* @since 1.4.1
* @since 1.4.1
*/
*/
public
LocalHostUriTemplateHandler
(
Environment
environment
,
String
scheme
)
{
public
LocalHostUriTemplateHandler
(
Environment
environment
,
String
scheme
)
{
super
(
new
DefaultUri
TemplateHandler
());
super
(
new
DefaultUri
BuilderFactory
());
Assert
.
notNull
(
environment
,
"Environment must not be null"
);
Assert
.
notNull
(
environment
,
"Environment must not be null"
);
Assert
.
notNull
(
scheme
,
"Scheme must not be null"
);
Assert
.
notNull
(
scheme
,
"Scheme must not be null"
);
this
.
environment
=
environment
;
this
.
environment
=
environment
;
this
.
scheme
=
scheme
;
this
.
scheme
=
scheme
;
this
.
servletPropertyResolver
=
new
RelaxedPropertyResolver
(
environment
,
"server.servlet."
);
this
.
servletPropertyResolver
=
new
RelaxedPropertyResolver
(
environment
,
"server.servlet."
);
}
}
@Override
@Override
...
...
spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplate.java
View file @
13791cad
...
@@ -57,7 +57,7 @@ import org.springframework.web.client.RequestCallback;
...
@@ -57,7 +57,7 @@ import org.springframework.web.client.RequestCallback;
import
org.springframework.web.client.ResponseExtractor
;
import
org.springframework.web.client.ResponseExtractor
;
import
org.springframework.web.client.RestClientException
;
import
org.springframework.web.client.RestClientException
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.util.DefaultUri
TemplateHandler
;
import
org.springframework.web.util.DefaultUri
BuilderFactory
;
import
org.springframework.web.util.UriTemplateHandler
;
import
org.springframework.web.util.UriTemplateHandler
;
/**
/**
...
@@ -161,7 +161,7 @@ public class TestRestTemplate {
...
@@ -161,7 +161,7 @@ public class TestRestTemplate {
/**
/**
* Configure the {@link UriTemplateHandler} to use to expand URI templates. By default
* Configure the {@link UriTemplateHandler} to use to expand URI templates. By default
* the {@link DefaultUri
TemplateHandler
} is used which relies on Spring's URI template
* the {@link DefaultUri
BuilderFactory
} is used which relies on Spring's URI template
* support and exposes several useful properties that customize its behavior for
* support and exposes several useful properties that customize its behavior for
* encoding and for prepending a common base URL. An alternative implementation may be
* encoding and for prepending a common base URL. An alternative implementation may be
* used to plug an external URI template library.
* used to plug an external URI template library.
...
...
spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java
View file @
13791cad
...
@@ -47,12 +47,12 @@ import org.springframework.util.ReflectionUtils.MethodCallback;
...
@@ -47,12 +47,12 @@ import org.springframework.util.ReflectionUtils.MethodCallback;
import
org.springframework.web.client.ResponseErrorHandler
;
import
org.springframework.web.client.ResponseErrorHandler
;
import
org.springframework.web.client.RestOperations
;
import
org.springframework.web.client.RestOperations
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.util.DefaultUri
TemplateHandler
;
import
org.springframework.web.util.DefaultUri
BuilderFactory
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
ArgumentMatchers
.
eq
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Matchers
.
any
;
import
static
org
.
mockito
.
Matchers
.
eq
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
...
@@ -102,7 +102,7 @@ public class TestRestTemplateTests {
...
@@ -102,7 +102,7 @@ public class TestRestTemplateTests {
public
void
restOperationsAreAvailable
()
throws
Exception
{
public
void
restOperationsAreAvailable
()
throws
Exception
{
RestTemplate
delegate
=
mock
(
RestTemplate
.
class
);
RestTemplate
delegate
=
mock
(
RestTemplate
.
class
);
given
(
delegate
.
getUriTemplateHandler
())
given
(
delegate
.
getUriTemplateHandler
())
.
willReturn
(
new
DefaultUri
TemplateHandler
());
.
willReturn
(
new
DefaultUri
BuilderFactory
());
final
TestRestTemplate
restTemplate
=
new
TestRestTemplate
(
delegate
);
final
TestRestTemplate
restTemplate
=
new
TestRestTemplate
(
delegate
);
ReflectionUtils
.
doWithMethods
(
RestOperations
.
class
,
new
MethodCallback
()
{
ReflectionUtils
.
doWithMethods
(
RestOperations
.
class
,
new
MethodCallback
()
{
...
...
spring-boot/src/main/java/org/springframework/boot/web/client/RootUriTemplateHandler.java
View file @
13791cad
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -22,7 +22,7 @@ import java.util.Map;
...
@@ -22,7 +22,7 @@ import java.util.Map;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.util.DefaultUri
TemplateHandler
;
import
org.springframework.web.util.DefaultUri
BuilderFactory
;
import
org.springframework.web.util.UriTemplateHandler
;
import
org.springframework.web.util.UriTemplateHandler
;
/**
/**
...
@@ -47,7 +47,7 @@ public class RootUriTemplateHandler implements UriTemplateHandler {
...
@@ -47,7 +47,7 @@ public class RootUriTemplateHandler implements UriTemplateHandler {
* @param rootUri the root URI to be used to prefix relative URLs
* @param rootUri the root URI to be used to prefix relative URLs
*/
*/
public
RootUriTemplateHandler
(
String
rootUri
)
{
public
RootUriTemplateHandler
(
String
rootUri
)
{
this
(
rootUri
,
new
DefaultUri
TemplateHandler
());
this
(
rootUri
,
new
DefaultUri
BuilderFactory
());
}
}
/**
/**
...
...
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