summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/helpserver/provider/src
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/provider/src
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/provider/src')
-rw-r--r--sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java29
1 files changed, 8 insertions, 21 deletions
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());
}