Skip to content
Open
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
6 changes: 6 additions & 0 deletions datamodel/odata-v4/odata-v4-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.codemodel</groupId>
Expand Down
6 changes: 6 additions & 0 deletions datamodel/odata/odata-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.codemodel</groupId>
Expand Down
12 changes: 12 additions & 0 deletions datamodel/openapi/openapi-api-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,22 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- test dependencies -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ void testDeserializationWithEnumDiscriminator()
* Taken from {@link com.sap.cloud.sdk.services.openapi.apiclient.ApiClient}
*/
@Nonnull
@SuppressWarnings( "removal" ) // Jackson2ObjectMapperBuilder deprecated-for-removal in Spring 7; requires Jackson 3 migration
private static ObjectMapper newDefaultObjectMapper()
{
return new Jackson2ObjectMapperBuilder()
Expand Down
12 changes: 12 additions & 0 deletions datamodel/openapi/openapi-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,22 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private String collectionToString( final Collection<? extends CharSequence> coll
private Map<String, Authentication> authentications;

private int statusCode;
private MultiValueMap<String, String> responseHeaders;
private HttpHeaders responseHeaders;

private DateFormat dateFormat;

Expand Down Expand Up @@ -204,10 +204,10 @@ public int getStatusCode()
/**
* Gets the response headers of the previous request
*
* @return MultiValueMap a map of response headers
* @return HttpHeaders a map of response headers
*/
@Nonnull
public MultiValueMap<String, String> getResponseHeaders()
public HttpHeaders getResponseHeaders()
{
return responseHeaders;
}
Expand Down Expand Up @@ -688,8 +688,7 @@ public <T> T invokeAPI(
// auth headers are added automatically by the SDK
// updateParamsForAuth(authNames, queryParams, headerParams);

@SuppressWarnings( "deprecation" ) // spring-web:6.2.0 and later, works until <7.0.0
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(path);
final UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(basePath).path(path);
if( queryParams != null ) {
//encode the query parameters in case they contain unsafe characters
for( final List<String> values : queryParams.values() ) {
Expand Down Expand Up @@ -748,7 +747,7 @@ public <T> T invokeAPI(
private void addHeadersToRequest( @Nullable final HttpHeaders headers, final BodyBuilder requestBuilder )
{
if( headers != null ) {
for( final Entry<String, List<String>> entry : headers.entrySet() ) {
for( final Entry<String, List<String>> entry : headers.headerSet() ) {
final List<String> values = entry.getValue();
for( final String value : values ) {
if( value != null ) {
Expand All @@ -760,6 +759,7 @@ private void addHeadersToRequest( @Nullable final HttpHeaders headers, final Bod
}

@Nonnull
@SuppressWarnings( "removal" ) // MappingJackson2HttpMessageConverter and Jackson2ObjectMapperBuilder deprecated-for-removal in Spring 7; requires Jackson 3 migration
private static RestTemplate newDefaultRestTemplate()
{
final RestTemplate restTemplate = new RestTemplate();
Expand All @@ -776,6 +776,7 @@ private static RestTemplate newDefaultRestTemplate()
}

@Nonnull
@SuppressWarnings( "removal" ) // Jackson2ObjectMapperBuilder deprecated-for-removal in Spring 7; requires Jackson 3 migration
private static ObjectMapper newDefaultObjectMapper()
{
return new Jackson2ObjectMapperBuilder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.sap.cloud.sdk.services.openapi.core;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Nonnull;

import org.springframework.http.HttpHeaders;
import org.springframework.util.MultiValueMap;

import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient;

Expand All @@ -20,12 +23,8 @@ public class OpenApiResponse
@Getter
private final int statusCode;

/**
* Http headers of this response.
*/
@Nonnull
@Getter
private final MultiValueMap<String, String> headers;
private final HttpHeaders headers;

/**
* Create a new {@code OpenApiResponse} from an {@link ApiClient}
Expand All @@ -50,4 +49,19 @@ public OpenApiResponse( final int statusCode )
this.statusCode = statusCode;
headers = new HttpHeaders();
}

/**
* Http headers of this response.
*
* @return Map of response headers
*/
@Nonnull
public Map<String, List<String>> getHeaders()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid breaking change

{
final Map<String, List<String>> result = new LinkedHashMap<>();
for( final Map.Entry<String, List<String>> entry : headers.headerSet() ) {
result.put(entry.getKey(), entry.getValue());
}
return result;
}
}
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@
<!-- Spring dependencies -->
<!-- Keep these versions consistent with the ones from the SAP Java Buildpack (after their 2.0 release) -->
<!-- see https://github.wdf.sap.corp/xs2-java/xs-java-buildpack/blob/master/resources/pom.xml -->
<spring.version>6.2.19</spring.version>
<spring-security.version>6.1.5</spring-security.version>
<spring.version>7.0.9</spring.version>
<spring-security.version>7.0.1</spring-security.version>
<slf4j.version>2.0.19</slf4j.version>
<assertj-core.version>3.27.7</assertj-core.version>
<assertj-vavr.version>0.5.1</assertj-vavr.version>
Expand Down
Loading