@@ -37,6 +37,8 @@ public class TransparentProxyDestination implements HttpDestination
3737 static final String TENANT_SUBDOMAIN_HEADER_KEY = "x-tenant-subdomain" ;
3838 static final String TENANT_ID_HEADER_KEY = "x-tenant-id" ;
3939 static final String FRAGMENT_OPTIONAL_HEADER_KEY = "x-fragment-optional" ;
40+ static final String DESTINATION_LEVEL_HEADER_KEY = "x-destination-level" ;
41+ static final String FRAGMENT_LEVEL_HEADER_KEY = "x-fragment-level" ;
4042 static final String TOKEN_SERVICE_TENANT_HEADER_KEY = "x-token-service-tenant" ;
4143 static final String CLIENT_ASSERTION_HEADER_KEY = "x-client-assertion" ;
4244 static final String CLIENT_ASSERTION_TYPE_HEADER_KEY = "x-client-assertion-type" ;
@@ -52,7 +54,7 @@ public class TransparentProxyDestination implements HttpDestination
5254 static final String CHAIN_VAR_SUBJECT_TOKEN_TYPE_HEADER_KEY = "x-chain-var-subjectTokenType" ;
5355 static final String CHAIN_VAR_SAML_PROVIDER_DESTINATION_NAME_HEADER_KEY = "x-chain-var-samlProviderDestinationName" ;
5456 static final String TENANT_ID_AND_TENANT_SUBDOMAIN_BOTH_PASSED_ERROR_MESSAGE =
55- "Tenant id and tenant subdomain cannot be passed at the same time." ;
57+ "Tenant id and tenant subdomain cannot be passed at the same time." ;
5658
5759 @ Delegate
5860 private final DestinationProperties baseProperties ;
@@ -68,23 +70,23 @@ public class TransparentProxyDestination implements HttpDestination
6870 private final ImmutableList <DestinationHeaderProvider > headerProvidersFromClassLoading ;
6971
7072 private TransparentProxyDestination (
71- @ Nonnull final DestinationProperties baseProperties ,
72- @ Nullable final List <Header > customHeaders ,
73- @ Nullable final List <DestinationHeaderProvider > customHeaderProviders )
73+ @ Nonnull final DestinationProperties baseProperties ,
74+ @ Nullable final List <Header > customHeaders ,
75+ @ Nullable final List <DestinationHeaderProvider > customHeaderProviders )
7476 {
7577 this .baseProperties = baseProperties ;
7678 this .customHeaders =
77- customHeaders != null ? ImmutableList .<Header > builder ().addAll (customHeaders ).build () : ImmutableList .of ();
79+ customHeaders != null ? ImmutableList .<Header > builder ().addAll (customHeaders ).build () : ImmutableList .of ();
7880
7981 final Collection <DestinationHeaderProvider > headerProvidersFromClassLoading =
80- FacadeLocator .getFacades (DestinationHeaderProvider .class );
82+ FacadeLocator .getFacades (DestinationHeaderProvider .class );
8183 this .headerProvidersFromClassLoading =
82- ImmutableList .<DestinationHeaderProvider > builder ().addAll (headerProvidersFromClassLoading ).build ();
84+ ImmutableList .<DestinationHeaderProvider > builder ().addAll (headerProvidersFromClassLoading ).build ();
8385
8486 this .customHeaderProviders =
85- customHeaderProviders != null
86- ? ImmutableList .<DestinationHeaderProvider > builder ().addAll (customHeaderProviders ).build ()
87- : ImmutableList .of ();
87+ customHeaderProviders != null
88+ ? ImmutableList .<DestinationHeaderProvider > builder ().addAll (customHeaderProviders ).build ()
89+ : ImmutableList .of ();
8890
8991 }
9092
@@ -103,18 +105,18 @@ public Collection<Header> getHeaders( @Nonnull final URI requestUri )
103105
104106 allHeaders .addAll (customHeaders );
105107 allHeaders
106- .addAll (
107- DefaultHttpDestination
108- .getHeadersFromHeaderProviders (
109- this ,
110- requestUri ,
111- customHeaderProviders ,
112- headerProvidersFromClassLoading ));
108+ .addAll (
109+ DefaultHttpDestination
110+ .getHeadersFromHeaderProviders (
111+ this ,
112+ requestUri ,
113+ customHeaderProviders ,
114+ headerProvidersFromClassLoading ));
113115
114116 // Automatically add tenant id if not already present
115117 TenantAccessor .tryGetCurrentTenant ().onSuccess (tenant -> {
116118 if ( !containsHeader (allHeaders , TENANT_ID_HEADER_KEY )
117- && !containsHeader (allHeaders , TENANT_SUBDOMAIN_HEADER_KEY ) ) {
119+ && !containsHeader (allHeaders , TENANT_SUBDOMAIN_HEADER_KEY ) ) {
118120 allHeaders .add (new Header (TENANT_ID_HEADER_KEY , tenant .getTenantId ()));
119121 }
120122 });
@@ -215,9 +217,9 @@ public boolean equals( @Nullable final Object o )
215217
216218 final TransparentProxyDestination that = (TransparentProxyDestination ) o ;
217219 return new EqualsBuilder ()
218- .append (baseProperties , that .baseProperties )
219- .append (customHeaders , that .customHeaders )
220- .isEquals ();
220+ .append (baseProperties , that .baseProperties )
221+ .append (customHeaders , that .customHeaders )
222+ .isEquals ();
221223 }
222224
223225 @ Override
@@ -646,7 +648,7 @@ private DynamicBuilder( @Nonnull final String destinationName, @Nonnull final St
646648 {
647649 if ( destinationName .isEmpty () ) {
648650 throw new IllegalArgumentException (
649- "The 'destinationName' property is required for dynamic destinations but was not set." );
651+ "The 'destinationName' property is required for dynamic destinations but was not set." );
650652 }
651653
652654 this .header (DESTINATION_NAME_HEADER_KEY , destinationName );
@@ -673,6 +675,34 @@ public DynamicBuilder fragmentName( @Nonnull final String fragmentName )
673675 return header (new Header (FRAGMENT_NAME_HEADER_KEY , fragmentName ));
674676 }
675677
678+ /**
679+ * Sets the destination level for the dynamic destination. See
680+ * https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations
681+ *
682+ * @param destinationLevel
683+ * The level of the destination to use.
684+ * @return This builder instance for method chaining.
685+ */
686+ @ Nonnull
687+ public DynamicBuilder destinationLevel ( @ Nonnull final String destinationLevel )
688+ {
689+ return header (new Header (DESTINATION_LEVEL_HEADER_KEY , destinationLevel ));
690+ }
691+
692+ /**
693+ * Sets the fragment level for the dynamic destination. See
694+ * https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations
695+ *
696+ * @param fragmentLevel
697+ * The level of the fragment to use.
698+ * @return This builder instance for method chaining.
699+ */
700+ @ Nonnull
701+ public DynamicBuilder fragmentLevel ( @ Nonnull final String fragmentLevel )
702+ {
703+ return header (new Header (FRAGMENT_LEVEL_HEADER_KEY , fragmentLevel ));
704+ }
705+
676706 /**
677707 * Sets the fragment optional flag for the dynamic destination. See
678708 * https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations
0 commit comments