|
|
|
|
@ -21,6 +21,7 @@ import java.lang.annotation.ElementType;
@@ -21,6 +21,7 @@ import java.lang.annotation.ElementType;
|
|
|
|
|
import java.lang.annotation.Retention; |
|
|
|
|
import java.lang.annotation.RetentionPolicy; |
|
|
|
|
import java.lang.annotation.Target; |
|
|
|
|
import java.sql.Savepoint; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Optional; |
|
|
|
|
@ -378,14 +379,6 @@ public class MvcUriComponentsBuilderTests {
@@ -378,14 +379,6 @@ public class MvcUriComponentsBuilderTests {
|
|
|
|
|
assertThat(uriComponents.encode().toUri().toString()).isEqualTo("http://localhost/hotels/42/bookings/21"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test // SPR-16710
|
|
|
|
|
public void fromMethodCallWithCharSequenceReturnType() { |
|
|
|
|
UriComponents uriComponents = fromMethodCall( |
|
|
|
|
on(BookingControllerWithCharSequence.class).getBooking(21L)).buildAndExpand(42); |
|
|
|
|
|
|
|
|
|
assertThat(uriComponents.encode().toUri().toString()).isEqualTo("http://localhost/hotels/42/bookings/21"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test // SPR-16710
|
|
|
|
|
public void fromMethodCallWithStringReturnType() { |
|
|
|
|
assertThatIllegalStateException().isThrownBy(() -> { |
|
|
|
|
@ -403,6 +396,22 @@ public class MvcUriComponentsBuilderTests {
@@ -403,6 +396,22 @@ public class MvcUriComponentsBuilderTests {
|
|
|
|
|
assertThat(uriComponents.encode().toUri().toString()).isEqualTo("http://localhost/hotels/42/bookings/21"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test // gh-30210
|
|
|
|
|
public void fromMethodCallWithCharSequenceReturnType() { |
|
|
|
|
UriComponents uriComponents = fromMethodCall( |
|
|
|
|
on(BookingControllerWithCharSequence.class).getBooking(21L)).buildAndExpand(42); |
|
|
|
|
|
|
|
|
|
assertThat(uriComponents.encode().toUri().toString()).isEqualTo("http://localhost/hotels/42/bookings/21"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test // gh-30210
|
|
|
|
|
public void fromMethodCallWithJdbc30115ReturnType() { |
|
|
|
|
UriComponents uriComponents = fromMethodCall( |
|
|
|
|
on(BookingControllerWithJdbcSavepoint.class).getBooking(21L)).buildAndExpand(42); |
|
|
|
|
|
|
|
|
|
assertThat(uriComponents.encode().toUri().toString()).isEqualTo("http://localhost/hotels/42/bookings/21"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void fromMappingNamePlain() { |
|
|
|
|
initWebApplicationContext(WebConfig.class); |
|
|
|
|
@ -693,6 +702,17 @@ public class MvcUriComponentsBuilderTests {
@@ -693,6 +702,17 @@ public class MvcUriComponentsBuilderTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
|
@RequestMapping("/hotels/{hotel}") |
|
|
|
|
static class BookingControllerWithString { |
|
|
|
|
|
|
|
|
|
@GetMapping("/bookings/{booking}") |
|
|
|
|
public String getBooking(@PathVariable Long booking) { |
|
|
|
|
return "url"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
|
@RequestMapping("/hotels/{hotel}") |
|
|
|
|
static class BookingControllerWithCharSequence { |
|
|
|
|
@ -706,11 +726,11 @@ public class MvcUriComponentsBuilderTests {
@@ -706,11 +726,11 @@ public class MvcUriComponentsBuilderTests {
|
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
|
@RequestMapping("/hotels/{hotel}") |
|
|
|
|
static class BookingControllerWithString { |
|
|
|
|
static class BookingControllerWithJdbcSavepoint { |
|
|
|
|
|
|
|
|
|
@GetMapping("/bookings/{booking}") |
|
|
|
|
public String getBooking(@PathVariable Long booking) { |
|
|
|
|
return "url"; |
|
|
|
|
public Savepoint getBooking(@PathVariable Long booking) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|