1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.mycore.frontend.acl2.resources;
20
21 import org.mycore.frontend.jersey.MCRStaticContent;
22
23 import jakarta.servlet.http.HttpServletResponse;
24 import jakarta.ws.rs.GET;
25 import jakarta.ws.rs.Path;
26 import jakarta.ws.rs.PathParam;
27 import jakarta.ws.rs.core.Context;
28 import jakarta.ws.rs.core.Response;
29
30 @Path("ACLE/gui")
31 @MCRStaticContent
32 public class MCRAclEditorGuiResource {
33
34 @Context
35 HttpServletResponse response;
36
37 @GET
38 @Path("{filename:.*}")
39 public Response getResources(@PathParam("filename") String filename) {
40 if (filename.endsWith(".js")) {
41 return Response.ok(getClass()
42 .getResourceAsStream("/META-INF/resources/modules/acl-editor2/gui/" + filename))
43 .header("Content-Type", "application/javascript")
44 .build();
45 }
46
47 if (filename.endsWith(".css")) {
48 return Response.ok(getClass()
49 .getResourceAsStream("/META-INF/resources/modules/acl-editor2/gui/" + filename))
50 .header("Content-Type", "text/css")
51 .build();
52 }
53 return Response.ok(getClass()
54 .getResourceAsStream("/META-INF/resources/modules/acl-editor2/gui/" + filename))
55 .build();
56 }
57 }