summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
2de2455)
Issue-ID: AAF-617
Change-Id: I9c9380480eada84cf91effab9330eb0c81770b70
Signed-off-by: Instrumental <jonathan.gathman@att.com>
- return Result.err(Status.ERR_NsNotFound,"There is no valid Company Namespace for %s",str);
+ int dot = str.lastIndexOf('.');
+
+ if (dot < 0) {
+ return Result.err(Status.ERR_NsNotFound,"There is no valid Company Namespace for %s",str);
+ } else {
+ return deriveFirstNsForType(trans, str.substring(0, dot),type);
+ }
}
}
return Result.err(Status.ERR_NotFound, str + " does not contain type " + type.name());
}
}
return Result.err(Status.ERR_NotFound, str + " does not contain type " + type.name());
import java.io.File;
import java.io.FileInputStream;
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.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;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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.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
import org.onap.aaf.misc.env.Trans;
/*
* CachingFileAccess
private Match match;
// package on purpose
private final TypedCode<TRANS> content;
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.
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>();
}
match = new Match(path);
content = new TypedCode<TRANS>();
}
content.add(code, others);
}
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;
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) {
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)
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)
if (hl==null) {
resp.setStatus(406); // NOT_ACCEPTABLE
} else {
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 {
if ("*".equals(hl.x) || "*/*".equals(hl.x)) {// if wild-card, then choose first kind of type
resp.setContentType(content.first());
} else {
rv = null; // not quite, keep going
}
}
rv = null; // not quite, keep going
}
}
if(symm==null) {
if (!f.exists()) {
write(f,Chmod.to400,Symm.keygen());
if(symm==null) {
if (!f.exists()) {
write(f,Chmod.to400,Symm.keygen());
- } else {
- System.out.println("Encryptor using " + f.getCanonicalPath());
+// } else {
+// System.out.println("Encryptor using " + f.getCanonicalPath());
}
symm = Symm.obtain(f);
symms.put(f.getCanonicalPath(),symm);
}
symm = Symm.obtain(f);
symms.put(f.getCanonicalPath(),symm);