Enables on-premise connectivity via Cloud Connector in SAP Cloud SDK Java apps. Replaces Neo manual proxy config (HC_OP_HTTP_PROXY_*, ProxyType=OnPremise) with automatic handling.
npx claudepluginhub sap-samples/btp-neo-java-app-migration --plugin sap-btp-neo-migrationThis skill is limited to using the following tools:
Enable connectivity to on-premise systems via Cloud Connector.
Guides Next.js Cache Components and Partial Prerendering (PPR): 'use cache' directives, cacheLife(), cacheTag(), revalidateTag() for caching, invalidation, static/dynamic optimization. Auto-activates on cacheComponents: true.
Processes PDFs: extracts text/tables/images, merges/splits/rotates pages, adds watermarks, creates/fills forms, encrypts/decrypts, OCRs scans. Activates on PDF mentions or output requests.
Share bugs, ideas, or general feedback.
Enable connectivity to on-premise systems via Cloud Connector.
Replace Neo's manual proxy configuration (HC_OP_HTTP_PROXY_* environment variables) with SAP Cloud SDK's automatic handling of on-premise connectivity through Cloud Connector.
This skill applies if any of these patterns are found:
// Manual proxy configuration
String proxyHost = System.getenv("HC_OP_HTTP_PROXY_HOST");
String proxyPort = System.getenv("HC_OP_HTTP_PROXY_PORT");
// OnPremise proxy type handling
if ("OnPremise".equals(proxyType)) {
// Configure proxy...
}
// Consumer account header
urlConnection.setRequestProperty("SAP-Connectivity-ConsumerAccount", accountId);
ProxyType=OnPremise
Working directory: This skill must run inside the
-cf-migrationcopy of your app, created byjakarta-java25-migrationorneo-to-cf-migration-orchestrator. If your current directory does not end in-cf-migration, switch to it before proceeding.
Before invoking this skill, ensure you have invoked:
sdk-replacement - Use the sdk-replacement skill
destinations - Use the destinations skill
Also required:
If present, remove the AuthenticationHeaderProvider resource reference:
<resource-ref>
<res-ref-name>authenticationHeaderProvider</res-ref-name>
<res-type>com.sap.core.connectivity.api.authentication.AuthenticationHeaderProvider</res-type>
</resource-ref>
Note: The SAP Cloud SDK handles authentication headers automatically for on-premise connections.
The SAP Cloud SDK handles all proxy configuration automatically when ProxyType=OnPremise is detected in the destination.
Before (Neo) - REMOVE ALL THIS CODE:
private Proxy getProxy(String proxyType) {
Proxy proxy = Proxy.NO_PROXY;
String proxyHost = null;
String proxyPort = null;
if (ON_PREMISE_PROXY.equals(proxyType)) {
// Get proxy for on-premise destinations
proxyHost = System.getenv("HC_OP_HTTP_PROXY_HOST");
proxyPort = System.getenv("HC_OP_HTTP_PROXY_PORT");
} else {
proxyHost = System.getProperty("https.proxyHost");
proxyPort = System.getProperty("https.proxyPort");
}
if (proxyPort != null && proxyHost != null) {
int proxyPortNumber = Integer.parseInt(proxyPort);
proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPortNumber));
}
return proxy;
}
private void injectHeader(HttpURLConnection urlConnection, String proxyType) {
if (ON_PREMISE_PROXY.equals(proxyType)) {
urlConnection.setRequestProperty("SAP-Connectivity-ConsumerAccount",
tenantContext.getTenant().getAccount().getId());
}
}
After (Cloud Foundry) - Simple and automatic:
import com.sap.cloud.sdk.cloudplatform.connectivity.DestinationAccessor;
import com.sap.cloud.sdk.cloudplatform.connectivity.HttpDestination;
import org.apache.http.client.HttpClient;
import static com.sap.cloud.sdk.cloudplatform.connectivity.HttpClientAccessor.getHttpClient;
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String destinationName = request.getParameter("destname");
if (destinationName == null) {
destinationName = "on-premise-destination";
}
try {
// SAP Cloud SDK handles all proxy configuration automatically!
HttpDestination destination = DestinationAccessor.getDestination(destinationName).asHttp();
// Get HTTP client - SDK automatically:
// - Configures proxy for on-premise destinations
// - Adds required headers (SAP-Connectivity-ConsumerAccount, etc.)
// - Handles Cloud Connector integration
HttpClient httpClient = getHttpClient(destination);
HttpGet httpGet = new HttpGet(destination.getUri());
HttpResponse destinationResponse = httpClient.execute(httpGet);
int statusCode = destinationResponse.getStatusLine().getStatusCode();
if (statusCode != HttpServletResponse.SC_OK) {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Destination returned: " + statusCode);
return;
}
destinationResponse.getEntity().writeTo(response.getOutputStream());
} catch (Exception e) {
throw new ServletException("Connectivity failed: " + e.getMessage(), e);
}
}
Remove from web.xml:
<!-- REMOVE -->
<resource-ref>
<res-ref-name>connectivityConfiguration</res-ref-name>
<res-type>com.sap.core.connectivity.api.configuration.ConnectivityConfiguration</res-type>
</resource-ref>
<!-- REMOVE if present -->
<resource-ref>
<res-ref-name>TenantContext</res-ref-name>
<res-type>com.sap.cloud.account.TenantContext</res-type>
</resource-ref>
Add both destination and connectivity services to mtad.yaml:
modules:
- name: ${app-name}
type: java.tomcat
path: target/${app-name}.war
parameters:
buildpack: sap_java_buildpack_jakarta
disk-quota: 512MB
memory: 512MB
properties:
ENABLE_SECURITY_JAVA_API_V2: true
SET_LOGGING_LEVEL: 'ROOT: INFO'
requires:
- name: ${app-name}-destination
- name: ${app-name}-connectivity
resources:
- name: ${app-name}-destination
type: org.cloudfoundry.managed-service
parameters:
service: destination
service-plan: lite
- name: ${app-name}-connectivity
type: org.cloudfoundry.managed-service
parameters:
service: connectivity
service-plan: lite
In Cloud Connector Administration:
Add Subaccount
Add Virtual Host Mapping
your-onprem-server.local8080onprem-virtual8080Add Resources
/ (or specific paths)In BTP Cockpit, create destination:
| Property | Value |
|---|---|
| Name | on-premise-destination |
| Type | HTTP |
| URL | http://onprem-virtual:8080 |
| Proxy Type | OnPremise |
| Authentication | NoAuthentication (or as needed) |
| Location ID | (Optional) Cloud Connector location ID |
For destinations with Location ID:
{
"Name": "on-premise-destination",
"Type": "HTTP",
"URL": "http://onprem-virtual:8080",
"ProxyType": "OnPremise",
"Authentication": "NoAuthentication",
"CloudConnectorLocationId": "my-location-id"
}
import com.sap.cloud.sdk.cloudplatform.connectivity.ProxyType;
HttpDestination destination = DestinationAccessor.getDestination(name).asHttp();
// Check if on-premise
if (destination.getProxyType() == ProxyType.ON_PREMISE) {
// On-premise handling (SDK handles proxy automatically)
logger.info("Using on-premise connectivity");
}
No new configuration files in the application. Cloud Connector and destinations are configured externally.
| Service | Plan | Purpose |
|---|---|---|
destination | lite | Destination configuration |
connectivity | lite | On-premise connectivity proxy |
mvn clean compile
In Cloud Connector Administration:
# Deploy application
cf deploy . -f
# Test on-premise destination
curl "https://${app-url}/connectivity?destname=on-premise-destination"
cf logs ${app-name} --recent | grep -i "connectivity\|proxy"
Cause: Cloud Connector not connected or misconfigured. Solution:
Cause: Cloud Connector resource access policy. Solution: Add the path to allowed resources in Cloud Connector.
Cause: Network issue or Cloud Connector firewall. Solution:
Cause: Connectivity service not bound to application.
Solution: Verify ${app-name}-connectivity is in requires section of mtad.yaml.
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ CF Application │────▶│ Connectivity │────▶│ Cloud Connector │
│ (Your App) │ │ Service Proxy │ │ (On-Premise) │
└─────────────────┘ └──────────────────┘ └────────┬────────┘
│
▼
┌─────────────────┐
│ On-Premise │
│ Backend System │
└─────────────────┘
The SAP Cloud SDK automatically:
ProxyType=OnPremiseSAP-Connectivity-ConsumerAccount)After completing this skill, proceed to: