From d485faad91ea2efcee360852d90848b511b8c096 Mon Sep 17 00:00:00 2001 From: "tcdlpds@gmail.com" Date: Mon, 25 Jan 2021 15:10:31 +0530 Subject: [PATCH] Improve interceptor source --- .../io.entgra.ui.request.interceptor/pom.xml | 5 ----- .../entgra/ui/request/interceptor/DefaultTokenHandler.java | 4 ++-- .../io/entgra/ui/request/interceptor/InvokerHandler.java | 2 +- .../java/io/entgra/ui/request/interceptor/LoginHandler.java | 2 +- .../io/entgra/ui/request/interceptor/LogoutHandler.java | 2 +- .../io/entgra/ui/request/interceptor/OTPInvokerHandler.java | 2 +- .../ui/request/interceptor/SsoLoginCallbackHandler.java | 2 +- .../io/entgra/ui/request/interceptor/SsoLoginHandler.java | 2 +- .../io/entgra/ui/request/interceptor/SsoLogoutHandler.java | 2 +- .../java/io/entgra/ui/request/interceptor/UserHandler.java | 2 +- .../entgra/ui/request/interceptor/beans}/ProxyResponse.java | 6 +++--- .../io/entgra/ui/request/interceptor/util/HandlerUtil.java | 3 +-- 12 files changed, 14 insertions(+), 20 deletions(-) rename components/{application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common => ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/beans}/ProxyResponse.java (83%) diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/pom.xml b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/pom.xml index 1ca70f1b4cc..cdd5836985b 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/pom.xml +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/pom.xml @@ -289,11 +289,6 @@ - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.application.mgt.common - provided - org.apache.httpcomponents httpmime diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/DefaultTokenHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/DefaultTokenHandler.java index 5ffafa6bd6b..1079e78b27f 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/DefaultTokenHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/DefaultTokenHandler.java @@ -31,7 +31,7 @@ import org.apache.http.HttpStatus; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.utils.URIBuilder; import org.apache.http.entity.ContentType; -import org.wso2.carbon.device.application.mgt.common.ProxyResponse; +import io.entgra.ui.request.interceptor.beans.ProxyResponse; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; @@ -131,7 +131,7 @@ public class DefaultTokenHandler extends HttpServlet { URIBuilder ub = new URIBuilder(); ub.setScheme(HandlerConstants.WSS_PROTOCOL); - ub.setHost(System.getProperty(System.getProperty(HandlerConstants.IOT_CORE_HOST_ENV_VAR))); + ub.setHost(System.getProperty(HandlerConstants.IOT_CORE_HOST_ENV_VAR)); ub.setPort(Integer.parseInt(System.getProperty(HandlerConstants.IOT_CORE_PORT_ENV_VAR))); ub.setPath(HandlerConstants.REMOTE_SESSION_CONTEXT); diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/InvokerHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/InvokerHandler.java index 122d5b45bb6..49e0489de3c 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/InvokerHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/InvokerHandler.java @@ -47,7 +47,7 @@ import org.apache.http.entity.StringEntity; import org.apache.http.entity.mime.HttpMultipartMode; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.InputStreamBody; -import org.wso2.carbon.device.application.mgt.common.ProxyResponse; +import io.entgra.ui.request.interceptor.beans.ProxyResponse; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LoginHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LoginHandler.java index 3ef9d9d4a98..133681355b5 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LoginHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LoginHandler.java @@ -35,7 +35,7 @@ import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.protocol.HTTP; -import org.wso2.carbon.device.application.mgt.common.ProxyResponse; +import io.entgra.ui.request.interceptor.beans.ProxyResponse; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LogoutHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LogoutHandler.java index 8ebacf1cb7b..6cb7aed7571 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LogoutHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/LogoutHandler.java @@ -22,7 +22,7 @@ import io.entgra.ui.request.interceptor.util.HandlerUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpStatus; -import org.wso2.carbon.device.application.mgt.common.ProxyResponse; +import io.entgra.ui.request.interceptor.beans.ProxyResponse; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/OTPInvokerHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/OTPInvokerHandler.java index 624814f327d..a97d8be7c5a 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/OTPInvokerHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/OTPInvokerHandler.java @@ -42,7 +42,7 @@ import org.apache.http.entity.InputStreamEntity; import org.apache.http.entity.mime.HttpMultipartMode; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.InputStreamBody; -import org.wso2.carbon.device.application.mgt.common.ProxyResponse; +import io.entgra.ui.request.interceptor.beans.ProxyResponse; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginCallbackHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginCallbackHandler.java index 3d18be2ab14..8ee6ec776bb 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginCallbackHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginCallbackHandler.java @@ -30,7 +30,7 @@ import org.apache.http.HttpHeaders; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; -import org.wso2.carbon.device.application.mgt.common.ProxyResponse; +import io.entgra.ui.request.interceptor.beans.ProxyResponse; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginHandler.java index 0164d9f6e9c..1ade046d431 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLoginHandler.java @@ -40,7 +40,7 @@ import org.json.JSONArray; import org.json.JSONObject; import org.w3c.dom.Document; import org.w3c.dom.NodeList; -import org.wso2.carbon.device.application.mgt.common.ProxyResponse; +import io.entgra.ui.request.interceptor.beans.ProxyResponse; import org.xml.sax.InputSource; import org.xml.sax.SAXException; diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLogoutHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLogoutHandler.java index d8e1a78bda5..92d14735ae8 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLogoutHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/SsoLogoutHandler.java @@ -23,7 +23,7 @@ import io.entgra.ui.request.interceptor.util.HandlerUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpStatus; -import org.wso2.carbon.device.application.mgt.common.ProxyResponse; +import io.entgra.ui.request.interceptor.beans.ProxyResponse; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/UserHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/UserHandler.java index d35e4958352..9686979d532 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/UserHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/UserHandler.java @@ -32,7 +32,7 @@ import org.apache.http.HttpStatus; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; -import org.wso2.carbon.device.application.mgt.common.ProxyResponse; +import io.entgra.ui.request.interceptor.beans.ProxyResponse; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ProxyResponse.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/beans/ProxyResponse.java similarity index 83% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ProxyResponse.java rename to components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/beans/ProxyResponse.java index 684099d66c9..ea1a550cfbc 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ProxyResponse.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/beans/ProxyResponse.java @@ -1,7 +1,7 @@ /* - * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * Copyright (c) 2021, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. * - * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.device.application.mgt.common; +package io.entgra.ui.request.interceptor.beans; public class ProxyResponse { diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java index 56d8ead6f82..4582468a0cd 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java @@ -23,7 +23,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import com.google.gson.JsonSyntaxException; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -42,7 +41,7 @@ import org.apache.xml.serialize.XMLSerializer; import org.json.JSONException; import org.json.JSONObject; import org.w3c.dom.Document; -import org.wso2.carbon.device.application.mgt.common.ProxyResponse; +import io.entgra.ui.request.interceptor.beans.ProxyResponse; import org.xml.sax.SAXException; import javax.servlet.http.HttpServletRequest;