Wed, 29 Mar 2017 16:06:22 +0200
adds HomeServerlet and Resource Bundle
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/java/de/uapcore/lightpit/Constants.java Wed Mar 29 16:06:22 2017 +0200 1.3 @@ -0,0 +1,33 @@ 1.4 +/* 1.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 1.6 + * 1.7 + * Copyright 2017 Mike Becker. All rights reserved. 1.8 + * 1.9 + * Redistribution and use in source and binary forms, with or without 1.10 + * modification, are permitted provided that the following conditions are met: 1.11 + * 1.12 + * 1. Redistributions of source code must retain the above copyright 1.13 + * notice, this list of conditions and the following disclaimer. 1.14 + * 1.15 + * 2. Redistributions in binary form must reproduce the above copyright 1.16 + * notice, this list of conditions and the following disclaimer in the 1.17 + * documentation and/or other materials provided with the distribution. 1.18 + * 1.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 1.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 1.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 1.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 1.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 1.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 1.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 1.29 + * POSSIBILITY OF SUCH DAMAGE. 1.30 + * 1.31 + */ 1.32 +package de.uapcore.lightpit; 1.33 + 1.34 +public abstract class Constants { 1.35 + public static final String JSP_PATH_PREFIX = "/WEB-INF/view/"; 1.36 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/src/java/de/uapcore/lightpit/HomeServlet.java Wed Mar 29 16:06:22 2017 +0200 2.3 @@ -0,0 +1,70 @@ 2.4 +/* 2.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 2.6 + * 2.7 + * Copyright 2017 Mike Becker. All rights reserved. 2.8 + * 2.9 + * Redistribution and use in source and binary forms, with or without 2.10 + * modification, are permitted provided that the following conditions are met: 2.11 + * 2.12 + * 1. Redistributions of source code must retain the above copyright 2.13 + * notice, this list of conditions and the following disclaimer. 2.14 + * 2.15 + * 2. Redistributions in binary form must reproduce the above copyright 2.16 + * notice, this list of conditions and the following disclaimer in the 2.17 + * documentation and/or other materials provided with the distribution. 2.18 + * 2.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 2.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 2.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2.29 + * POSSIBILITY OF SUCH DAMAGE. 2.30 + * 2.31 + */ 2.32 +package de.uapcore.lightpit; 2.33 + 2.34 +import java.io.IOException; 2.35 +import javax.servlet.RequestDispatcher; 2.36 +import javax.servlet.ServletContext; 2.37 +import javax.servlet.ServletException; 2.38 +import javax.servlet.http.HttpServlet; 2.39 +import javax.servlet.http.HttpServletRequest; 2.40 +import javax.servlet.http.HttpServletResponse; 2.41 + 2.42 +public class HomeServlet extends HttpServlet { 2.43 + 2.44 + private String jspPath(String filename) { 2.45 + return Constants.JSP_PATH_PREFIX + filename; 2.46 + } 2.47 + 2.48 + @Override 2.49 + protected void doGet(HttpServletRequest req, HttpServletResponse resp) 2.50 + throws ServletException, IOException { 2.51 + 2.52 + ServletContext ctx = getServletContext(); 2.53 + RequestDispatcher dispatcher = ctx.getRequestDispatcher(jspPath("home.jsp")); 2.54 + dispatcher.forward(req, resp); 2.55 + } 2.56 + 2.57 + @Override 2.58 + protected void doPost(HttpServletRequest req, HttpServletResponse resp) 2.59 + throws ServletException, IOException { 2.60 + resp.sendError(HttpServletResponse.SC_FORBIDDEN, 2.61 + "POST method not allowed for this Servlet."); 2.62 + } 2.63 + 2.64 + /** 2.65 + * Returns a short description of the servlet. 2.66 + * 2.67 + * @return a String containing servlet description 2.68 + */ 2.69 + @Override 2.70 + public String getServletInfo() { 2.71 + return "Processes requests for the LightPIT start page."; 2.72 + } 2.73 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/src/java/de/uapcore/lightpit/resources/home_localization.properties Wed Mar 29 16:06:22 2017 +0200 3.3 @@ -0,0 +1,24 @@ 3.4 +# Copyright 2017 Mike Becker. All rights reserved. 3.5 +# 3.6 +# Redistribution and use in source and binary forms, with or without 3.7 +# modification, are permitted provided that the following conditions are met: 3.8 +# 3.9 +# 1. Redistributions of source code must retain the above copyright 3.10 +# notice, this list of conditions and the following disclaimer. 3.11 +# 3.12 +# 2. Redistributions in binary form must reproduce the above copyright 3.13 +# notice, this list of conditions and the following disclaimer in the 3.14 +# documentation and/or other materials provided with the distribution. 3.15 +# 3.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 3.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 3.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 3.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 3.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 3.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 3.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 3.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 3.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3.26 + 3.27 +home.title = Start Page
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/src/java/de/uapcore/lightpit/resources/home_localization_de.properties Wed Mar 29 16:06:22 2017 +0200 4.3 @@ -0,0 +1,24 @@ 4.4 +# Copyright 2017 Mike Becker. All rights reserved. 4.5 +# 4.6 +# Redistribution and use in source and binary forms, with or without 4.7 +# modification, are permitted provided that the following conditions are met: 4.8 +# 4.9 +# 1. Redistributions of source code must retain the above copyright 4.10 +# notice, this list of conditions and the following disclaimer. 4.11 +# 4.12 +# 2. Redistributions in binary form must reproduce the above copyright 4.13 +# notice, this list of conditions and the following disclaimer in the 4.14 +# documentation and/or other materials provided with the distribution. 4.15 +# 4.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 4.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 4.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 4.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 4.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 4.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 4.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 4.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 4.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 4.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 4.26 + 4.27 +home.title = Startseite
5.1 --- a/web/WEB-INF/glassfish-web.xml Wed Mar 29 15:03:25 2017 +0200 5.2 +++ b/web/WEB-INF/glassfish-web.xml Wed Mar 29 16:06:22 2017 +0200 5.3 @@ -1,11 +1,11 @@ 5.4 <?xml version="1.0" encoding="UTF-8"?> 5.5 <!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd"> 5.6 <glassfish-web-app error-url=""> 5.7 - <context-root>/lightpit</context-root> 5.8 - <class-loader delegate="true"/> 5.9 - <jsp-config> 5.10 - <property name="keepgenerated" value="true"> 5.11 - <description>Keep a copy of the generated servlet class' java code.</description> 5.12 - </property> 5.13 - </jsp-config> 5.14 + <context-root>/lightpit</context-root> 5.15 + <class-loader delegate="true"/> 5.16 + <jsp-config> 5.17 + <property name="keepgenerated" value="true"> 5.18 + <description>Keep a copy of the generated servlet class' java code.</description> 5.19 + </property> 5.20 + </jsp-config> 5.21 </glassfish-web-app>
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/web/WEB-INF/view/home.jsp Wed Mar 29 16:06:22 2017 +0200 6.3 @@ -0,0 +1,43 @@ 6.4 +<%-- 6.5 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 6.6 + 6.7 +Copyright 2017 Mike Becker. All rights reserved. 6.8 + 6.9 +Redistribution and use in source and binary forms, with or without 6.10 +modification, are permitted provided that the following conditions are met: 6.11 + 6.12 +1. Redistributions of source code must retain the above copyright 6.13 +notice, this list of conditions and the following disclaimer. 6.14 + 6.15 +2. Redistributions in binary form must reproduce the above copyright 6.16 +notice, this list of conditions and the following disclaimer in the 6.17 +documentation and/or other materials provided with the distribution. 6.18 + 6.19 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 6.20 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 6.21 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 6.22 +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 6.23 +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 6.24 +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 6.25 +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 6.26 +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 6.27 +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 6.28 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 6.29 +--%> 6.30 +<%@page contentType="text/html" pageEncoding="UTF-8" 6.31 + trimDirectiveWhitespaces="true" %> 6.32 +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 6.33 + 6.34 +<fmt:setBundle basename="de.uapcore.lightpit.resources.home_localization" 6.35 + var="bundle" /> 6.36 + 6.37 +<!DOCTYPE html> 6.38 +<html> 6.39 + <head> 6.40 + <title>LightPIT - <fmt:message key="home.title" bundle="${bundle}" /></title> 6.41 + <meta charset="UTF-8"> 6.42 + </head> 6.43 + <body> 6.44 + <div>It will work, someday...</div> 6.45 + </body> 6.46 +</html>
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/web/WEB-INF/web.xml Wed Mar 29 16:06:22 2017 +0200 7.3 @@ -0,0 +1,17 @@ 7.4 +<?xml version="1.0" encoding="UTF-8"?> 7.5 +<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> 7.6 + <servlet> 7.7 + <servlet-name>HomeServlet</servlet-name> 7.8 + <servlet-class>de.uapcore.lightpit.HomeServlet</servlet-class> 7.9 + </servlet> 7.10 + <servlet-mapping> 7.11 + <servlet-name>HomeServlet</servlet-name> 7.12 + <url-pattern>/</url-pattern> 7.13 + <url-pattern>/home</url-pattern> 7.14 + </servlet-mapping> 7.15 + <session-config> 7.16 + <session-timeout> 7.17 + 30 7.18 + </session-timeout> 7.19 + </session-config> 7.20 +</web-app>
8.1 --- a/web/index.html Wed Mar 29 15:03:25 2017 +0200 8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 8.3 @@ -1,10 +0,0 @@ 8.4 -<!DOCTYPE html> 8.5 -<html> 8.6 - <head> 8.7 - <title>LightPIT - Start Page</title> 8.8 - <meta charset="UTF-8"> 8.9 - </head> 8.10 - <body> 8.11 - <div>It will work, someday...</div> 8.12 - </body> 8.13 -</html>