renames some crappy constants

Wed, 13 May 2020 18:45:28 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 13 May 2020 18:45:28 +0200
changeset 43
9abf0bf44c7b
parent 42
f962ff9dd44e
child 44
835dd169642a

renames some crappy constants

src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/ResponseType.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/modules/ErrorModule.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/modules/HomeModule.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/modules/LanguageModule.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/modules/VersionsModule.java file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/html_full.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/site.jsp file | annotate | diff | comparison | revisions
     1.1 --- a/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Wed May 13 18:40:52 2020 +0200
     1.2 +++ b/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Wed May 13 18:45:28 2020 +0200
     1.3 @@ -53,7 +53,7 @@
     1.4  
     1.5      private static final Logger LOG = LoggerFactory.getLogger(AbstractLightPITServlet.class);
     1.6  
     1.7 -    private static final String HTML_FULL_DISPATCHER = Functions.jspPath("html_full");
     1.8 +    private static final String SITE_JSP = Functions.jspPath("site");
     1.9  
    1.10      /**
    1.11       * The EL proxy is necessary, because the EL resolver cannot handle annotation properties.
    1.12 @@ -234,7 +234,7 @@
    1.13              throws IOException, ServletException {
    1.14  
    1.15          req.setAttribute(Constants.REQ_ATTR_MENU, getModuleManager().getMainMenu());
    1.16 -        req.getRequestDispatcher(HTML_FULL_DISPATCHER).forward(req, resp);
    1.17 +        req.getRequestDispatcher(SITE_JSP).forward(req, resp);
    1.18      }
    1.19  
    1.20      private Optional<Method> findMapping(HttpMethod method, HttpServletRequest req) {
    1.21 @@ -248,7 +248,7 @@
    1.22          switch (type) {
    1.23              case NONE:
    1.24                  return;
    1.25 -            case HTML_FULL:
    1.26 +            case HTML:
    1.27                  forwardToFullView(req, resp);
    1.28                  return;
    1.29              // TODO: implement remaining response types
     2.1 --- a/src/main/java/de/uapcore/lightpit/ResponseType.java	Wed May 13 18:40:52 2020 +0200
     2.2 +++ b/src/main/java/de/uapcore/lightpit/ResponseType.java	Wed May 13 18:45:28 2020 +0200
     2.3 @@ -33,7 +33,7 @@
     2.4      /**
     2.5       * Renders a full HTML view including the header.
     2.6       */
     2.7 -    HTML_FULL,
     2.8 +    HTML,
     2.9      /**
    2.10       * Renders a HTML fragment only.
    2.11       * May be used for AJAX responses.
     3.1 --- a/src/main/java/de/uapcore/lightpit/modules/ErrorModule.java	Wed May 13 18:40:52 2020 +0200
     3.2 +++ b/src/main/java/de/uapcore/lightpit/modules/ErrorModule.java	Wed May 13 18:45:28 2020 +0200
     3.3 @@ -56,7 +56,7 @@
     3.4          setStylesheet(req, "error");
     3.5          setDynamicFragment(req, "error");
     3.6  
     3.7 -        return ResponseType.HTML_FULL;
     3.8 +        return ResponseType.HTML;
     3.9      }
    3.10  
    3.11      @RequestMapping(requestPath = "404", method = HttpMethod.GET)
     4.1 --- a/src/main/java/de/uapcore/lightpit/modules/HomeModule.java	Wed May 13 18:40:52 2020 +0200
     4.2 +++ b/src/main/java/de/uapcore/lightpit/modules/HomeModule.java	Wed May 13 18:45:28 2020 +0200
     4.3 @@ -49,6 +49,6 @@
     4.4      @RequestMapping(method = HttpMethod.GET)
     4.5      public ResponseType handle() {
     4.6  
     4.7 -        return ResponseType.HTML_FULL;
     4.8 +        return ResponseType.HTML;
     4.9      }
    4.10  }
     5.1 --- a/src/main/java/de/uapcore/lightpit/modules/LanguageModule.java	Wed May 13 18:40:52 2020 +0200
     5.2 +++ b/src/main/java/de/uapcore/lightpit/modules/LanguageModule.java	Wed May 13 18:45:28 2020 +0200
     5.3 @@ -92,7 +92,7 @@
     5.4  
     5.5          setStylesheet(req, "language");
     5.6          setDynamicFragment(req, "language");
     5.7 -        return ResponseType.HTML_FULL;
     5.8 +        return ResponseType.HTML;
     5.9      }
    5.10  
    5.11      @RequestMapping(method = HttpMethod.POST)
     6.1 --- a/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Wed May 13 18:40:52 2020 +0200
     6.2 +++ b/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Wed May 13 18:45:28 2020 +0200
     6.3 @@ -49,6 +49,6 @@
     6.4      @RequestMapping(method = HttpMethod.GET)
     6.5      public ResponseType handle(HttpServletRequest req, DataAccessObjects dao) {
     6.6  
     6.7 -        return ResponseType.HTML_FULL;
     6.8 +        return ResponseType.HTML;
     6.9      }
    6.10  }
     7.1 --- a/src/main/java/de/uapcore/lightpit/modules/VersionsModule.java	Wed May 13 18:40:52 2020 +0200
     7.2 +++ b/src/main/java/de/uapcore/lightpit/modules/VersionsModule.java	Wed May 13 18:45:28 2020 +0200
     7.3 @@ -48,6 +48,6 @@
     7.4      @RequestMapping(method = HttpMethod.GET)
     7.5      public ResponseType handle(HttpServletRequest req, DataAccessObjects dao) {
     7.6  
     7.7 -        return ResponseType.HTML_FULL;
     7.8 +        return ResponseType.HTML;
     7.9      }
    7.10  }
     8.1 --- a/src/main/webapp/WEB-INF/jsp/html_full.jsp	Wed May 13 18:40:52 2020 +0200
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,91 +0,0 @@
     8.4 -<%-- 
     8.5 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     8.6 -
     8.7 -Copyright 2018 Mike Becker. All rights reserved.
     8.8 -
     8.9 -Redistribution and use in source and binary forms, with or without
    8.10 -modification, are permitted provided that the following conditions are met:
    8.11 -
    8.12 -1. Redistributions of source code must retain the above copyright
    8.13 -notice, this list of conditions and the following disclaimer.
    8.14 -
    8.15 -2. Redistributions in binary form must reproduce the above copyright
    8.16 -notice, this list of conditions and the following disclaimer in the
    8.17 -documentation and/or other materials provided with the distribution.
    8.18 -
    8.19 -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    8.20 -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    8.21 -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    8.22 -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
    8.23 -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    8.24 -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    8.25 -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    8.26 -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    8.27 -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    8.28 -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    8.29 ---%>
    8.30 -<%@page contentType="text/html" pageEncoding="UTF-8" trimDirectiveWhitespaces="true" %>
    8.31 -<%@page import="de.uapcore.lightpit.Constants" %>
    8.32 -<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    8.33 -<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    8.34 -<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    8.35 -
    8.36 -<%-- Define an alias for the main menu --%>
    8.37 -<c:set scope="page" var="mainMenu" value="${requestScope[Constants.REQ_ATTR_MENU]}"/>
    8.38 -
    8.39 -<%-- Define an alias for the fragment name --%>
    8.40 -<c:set scope="page" var="fragment" value="${requestScope[Constants.REQ_ATTR_FRAGMENT]}"/>
    8.41 -
    8.42 -<%-- Define an alias for the additional stylesheet --%>
    8.43 -<c:set scope="page" var="extraCss" value="${requestScope[Constants.REQ_ATTR_STYLESHEET]}"/>
    8.44 -
    8.45 -<%-- Define an alias for the module info --%>
    8.46 -<c:set scope="page" var="moduleInfo" value="${requestScope[Constants.REQ_ATTR_MODULE_INFO]}"/>
    8.47 -
    8.48 -<%-- Apply the session locale (should always be present, but check nevertheless) --%>
    8.49 -<c:if test="${not empty sessionScope[Constants.SESSION_ATTR_LANGUAGE]}">
    8.50 -<fmt:setLocale scope="request" value="${sessionScope[Constants.SESSION_ATTR_LANGUAGE]}"/>
    8.51 -</c:if>
    8.52 -
    8.53 -<!DOCTYPE html>
    8.54 -<html>
    8.55 -    <head>
    8.56 -        <base href="${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/">
    8.57 -        <title>LightPIT -
    8.58 -            <fmt:bundle basename="${moduleInfo.bundleBaseName}">
    8.59 -                <fmt:message key="${moduleInfo.titleKey}" />
    8.60 -            </fmt:bundle>
    8.61 -        </title>
    8.62 -        <meta charset="UTF-8">
    8.63 -        <link rel="stylesheet" href="lightpit.css" type="text/css">
    8.64 -        <c:if test="${not empty extraCss}">
    8.65 -        <link rel="stylesheet" href="${extraCss}" type="text/css">
    8.66 -        </c:if>
    8.67 -    </head>
    8.68 -    <body>
    8.69 -        <div id="mainMenu">
    8.70 -            <c:forEach var="menu" items="${mainMenu}">
    8.71 -                <div class="menuEntry"
    8.72 -                     <c:if test="${requestScope[Constants.REQ_ATTR_MODULE_CLASSNAME] eq menu.moduleClassName}">
    8.73 -                         data-active
    8.74 -                     </c:if>
    8.75 -                >
    8.76 -                    <a href="${menu.pathName}">
    8.77 -                    <fmt:bundle basename="${menu.resourceKey.bundle}">
    8.78 -                        <fmt:message key="${menu.resourceKey.key}" />
    8.79 -                    </fmt:bundle>
    8.80 -                    </a>
    8.81 -                </div>
    8.82 -            </c:forEach>
    8.83 -        </div>
    8.84 -        <div id="subMenu">
    8.85 -            
    8.86 -        </div>
    8.87 -        <div id="content-area">
    8.88 -            <c:if test="${not empty fragment}">
    8.89 -                <fmt:setBundle scope="request" basename="${moduleInfo.bundleBaseName}"/>
    8.90 -                <c:import url="${fragment}" />
    8.91 -            </c:if>
    8.92 -        </div>
    8.93 -    </body>
    8.94 -</html>
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/src/main/webapp/WEB-INF/jsp/site.jsp	Wed May 13 18:45:28 2020 +0200
     9.3 @@ -0,0 +1,91 @@
     9.4 +<%-- 
     9.5 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     9.6 +
     9.7 +Copyright 2018 Mike Becker. All rights reserved.
     9.8 +
     9.9 +Redistribution and use in source and binary forms, with or without
    9.10 +modification, are permitted provided that the following conditions are met:
    9.11 +
    9.12 +1. Redistributions of source code must retain the above copyright
    9.13 +notice, this list of conditions and the following disclaimer.
    9.14 +
    9.15 +2. Redistributions in binary form must reproduce the above copyright
    9.16 +notice, this list of conditions and the following disclaimer in the
    9.17 +documentation and/or other materials provided with the distribution.
    9.18 +
    9.19 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    9.20 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    9.21 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    9.22 +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
    9.23 +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    9.24 +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    9.25 +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    9.26 +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    9.27 +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    9.28 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    9.29 +--%>
    9.30 +<%@page contentType="text/html" pageEncoding="UTF-8" trimDirectiveWhitespaces="true" %>
    9.31 +<%@page import="de.uapcore.lightpit.Constants" %>
    9.32 +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    9.33 +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    9.34 +<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    9.35 +
    9.36 +<%-- Define an alias for the main menu --%>
    9.37 +<c:set scope="page" var="mainMenu" value="${requestScope[Constants.REQ_ATTR_MENU]}"/>
    9.38 +
    9.39 +<%-- Define an alias for the fragment name --%>
    9.40 +<c:set scope="page" var="fragment" value="${requestScope[Constants.REQ_ATTR_FRAGMENT]}"/>
    9.41 +
    9.42 +<%-- Define an alias for the additional stylesheet --%>
    9.43 +<c:set scope="page" var="extraCss" value="${requestScope[Constants.REQ_ATTR_STYLESHEET]}"/>
    9.44 +
    9.45 +<%-- Define an alias for the module info --%>
    9.46 +<c:set scope="page" var="moduleInfo" value="${requestScope[Constants.REQ_ATTR_MODULE_INFO]}"/>
    9.47 +
    9.48 +<%-- Apply the session locale (should always be present, but check nevertheless) --%>
    9.49 +<c:if test="${not empty sessionScope[Constants.SESSION_ATTR_LANGUAGE]}">
    9.50 +<fmt:setLocale scope="request" value="${sessionScope[Constants.SESSION_ATTR_LANGUAGE]}"/>
    9.51 +</c:if>
    9.52 +
    9.53 +<!DOCTYPE html>
    9.54 +<html>
    9.55 +    <head>
    9.56 +        <base href="${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/">
    9.57 +        <title>LightPIT -
    9.58 +            <fmt:bundle basename="${moduleInfo.bundleBaseName}">
    9.59 +                <fmt:message key="${moduleInfo.titleKey}" />
    9.60 +            </fmt:bundle>
    9.61 +        </title>
    9.62 +        <meta charset="UTF-8">
    9.63 +        <link rel="stylesheet" href="lightpit.css" type="text/css">
    9.64 +        <c:if test="${not empty extraCss}">
    9.65 +        <link rel="stylesheet" href="${extraCss}" type="text/css">
    9.66 +        </c:if>
    9.67 +    </head>
    9.68 +    <body>
    9.69 +        <div id="mainMenu">
    9.70 +            <c:forEach var="menu" items="${mainMenu}">
    9.71 +                <div class="menuEntry"
    9.72 +                     <c:if test="${requestScope[Constants.REQ_ATTR_MODULE_CLASSNAME] eq menu.moduleClassName}">
    9.73 +                         data-active
    9.74 +                     </c:if>
    9.75 +                >
    9.76 +                    <a href="${menu.pathName}">
    9.77 +                    <fmt:bundle basename="${menu.resourceKey.bundle}">
    9.78 +                        <fmt:message key="${menu.resourceKey.key}" />
    9.79 +                    </fmt:bundle>
    9.80 +                    </a>
    9.81 +                </div>
    9.82 +            </c:forEach>
    9.83 +        </div>
    9.84 +        <div id="subMenu">
    9.85 +            
    9.86 +        </div>
    9.87 +        <div id="content-area">
    9.88 +            <c:if test="${not empty fragment}">
    9.89 +                <fmt:setBundle scope="request" basename="${moduleInfo.bundleBaseName}"/>
    9.90 +                <c:import url="${fragment}" />
    9.91 +            </c:if>
    9.92 +        </div>
    9.93 +    </body>
    9.94 +</html>

mercurial