View Javadoc
1   /*
2    * This file is part of ***  M y C o R e  ***
3    * See http://www.mycore.de/ for details.
4    *
5    * MyCoRe is free software: you can redistribute it and/or modify
6    * it under the terms of the GNU General Public License as published by
7    * the Free Software Foundation, either version 3 of the License, or
8    * (at your option) any later version.
9    *
10   * MyCoRe is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   *
15   * You should have received a copy of the GNU General Public License
16   * along with MyCoRe.  If not, see <http://www.gnu.org/licenses/>.
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  }