src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java

Sun, 10 May 2020 10:11:10 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 10 May 2020 10:11:10 +0200
changeset 35
4fa33bfa8fb9
parent 34
824d4042c857
child 36
0f4f8f255c32
permissions
-rw-r--r--

fixes wrong location of log4j2.properties

7
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 /*
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
3 *
24
8137ec335416 updates copyright header
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
4 * Copyright 2018 Mike Becker. All rights reserved.
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
5 *
7
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 *
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11 *
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15 *
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
27 *
7
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
28 */
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
29 package de.uapcore.lightpit;
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
30
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
31 import org.slf4j.Logger;
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
32 import org.slf4j.LoggerFactory;
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
33
7
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
34 import javax.servlet.ServletException;
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
35 import javax.servlet.http.HttpServlet;
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
36 import javax.servlet.http.HttpServletRequest;
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
37 import javax.servlet.http.HttpServletResponse;
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
38 import javax.servlet.http.HttpSession;
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
39 import java.io.IOException;
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
40 import java.lang.reflect.Method;
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
41 import java.lang.reflect.Modifier;
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
42 import java.util.*;
7
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
43
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
44 /**
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
45 * A special implementation of a HTTPServlet which is focused on implementing
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
46 * the necessary functionality for {@link LightPITModule}s.
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
47 */
9
20a9b2bc9063 makes LightPITServlet abstract
Mike Becker <universe@uap-core.de>
parents: 7
diff changeset
48 public abstract class AbstractLightPITServlet extends HttpServlet {
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
49
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
50 private static final Logger LOG = LoggerFactory.getLogger(AbstractLightPITServlet.class);
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
51
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
52 private static final String HTML_FULL_DISPATCHER = Functions.jspPath("html_full");
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
53
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
54 /**
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
55 * Store a reference to the annotation for quicker access.
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
56 */
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
57 private LightPITModule moduleInfo = null;
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
58
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
59 /**
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
60 * The EL proxy is necessary, because the EL resolver cannot handle annotation properties.
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
61 */
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
62 private LightPITModule.ELProxy moduleInfoELProxy = null;
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
63
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
64
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
65 @FunctionalInterface
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
66 private interface HandlerMethod {
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
67 ResponseType apply(HttpServletRequest t, HttpServletResponse u) throws IOException;
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
68 }
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
69
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
70 /**
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
71 * Invocation mapping gathered from the {@link RequestMapping} annotations.
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
72 * <p>
18
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 17
diff changeset
73 * Paths in this map must always start with a leading slash, although
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 17
diff changeset
74 * the specification in the annotation must not start with a leading slash.
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
75 * <p>
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
76 * The reason for this is the different handling of empty paths in
18
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 17
diff changeset
77 * {@link HttpServletRequest#getPathInfo()}.
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
78 */
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
79 private final Map<HttpMethod, Map<String, HandlerMethod>> mappings = new HashMap<>();
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
80
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
81 /**
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
82 * Gives implementing modules access to the {@link ModuleManager}.
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
83 *
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
84 * @return the module manager
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
85 */
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
86 protected final ModuleManager getModuleManager() {
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
87 return (ModuleManager) getServletContext().getAttribute(ModuleManager.SC_ATTR_NAME);
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
88 }
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
89
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
90 /**
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
91 * Returns the annotated module information.
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
92 *
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
93 * @return the module annotation
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
94 */
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
95 public final LightPITModule getModuleInfo() {
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
96 return moduleInfo;
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
97 }
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
98
17
d1036b776eee adds getter for the database facade to the abstract servlet
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
99 /**
d1036b776eee adds getter for the database facade to the abstract servlet
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
100 * Gives implementing modules access to the {@link DatabaseFacade}.
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
101 *
17
d1036b776eee adds getter for the database facade to the abstract servlet
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
102 * @return the database facade
d1036b776eee adds getter for the database facade to the abstract servlet
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
103 */
d1036b776eee adds getter for the database facade to the abstract servlet
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
104 protected final DatabaseFacade getDatabaseFacade() {
d1036b776eee adds getter for the database facade to the abstract servlet
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
105 return (DatabaseFacade) getServletContext().getAttribute(DatabaseFacade.SC_ATTR_NAME);
d1036b776eee adds getter for the database facade to the abstract servlet
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
106 }
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
107
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
108 private ResponseType invokeMapping(Method method, HttpServletRequest req, HttpServletResponse resp) throws IOException {
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
109 try {
14
2b270c714678 changed logger implementation to log4j2
Mike Becker <universe@uap-core.de>
parents: 13
diff changeset
110 LOG.trace("invoke {}#{}", method.getDeclaringClass().getName(), method.getName());
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
111 return (ResponseType) method.invoke(this, req, resp);
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
112 } catch (ReflectiveOperationException | ClassCastException ex) {
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
113 LOG.error(String.format("invocation of method %s failed", method.getName()), ex);
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
114 resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
115 return ResponseType.NONE;
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
116 }
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
117 }
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
118
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
119 @Override
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
120 public void init() throws ServletException {
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
121 moduleInfo = this.getClass().getAnnotation(LightPITModule.class);
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
122 moduleInfoELProxy = moduleInfo == null ? null : LightPITModule.ELProxy.convert(moduleInfo);
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
123
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
124 if (moduleInfo != null) {
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
125 scanForRequestMappings();
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
126 }
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
127
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
128 LOG.trace("{} initialized", getServletName());
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
129 }
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
130
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
131 private void scanForRequestMappings() {
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
132 try {
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
133 Method[] methods = getClass().getDeclaredMethods();
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
134 for (Method method : methods) {
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
135 Optional<RequestMapping> mapping = Optional.ofNullable(method.getAnnotation(RequestMapping.class));
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
136 if (mapping.isPresent()) {
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
137 if (!Modifier.isPublic(method.getModifiers())) {
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
138 LOG.warn("{} is annotated with {} but is not public",
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
139 method.getName(), RequestMapping.class.getSimpleName()
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
140 );
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
141 continue;
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
142 }
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
143 if (Modifier.isAbstract(method.getModifiers())) {
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
144 LOG.warn("{} is annotated with {} but is abstract",
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
145 method.getName(), RequestMapping.class.getSimpleName()
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
146 );
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
147 continue;
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
148 }
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
149 if (!ResponseType.class.isAssignableFrom(method.getReturnType())) {
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
150 LOG.warn("{} is annotated with {} but has the wrong return type - 'ResponseType' required",
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
151 method.getName(), RequestMapping.class.getSimpleName()
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
152 );
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
153 continue;
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
154 }
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
155
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
156 Class<?>[] params = method.getParameterTypes();
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
157 if (params.length == 2
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
158 && HttpServletRequest.class.isAssignableFrom(params[0])
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
159 && HttpServletResponse.class.isAssignableFrom(params[1])) {
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
160
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
161 final String requestPath = "/" + mapping.get().requestPath();
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
162
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
163 if (mappings.computeIfAbsent(mapping.get().method(), k -> new HashMap<>()).
18
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 17
diff changeset
164 putIfAbsent(requestPath,
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
165 (req, resp) -> invokeMapping(method, req, resp)) != null) {
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
166 LOG.warn("{} {} has multiple mappings",
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
167 mapping.get().method(),
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
168 mapping.get().requestPath()
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
169 );
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
170 }
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
171
22
5a91fb7067af minor changes to logging output
Mike Becker <universe@uap-core.de>
parents: 21
diff changeset
172 LOG.debug("{} {} maps to {}::{}",
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
173 mapping.get().method(),
18
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 17
diff changeset
174 requestPath,
22
5a91fb7067af minor changes to logging output
Mike Becker <universe@uap-core.de>
parents: 21
diff changeset
175 getClass().getSimpleName(),
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
176 method.getName()
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
177 );
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
178 } else {
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
179 LOG.warn("{} is annotated with {} but has the wrong parameters - (HttpServletRequest,HttpServletResponse) required",
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
180 method.getName(), RequestMapping.class.getSimpleName()
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
181 );
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
182 }
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
183 }
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
184 }
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
185 } catch (SecurityException ex) {
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
186 LOG.error("Scan for request mappings on declared methods failed.", ex);
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
187 }
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
188 }
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
189
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
190 @Override
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
191 public void destroy() {
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
192 mappings.clear();
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
193 LOG.trace("{} destroyed", getServletName());
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
194 }
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
195
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
196 /**
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
197 * Sets the name of the dynamic fragment.
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
198 * <p>
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
199 * It is sufficient to specify the name without any extension. The extension
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
200 * is added automatically if not specified.
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
201 * <p>
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
202 * The fragment must be located in the dynamic fragments folder.
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
203 *
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
204 * @param req the servlet request object
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
205 * @param fragmentName the name of the fragment
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
206 * @see Constants#DYN_FRAGMENT_PATH_PREFIX
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
207 */
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
208 public void setDynamicFragment(HttpServletRequest req, String fragmentName) {
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
209 req.setAttribute(Constants.REQ_ATTR_FRAGMENT, Functions.dynFragmentPath(fragmentName));
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
210 }
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
211
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
212 /**
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
213 * Specifies the name of an additional stylesheet used by the module.
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
214 * <p>
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
215 * Setting an additional stylesheet is optional, but quite common for HTML
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
216 * output.
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
217 * <p>
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
218 * It is sufficient to specify the name without any extension. The extension
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
219 * is added automatically if not specified.
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
220 *
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
221 * @param req the servlet request object
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
222 * @param stylesheet the name of the stylesheet
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
223 */
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
224 public void setStylesheet(HttpServletRequest req, String stylesheet) {
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
225 req.setAttribute(Constants.REQ_ATTR_STYLESHEET, Functions.enforceExt(stylesheet, ".css"));
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
226 }
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
227
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
228 private void forwardToFullView(HttpServletRequest req, HttpServletResponse resp)
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
229 throws IOException, ServletException {
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
230
27
1f2a96efa69f removes caching of main menu
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
231 req.setAttribute(Constants.REQ_ATTR_MENU, getModuleManager().getMainMenu(getDatabaseFacade()));
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
232 req.getRequestDispatcher(HTML_FULL_DISPATCHER).forward(req, resp);
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
233 }
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
234
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
235 private Optional<HandlerMethod> findMapping(HttpMethod method, HttpServletRequest req) {
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
236 return Optional.ofNullable(mappings.get(method)).map(
18
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 17
diff changeset
237 (rm) -> rm.get(Optional.ofNullable(req.getPathInfo()).orElse("/"))
11
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
238 );
737ab27e37b3 implements simple request mapper
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
239 }
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
240
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
241 private void forwardAsSpecified(ResponseType type, HttpServletRequest req, HttpServletResponse resp)
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
242 throws ServletException, IOException {
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
243 switch (type) {
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
244 case NONE:
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
245 return;
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
246 case HTML_FULL:
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
247 forwardToFullView(req, resp);
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
248 return;
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
249 // TODO: implement remaining response types
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
250 default:
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
251 throw new AssertionError("ResponseType switch is not exhaustive - this is a bug!");
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
252 }
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
253 }
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
254
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
255 private void doProcess(HttpMethod method, HttpServletRequest req, HttpServletResponse resp)
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
256 throws ServletException, IOException {
27
1f2a96efa69f removes caching of main menu
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
257
20
bd1a76c91d5b module synchronization with database
Mike Becker <universe@uap-core.de>
parents: 18
diff changeset
258 // Synchronize module information with database
bd1a76c91d5b module synchronization with database
Mike Becker <universe@uap-core.de>
parents: 18
diff changeset
259 getModuleManager().syncWithDatabase(getDatabaseFacade());
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
260
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
261 // choose the requested language as session language (if available) or fall back to english, otherwise
20
bd1a76c91d5b module synchronization with database
Mike Becker <universe@uap-core.de>
parents: 18
diff changeset
262 HttpSession session = req.getSession();
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
263 if (session.getAttribute(Constants.SESSION_ATTR_LANGUAGE) == null) {
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
264 Optional<List<String>> availableLanguages = Functions.availableLanguages(getServletContext()).map(Arrays::asList);
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
265 Optional<Locale> reqLocale = Optional.of(req.getLocale());
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
266 Locale sessionLocale = reqLocale.filter((rl) -> availableLanguages.map((al) -> al.contains(rl.getLanguage())).orElse(false)).orElse(Locale.ENGLISH);
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
267 session.setAttribute(Constants.SESSION_ATTR_LANGUAGE, sessionLocale);
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
268 LOG.debug("Setting language for new session {}: {}", session.getId(), sessionLocale.getDisplayLanguage());
14
2b270c714678 changed logger implementation to log4j2
Mike Becker <universe@uap-core.de>
parents: 13
diff changeset
269 } else {
15
bb594abac796 language selector completed
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
270 Locale sessionLocale = (Locale) session.getAttribute(Constants.SESSION_ATTR_LANGUAGE);
bb594abac796 language selector completed
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
271 resp.setLocale(sessionLocale);
bb594abac796 language selector completed
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
272 LOG.trace("Continuing session {} with language {}", session.getId(), sessionLocale);
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
273 }
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
274
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
275 // set some internal request attributes
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
276 req.setAttribute(Constants.REQ_ATTR_PATH, Functions.fullPath(req));
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents: 12
diff changeset
277 req.setAttribute(Constants.REQ_ATTR_MODULE_CLASSNAME, this.getClass().getName());
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
278 Optional.ofNullable(moduleInfoELProxy).ifPresent((proxy) -> req.setAttribute(Constants.REQ_ATTR_MODULE_INFO, proxy));
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
279
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
280
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
281 // call the handler, if available, or send an HTTP 404 error
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
282 Optional<HandlerMethod> mapping = findMapping(method, req);
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
283 if (mapping.isPresent()) {
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
284 forwardAsSpecified(mapping.get().apply(req, resp), req, resp);
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
285 } else {
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
286 resp.sendError(HttpServletResponse.SC_NOT_FOUND);
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
287 }
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
288 }
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
289
7
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
290 @Override
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
291 protected final void doGet(HttpServletRequest req, HttpServletResponse resp)
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
292 throws ServletException, IOException {
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
293 doProcess(HttpMethod.GET, req, resp);
7
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
294 }
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
295
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
296 @Override
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
297 protected final void doPost(HttpServletRequest req, HttpServletResponse resp)
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
298 throws ServletException, IOException {
12
005d27918b57 implements ResponseTypes
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
299 doProcess(HttpMethod.POST, req, resp);
7
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
300 }
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents:
diff changeset
301 }

mercurial