aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/helpserver
diff options
context:
space:
mode:
authorhighstreetherbert <herbert.eiselt@highstreet-technologies.com>2021-11-19 14:46:00 +0100
committerhighstreetherbert <herbert.eiselt@highstreet-technologies.com>2021-11-19 14:46:20 +0100
commit3e739d832853e821472facb181aa972ecfb45b1c (patch)
tree35a79049048a506c03884e09d65c7a477c4cffd4 /sdnr/wt/helpserver
parent71031b0b238ee51affd8135fdd648d9a70a6970b (diff)
Synchronize sdnr/wt artifacts
Synchronize sdnr/wt common, help, apigateway Issue-ID: CCSDK-3528 Signed-off-by: highstreetherbert <herbert.eiselt@highstreet-technologies.com> Change-Id: I4b5e5ce1b16adad80e670bdf08943e4a3eb658f1 Signed-off-by: highstreetherbert <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/helpserver')
-rwxr-xr-xsdnr/wt/helpserver/installer/pom.xml4
-rw-r--r--sdnr/wt/helpserver/provider/pom.xml3
-rw-r--r--sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java29
3 files changed, 12 insertions, 24 deletions
diff --git a/sdnr/wt/helpserver/installer/pom.xml b/sdnr/wt/helpserver/installer/pom.xml
index 498012d49..03296c830 100755
--- a/sdnr/wt/helpserver/installer/pom.xml
+++ b/sdnr/wt/helpserver/installer/pom.xml
@@ -47,7 +47,7 @@
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>${application.name}-feature</artifactId>
<version>${project.version}</version>
<type>xml</type>
@@ -60,7 +60,7 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>${application.name}-provider</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/sdnr/wt/helpserver/provider/pom.xml b/sdnr/wt/helpserver/provider/pom.xml
index 82205d553..f37c07e65 100644
--- a/sdnr/wt/helpserver/provider/pom.xml
+++ b/sdnr/wt/helpserver/provider/pom.xml
@@ -47,6 +47,7 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
@@ -68,7 +69,7 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>sdnr-wt-common</artifactId>
<version>${project.version}</version>
<scope>test</scope>
diff --git a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java
index 683311e8a..e9470ab09 100644
--- a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java
+++ b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java
@@ -41,8 +41,6 @@ public class HelpServlet extends HttpServlet implements AutoCloseable {
private static final String BASEURI = "/help";
- private static final boolean REDIRECT_LINKS = true;
-
private final Path basePath;
public HelpServlet() {
@@ -113,21 +111,7 @@ public class HelpServlet extends HttpServlet implements AutoCloseable {
return;
}
LOG.debug("delivering file");
- OutputStream out = resp.getOutputStream();
- // if (this.isTextFile(f) && REDIRECT_LINKS) {
- // String line;
- // try (BufferedReader br = new BufferedReader(new FileReader(f))) {
- // line = br.readLine();
- // while (line != null) {
- // out.write((line + "\n").getBytes());
- // line = br.readLine();
- // }
- // out.flush();
- // out.close();
- // br.close();
- // }
- // } else
- {
+ try (OutputStream out = resp.getOutputStream()) {
try (FileInputStream in = new FileInputStream(f)) {
byte[] buffer = new byte[1024];
@@ -139,6 +123,9 @@ public class HelpServlet extends HttpServlet implements AutoCloseable {
out.flush();
out.close();
}
+ } catch (IOException e) {
+ LOG.warn("Can not write meta file", e);
+ resp.setStatus(500);
}
} else {
LOG.debug("found not file for request");
@@ -148,15 +135,15 @@ public class HelpServlet extends HttpServlet implements AutoCloseable {
}
private boolean ispdf(File f) {
- return f != null ? this.ispdf(f.getName()) : false;
+ return f != null && this.ispdf(f.getName());
}
private boolean ispdf(String name) {
- return name != null ? name.toLowerCase().endsWith("pdf") : false;
+ return name != null && name.toLowerCase().endsWith("pdf");
}
private boolean isImageFile(File f) {
- return f != null ? this.isImageFile(f.getName()) : false;
+ return f != null && this.isImageFile(f.getName());
}
private boolean isImageFile(String name) {
@@ -169,7 +156,7 @@ public class HelpServlet extends HttpServlet implements AutoCloseable {
}
private boolean isTextFile(File f) {
- return f != null ? this.isTextFile(f.getName()) : false;
+ return f != null && this.isTextFile(f.getName());
}