Compare commits
3 Commits
8b831522dc
...
a0f4680271
Author | SHA1 | Date | |
---|---|---|---|
a0f4680271 | |||
d9e118afaa | |||
9f43ebc782 |
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>kangaroo-and-rabbit</groupId>
|
||||
<artifactId>archidata</artifactId>
|
||||
<version>0.14.3-SNAPSHOT</version>
|
||||
<version>0.15.0</version>
|
||||
<properties>
|
||||
<java.version>21</java.version>
|
||||
<maven.compiler.version>3.1</maven.compiler.version>
|
||||
|
@ -304,9 +304,11 @@ public class DataResource {
|
||||
// logger.info("===================================================");
|
||||
final Data value = getSmall(uuid);
|
||||
if (value == null) {
|
||||
LOGGER.warn("Request data that does not exist : {}", uuid);
|
||||
return Response.status(404).entity("media NOT FOUND: " + uuid).type("text/plain").build();
|
||||
}
|
||||
try {
|
||||
LOGGER.warn("Generate stream : {}", uuid);
|
||||
return buildStream(getFileData(uuid), range,
|
||||
value.mimeType == null ? "application/octet-stream" : value.mimeType);
|
||||
} catch (final Exception ex) {
|
||||
@ -478,7 +480,7 @@ public class DataResource {
|
||||
to = file.length() - 1;
|
||||
}
|
||||
final String responseRange = String.format("bytes %d-%d/%d", from, to, file.length());
|
||||
// logger.info("responseRange: {}", responseRange);
|
||||
// LOGGER.info("responseRange: {}", responseRange);
|
||||
try {
|
||||
final RandomAccessFile raf = new RandomAccessFile(file, "r");
|
||||
raf.seek(from);
|
||||
|
@ -58,5 +58,4 @@ public class MediaStreamer implements StreamingOutput {
|
||||
public long getLenth() {
|
||||
return this.length;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ public class WebApplicationExceptionCatcher implements ExceptionMapper<WebApplic
|
||||
}
|
||||
|
||||
private RestErrorResponse build(final WebApplicationException exception) {
|
||||
exception.printStackTrace();
|
||||
return new RestErrorResponse(exception.getResponse().getStatusInfo().toEnum(), "Catch system exception",
|
||||
exception.getMessage());
|
||||
}
|
||||
|
@ -16,8 +16,10 @@ public class CORSFilter implements ContainerResponseFilter {
|
||||
// System.err.println("filter cors ..." + request.toString());
|
||||
|
||||
response.getHeaders().add("Access-Control-Allow-Origin", "*");
|
||||
response.getHeaders().add("Access-Control-Allow-Range", "bytes");
|
||||
response.getHeaders().add("access-control-expose-headers", "range");
|
||||
response.getHeaders().add("Access-Control-Allow-Headers",
|
||||
"Origin, content-type, Content-type, Accept, Authorization, mime-type, filename");
|
||||
"Origin, content-type, Content-type, Accept, Authorization, mime-type, filename, Range");
|
||||
response.getHeaders().add("Access-Control-Allow-Credentials", "true");
|
||||
response.getHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD");
|
||||
}
|
||||
|
@ -259,6 +259,9 @@ public class DataTools {
|
||||
if (data.contentEquals("null")) {
|
||||
return null;
|
||||
}
|
||||
if (data.contentEquals("undefined")) {
|
||||
return null;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
0.14.3-dev
|
||||
0.15.1-dev
|
||||
|
Loading…
Reference in New Issue
Block a user