diff options
Diffstat (limited to 'server/src/main/java/org/onap/usecaseui/server/util')
8 files changed, 11 insertions, 149 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java b/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java index 4fccee8a..600293ec 100644 --- a/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java +++ b/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java @@ -24,11 +24,12 @@ import java.util.List; import java.util.Map; import java.util.Properties; -import javax.annotation.Resource; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.Response; +import jakarta.annotation.Resource; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.Configuration; +import jakarta.ws.rs.core.Response; import com.google.common.base.Throwables; import org.glassfish.jersey.client.ClientConfig; @@ -106,7 +107,7 @@ public class DmaapSubscriber implements Runnable { } public List<String> getDMaaPData(String topic) { - Client client = ClientBuilder.newClient(new ClientConfig()); + Client client = ClientBuilder.newClient((Configuration) new ClientConfig()); WebTarget webTarget = client.target(url + "/" + topic + "/" + consumerGroup + "/" + consumer); Response response = webTarget.queryParam("timeout", timeout).request().get(); return response.readEntity(List.class); diff --git a/server/src/main/java/org/onap/usecaseui/server/util/HttpUtil.java b/server/src/main/java/org/onap/usecaseui/server/util/HttpUtil.java index 171ea28c..8e99c2d1 100644 --- a/server/src/main/java/org/onap/usecaseui/server/util/HttpUtil.java +++ b/server/src/main/java/org/onap/usecaseui/server/util/HttpUtil.java @@ -38,7 +38,7 @@ import org.onap.usecaseui.server.bean.HttpResponseResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import static org.onap.usecaseui.server.constant.CommonConstant.BLANK; import static org.onap.usecaseui.server.constant.CommonConstant.ENCODING_UTF8; diff --git a/server/src/main/java/org/onap/usecaseui/server/util/MyHttpDelete.java b/server/src/main/java/org/onap/usecaseui/server/util/MyHttpDelete.java deleted file mode 100644 index 7f4dc019..00000000 --- a/server/src/main/java/org/onap/usecaseui/server/util/MyHttpDelete.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. - * - * Licensed 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package org.onap.usecaseui.server.util; - -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; - -import java.net.URI; - -public class MyHttpDelete extends HttpEntityEnclosingRequestBase { - public static final String METHOD_NAME = "DELETE"; - - public String getMethod() { - return METHOD_NAME; - } - - public MyHttpDelete(final String uri) { - super(); - setURI(URI.create(uri)); - } - - public MyHttpDelete(final URI uri) { - super(); - setURI(uri); - } - - public MyHttpDelete() { - super(); - } -} diff --git a/server/src/main/java/org/onap/usecaseui/server/util/MyHttpGet.java b/server/src/main/java/org/onap/usecaseui/server/util/MyHttpGet.java deleted file mode 100644 index ccc2e0b6..00000000 --- a/server/src/main/java/org/onap/usecaseui/server/util/MyHttpGet.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. - * - * Licensed 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.util; - -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; - -import java.net.URI; - -public class MyHttpGet extends HttpEntityEnclosingRequestBase { - public static final String METHOD_NAME = "GET"; - - public String getMethod() { - return METHOD_NAME; - } - - public MyHttpGet(final String uri) { - super(); - setURI(URI.create(uri)); - } - - public MyHttpGet(final URI uri) { - super(); - setURI(uri); - } - - public MyHttpGet() { - super(); - } -}
\ No newline at end of file diff --git a/server/src/main/java/org/onap/usecaseui/server/util/ResponseUtil.java b/server/src/main/java/org/onap/usecaseui/server/util/ResponseUtil.java deleted file mode 100644 index 9891bcf7..00000000 --- a/server/src/main/java/org/onap/usecaseui/server/util/ResponseUtil.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved. - * - * Licensed 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.usecaseui.server.util; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.http.HttpServletResponse; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -public class ResponseUtil { - - private static Logger logger = LoggerFactory.getLogger(ResponseUtil.class); - - public static boolean responseDownload(String filePath, HttpServletResponse response){ - if (null != response){ - response.setCharacterEncoding("utf-8"); - response.setContentType("application/csv"); - response.setHeader("Content-Disposition","attachment;filename="+filePath); - try(InputStream is = new FileInputStream(filePath); - OutputStream os = response.getOutputStream()){ - byte[] b = new byte[2048]; - int length; - while ((length = is.read(b)) > 0) { - os.write(b, 0, length); - } - return true; - }catch (IOException e){ - logger.error("download csv File error :"+e.getMessage()); - return false; - } - }else{ - logger.error("csvFile generate success,but response is null,don't download to local"); - return false; - } - - } - -} diff --git a/server/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java b/server/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java index e3ad2744..f20603ec 100644 --- a/server/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java +++ b/server/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java @@ -24,7 +24,7 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/server/src/main/java/org/onap/usecaseui/server/util/UploadFileUtil.java b/server/src/main/java/org/onap/usecaseui/server/util/UploadFileUtil.java index 361612e5..155c34d0 100644 --- a/server/src/main/java/org/onap/usecaseui/server/util/UploadFileUtil.java +++ b/server/src/main/java/org/onap/usecaseui/server/util/UploadFileUtil.java @@ -15,7 +15,7 @@ */ package org.onap.usecaseui.server.util; -import javax.activation.MimetypesFileTypeMap; +import jakarta.activation.MimetypesFileTypeMap; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; diff --git a/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java b/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java index 837abee9..596becb9 100644 --- a/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java +++ b/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java @@ -25,7 +25,7 @@ import java.util.List; import java.util.Map; import java.util.UUID; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import com.google.common.base.Throwables; import org.apache.commons.io.FileUtils; |