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

changeset 163
a5b9632729b6
parent 160
e2d09cf3fb96
child 167
3f30adba1c63
equal deleted inserted replaced
162:2adc8623dd89 163:a5b9632729b6
42 import java.lang.reflect.*; 42 import java.lang.reflect.*;
43 import java.sql.Connection; 43 import java.sql.Connection;
44 import java.sql.SQLException; 44 import java.sql.SQLException;
45 import java.util.*; 45 import java.util.*;
46 import java.util.function.Function; 46 import java.util.function.Function;
47 import java.util.stream.Collectors;
47 48
48 /** 49 /**
49 * A special implementation of a HTTPServlet which is focused on implementing 50 * A special implementation of a HTTPServlet which is focused on implementing
50 * the necessary functionality for LightPIT pages. 51 * the necessary functionality for LightPIT pages.
51 */ 52 */
263 } 264 }
264 req.setAttribute(Constants.REQ_ATTR_REDIRECT_LOCATION, location); 265 req.setAttribute(Constants.REQ_ATTR_REDIRECT_LOCATION, location);
265 } 266 }
266 267
267 /** 268 /**
268 * Specifies the name of an additional stylesheet used by the module. 269 * Specifies the names of additional stylesheets used by this Servlet.
269 * <p>
270 * Setting an additional stylesheet is optional, but quite common for HTML
271 * output.
272 * <p> 270 * <p>
273 * It is sufficient to specify the name without any extension. The extension 271 * It is sufficient to specify the name without any extension. The extension
274 * is added automatically if not specified. 272 * is added automatically if not specified.
275 * 273 *
276 * @param req the servlet request object 274 * @param req the servlet request object
277 * @param stylesheet the name of the stylesheet 275 * @param stylesheets the names of the stylesheets
278 */ 276 */
279 public void setStylesheet(HttpServletRequest req, String stylesheet) { 277 public void setStylesheet(HttpServletRequest req, String ... stylesheets) {
280 req.setAttribute(Constants.REQ_ATTR_STYLESHEET, enforceExt(stylesheet, ".css")); 278 req.setAttribute(Constants.REQ_ATTR_STYLESHEET, Arrays
279 .stream(stylesheets)
280 .map(s -> enforceExt(s, ".css"))
281 .collect(Collectors.toUnmodifiableList()));
281 } 282 }
282 283
283 /** 284 /**
284 * Sets the view model object. 285 * Sets the view model object.
285 * The type must match the expected type in the JSP file. 286 * The type must match the expected type in the JSP file.

mercurial