Skip to content

Commit aa91bb4

Browse files
committed
Reduce diff
1 parent 093aa8e commit aa91bb4

2 files changed

Lines changed: 25 additions & 10 deletions

File tree

  • datamodel/openapi/openapi-core-apache

datamodel/openapi/openapi-core-apache/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@
6565
<groupId>com.google.guava</groupId>
6666
<artifactId>guava</artifactId>
6767
</dependency>
68+
<dependency>
69+
<groupId>org.slf4j</groupId>
70+
<artifactId>slf4j-api</artifactId>
71+
</dependency>
6872
<!-- scope "provided" -->
6973
<dependency>
7074
<groupId>org.projectlombok</groupId>

datamodel/openapi/openapi-core-apache/src/main/java/com/sap/cloud/sdk/services/openapi/apache/apiclient/ApiClient.java

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/*
2-
* Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved.
3-
*/
4-
51
package com.sap.cloud.sdk.services.openapi.apache.apiclient;
62

73
import static com.sap.cloud.sdk.services.openapi.apache.apiclient.DefaultApiResponseHandler.isJsonMime;
@@ -28,9 +24,6 @@
2824
import javax.annotation.Nonnull;
2925
import javax.annotation.Nullable;
3026

31-
import com.fasterxml.jackson.core.JsonProcessingException;
32-
import lombok.extern.slf4j.Slf4j;
33-
import lombok.val;
3427
import org.apache.hc.client5.http.classic.HttpClient;
3528
import org.apache.hc.client5.http.entity.UrlEncodedFormEntity;
3629
import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;
@@ -45,9 +38,11 @@
4538
import org.apache.hc.core5.http.io.entity.FileEntity;
4639
import org.apache.hc.core5.http.io.entity.StringEntity;
4740
import org.apache.hc.core5.http.io.support.ClassicRequestBuilder;
41+
import org.apache.hc.core5.http.message.BasicNameValuePair;
4842

4943
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
5044
import com.fasterxml.jackson.annotation.PropertyAccessor;
45+
import com.fasterxml.jackson.core.JsonProcessingException;
5146
import com.fasterxml.jackson.core.type.TypeReference;
5247
import com.fasterxml.jackson.databind.DeserializationFeature;
5348
import com.fasterxml.jackson.databind.MapperFeature;
@@ -66,7 +61,8 @@
6661
import lombok.Getter;
6762
import lombok.ToString;
6863
import lombok.With;
69-
import org.apache.hc.core5.http.message.BasicNameValuePair;
64+
import lombok.extern.slf4j.Slf4j;
65+
import lombok.val;
7066

7167
/**
7268
* API client for executing HTTP requests using Apache HttpClient 5.
@@ -373,7 +369,7 @@ public static String escapeString( @Nonnull final String str )
373369
* Parse content type object from header value
374370
*/
375371
@Nonnull
376-
private static ContentType getContentType( @Nonnull final String headerValue )
372+
private ContentType getContentType( @Nonnull final String headerValue )
377373
throws OpenApiRequestException
378374
{
379375
try {
@@ -398,7 +394,7 @@ private static ContentType getContentType( @Nonnull final String headerValue )
398394
* @return The full URL
399395
*/
400396
@Nonnull
401-
private static String buildUrl(
397+
private String buildUrl(
402398
@Nonnull final String basePath,
403399
@Nonnull final String path,
404400
@Nullable final List<Pair> queryParams,
@@ -594,6 +590,21 @@ private ClassicRequestBuilder buildClassicRequest(
594590
return builder;
595591
}
596592

593+
/**
594+
* Serialize the given Java object into string according the given Content-Type (only JSON is supported for now).
595+
*
596+
* @param body
597+
* Object
598+
* @param contentType
599+
* Content type
600+
* @param formParams
601+
* Form parameters
602+
* @param headerParams
603+
* Header parameters, used to check content encoding for JSON serialization
604+
* @return Object
605+
* @throws OpenApiRequestException
606+
* API exception
607+
*/
597608
@Nonnull
598609
private HttpEntity serialize(
599610
@Nullable final Object body,

0 commit comments

Comments
 (0)