+ String url = app.restUrl + "/timeoutSession" + "?portalJSessionId=" + portalJSessionId;
+
+ String encriptedPwdDB = app.appPassword;
+ String appUserName = app.username;
+ // String decreptedPwd = CipherUtil.decrypt(encriptedPwdDB,
+ // SystemProperties.getProperty(SystemProperties.Decryption_Key));
+
+ setLocalMDCContext(app, "/timeoutSession", url);
+
+ URL obj = new URL(url);
+ HttpURLConnection con = (HttpURLConnection) obj.openConnection();
+
+ // optional default is GET
+ con.setRequestMethod("POST");
+ con.setConnectTimeout(3000);
+ con.setReadTimeout(15000);
+
+ // add request header
+ con.setRequestProperty("username", appUserName);
+ con.setRequestProperty("password", encriptedPwdDB);
+
+ // con.setRequestProperty("portalJSessionId", portalJSessionId);
+ con.setDoInput(true);
+ con.setDoOutput(true);
+ con.getOutputStream().flush();
+ con.getOutputStream().close();
+
+ responseCode = con.getResponseCode();
+ logger.debug(EELFLoggerDelegate.debugLogger, "Response Code : " + responseCode);
+ } catch (UrlAccessRestrictedException e) {
+ responseCode = HttpServletResponse.SC_UNAUTHORIZED;
+ String message = String.format(
+ "SessionCommunication.timeoutSession received an un-authorized exception. AppName: %s", appName);
+ logger.error(EELFLoggerDelegate.errorLogger, message);
+ EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeRestApiAuthenticationError, e);
+ } catch (Exception e) {
+ responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
+ String message = String.format(
+ "SessionCommunication.timeoutSession encountered an Exception. AppName: %s, Details: %s", appName,
+ EcompPortalUtils.getStackTrace(e));
+ EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeHttpConnectionError, e);
+ logger.error(EELFLoggerDelegate.errorLogger, message);
+ } finally {
+ EcompPortalUtils.setExternalAppResponseCode(responseCode);