Compare commits

...

3 Commits

Author SHA1 Message Date
a0f4680271 [DEV] update dev tag version 2024-09-20 19:47:44 +02:00
d9e118afaa [RELEASE] new version 0.15.0 2024-09-20 19:46:56 +02:00
9f43ebc782 [FIX] some fixes 2024-09-20 19:45:11 +02:00
7 changed files with 12 additions and 5 deletions

View File

@ -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>

View File

@ -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);

View File

@ -58,5 +58,4 @@ public class MediaStreamer implements StreamingOutput {
public long getLenth() {
return this.length;
}
}

View File

@ -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());
}

View File

@ -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");
}

View File

@ -259,6 +259,9 @@ public class DataTools {
if (data.contentEquals("null")) {
return null;
}
if (data.contentEquals("undefined")) {
return null;
}
return data;
}

View File

@ -1 +1 @@
0.14.3-dev
0.15.1-dev