Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.springframework.util.Assert;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.reactive.function.client.WebClient.Builder;
import org.springframework.web.util.DefaultUriBuilderFactory;

/**
* Default {@link WebClientProvider} that uses cached {@link WebClient} instances per {@code hostAndPort}.
Expand Down Expand Up @@ -155,8 +156,13 @@ protected WebClient createWebClientForSocketAddress(InetSocketAddress socketAddr

String baseUrl = String.format("%s://%s:%d%s", this.scheme, socketAddress.getHostString(), socketAddress.getPort(),
pathPrefix == null ? "" : '/' + pathPrefix);

DefaultUriBuilderFactory uriBuilderFactory = new DefaultUriBuilderFactory(baseUrl);
// the template will already be encoded by the RequestConverters methods
uriBuilderFactory.setEncodingMode(DefaultUriBuilderFactory.EncodingMode.VALUES_ONLY);
builder.uriBuilderFactory(uriBuilderFactory); //

WebClient webClient = builder //
.baseUrl(baseUrl) //
.filter((request, next) -> next.exchange(request) //
.doOnError(errorListener)) //
.build(); //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import java.lang.Long;
import java.lang.Object;
import java.net.ConnectException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -1031,6 +1033,32 @@ void shouldReturnMonoOfSearchPage() {
assertThat(searchHits.getSearchHits().size()).isEqualTo(5);
}).verifyComplete();
}

@Test // #1665
@DisplayName("should be able to process date-math-index names")
void shouldBeAbleToProcessDateMathIndexNames() {

String indexName = "foo-" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy.MM"));
String dateMathIndexName = "<foo-{now/M{yyyy.MM}}>";

template.indexOps(IndexCoordinates.of(dateMathIndexName)) //
.create() //
.as(StepVerifier::create) //
.expectNext(true) //
.verifyComplete(); //

template.indexOps(IndexCoordinates.of(indexName)) //
.exists() //
.as(StepVerifier::create) //
.expectNext(true) //
.verifyComplete(); //

template.indexOps(IndexCoordinates.of(dateMathIndexName)) //
.delete() //
.as(StepVerifier::create) //
.expectNext(true) //
.verifyComplete(); //
}
// endregion

// region Helper functions
Expand Down Expand Up @@ -1128,5 +1156,6 @@ static class VersionedEntity {
@Id private String id;
@Version private Long version;
}

// endregion
}