diff options
Diffstat (limited to 'ecomp-sdk/epsdk-fw/src/main/java')
2 files changed, 26 insertions, 2 deletions
diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java b/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java index 1d4feb07..fa7a1478 100644 --- a/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java +++ b/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java @@ -183,8 +183,16 @@ public class RestWebServiceClient { // Create the connection object HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); + con.setConnectTimeout(3000); + // if the portal property is set then gets the timeout value from portal properties + if(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_CONNECTION_TIMEOUT)!= null){ + con.setConnectTimeout(Integer.parseInt(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_CONNECTION_TIMEOUT))); + } con.setReadTimeout(8000); + if(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_READ_TIMEOUT)!= null){ + con.setReadTimeout(Integer.parseInt(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_READ_TIMEOUT))); + } // add request header con.setRequestProperty("uebkey", appUebKey); @@ -325,9 +333,17 @@ public class RestWebServiceClient { // Create the connection object HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + con.setConnectTimeout(3000); + // if the portal property is set then gets the timeout value from portal properties + if(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_CONNECTION_TIMEOUT)!= null){ + con.setConnectTimeout(Integer.parseInt(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_CONNECTION_TIMEOUT))); + } con.setReadTimeout(15000); - + if(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_READ_TIMEOUT)!= null){ + con.setReadTimeout(Integer.parseInt(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_READ_TIMEOUT))); + } + // add request header con.setRequestProperty("uebkey", appUebKey); if (appUserName != null) @@ -414,8 +430,14 @@ public class RestWebServiceClient { HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("DELETE"); con.setConnectTimeout(3000); + // if the portal property is set then gets the timeout value from portal properties + if(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_CONNECTION_TIMEOUT)!= null){ + con.setConnectTimeout(Integer.parseInt(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_CONNECTION_TIMEOUT))); + } con.setReadTimeout(15000); - + if(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_READ_TIMEOUT)!= null){ + con.setReadTimeout(Integer.parseInt(PortalApiProperties.getProperty(PortalApiConstants.EXT_REQUEST_READ_TIMEOUT))); + } // add request header con.setRequestProperty("uebkey", appUebKey); if (appUserName != null) diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/util/PortalApiConstants.java b/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/util/PortalApiConstants.java index 196d2100..7f42a1d5 100644 --- a/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/util/PortalApiConstants.java +++ b/ecomp-sdk/epsdk-fw/src/main/java/org/openecomp/portalsdk/core/onboarding/util/PortalApiConstants.java @@ -63,4 +63,6 @@ public interface PortalApiConstants { //encrpt key public static final String Decryption_Key = "decryption_key"; + public static final String EXT_REQUEST_CONNECTION_TIMEOUT = "ext_req_connection_timeout"; + public static final String EXT_REQUEST_READ_TIMEOUT = "ext_req_read_timeout"; } |