diff options
author | 2018-11-07 17:36:15 -0600 | |
---|---|---|
committer | 2018-11-07 17:40:55 -0600 | |
commit | 8cd88b8fbd5cdaa3fe796a11c0788ba202a808a3 (patch) | |
tree | d9ad371e98598d2303b23a16b413b30133485bd4 /auth/auth-core/src/main/java/org | |
parent | 2de245542cb901ff47133132ba3ec8df9fb2c891 (diff) |
Fix Proxy DELETE
Issue-ID: AAF-617
Change-Id: I9c9380480eada84cf91effab9330eb0c81770b70
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-core/src/main/java/org')
3 files changed, 4 insertions, 16 deletions
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java index ce87533e..fa17f040 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java @@ -24,15 +24,12 @@ package org.onap.aaf.auth.rserv; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -52,11 +49,9 @@ import java.util.regex.Pattern; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.onap.aaf.misc.env.Env; import org.onap.aaf.misc.env.EnvJAXB; import org.onap.aaf.misc.env.LogTarget; import org.onap.aaf.misc.env.Store; -import org.onap.aaf.misc.env.TimeTaken; import org.onap.aaf.misc.env.Trans; /* * CachingFileAccess diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java index b11916ef..46a3a955 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java @@ -40,13 +40,13 @@ public class Route<TRANS extends Trans> { private Match match; // package on purpose private final TypedCode<TRANS> content; - private final boolean isGet; + private final boolean isContentType; public Route(HttpMethods meth, String path) { this.path = path; auditText = meth.name() + ' ' + path; this.meth = meth; // Note: Using Spark def for now. - isGet = meth.compareTo(HttpMethods.GET) == 0; + isContentType = meth.compareTo(HttpMethods.GET) == 0 || meth.compareTo(HttpMethods.DELETE)==0; match = new Match(path); content = new TypedCode<TRANS>(); } @@ -56,18 +56,12 @@ public class Route<TRANS extends Trans> { content.add(code, others); } -// public void add(HttpCode<TRANS,?> code, Class<?> cls, String version, String ... others) { -// code.match = match; -// content.add(code, cls, version, others); -// } -// public HttpCode<TRANS,?> getCode(TRANS trans, HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { // Type is associated with Accept for GET (since it is what is being returned // We associate the rest with ContentType. // FYI, thought about this a long time before implementing this way. String compare; -// String special[]; // todo, expose Charset (in special) to outside - if (isGet) { + if (isContentType) { compare = req.getHeader("Accept"); // Accept is used for read, as we want to agree on what caller is ready to handle } else { compare = req.getContentType(); // Content type used to declare what data is being created, updated or deleted (might be used for key) @@ -77,7 +71,7 @@ public class Route<TRANS extends Trans> { if (hl==null) { resp.setStatus(406); // NOT_ACCEPTABLE } else { - if (isGet) { // Set Content Type to expected content + if (isContentType) { // Set Content Type to expected content if ("*".equals(hl.x) || "*/*".equals(hl.x)) {// if wild-card, then choose first kind of type resp.setContentType(content.first()); } else { diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java index de42e26b..ed6326a8 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java @@ -75,7 +75,6 @@ public class Routes<TRANS extends Trans> { rv = null; // not quite, keep going } } - //TODO a Default? return rv; } |