Commit a8656157f5435d8ff595222e161741e033412c7e

Authored by Julien Cartigny
1 parent 6148d351

Support for bootstrap and jquery via webjars

src/main/java/fr/plil/sio/web/mvc/ApplicationSecurityConfiguration.java
... ... @@ -27,6 +27,7 @@ public class ApplicationSecurityConfiguration extends WebSecurityConfigurerAdapt
27 27 protected void configure(HttpSecurity http) throws Exception {
28 28 http
29 29 .authorizeRequests()
  30 + .antMatchers("/webjars/**").permitAll()
30 31 .anyRequest().authenticated()
31 32 .and()
32 33 .formLogin()
... ...
src/main/webapp/WEB-INF/pages/footer.jsp 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +<script src="/webjars/bootstrap/js/bootstrap.min.js"></script>
  2 +<script src="/webjars/jquery/jquery.min.js"></script>
  3 +</body>
  4 +</html>
... ...
src/main/webapp/WEB-INF/pages/header.jsp 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +<!DOCTYPE html>
  2 +<html lang="en">
  3 +<head>
  4 + <meta charset="utf-8">
  5 + <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6 + <meta name="viewport" content="width=device-width, initial-scale=1">
  7 + <title>Title</title>
  8 +
  9 + <link href="/webjars/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
  10 +</head>
... ...
src/main/webapp/WEB-INF/pages/login.jsp
1 1 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
2 2 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
3   -<html>
4   -<head>
5   - <title>Title</title>
6   -</head>
7   -<body>
  3 +<jsp:include page="header.jsp"/>
8 4 <c:url value="/login" var="loginUrl"/>
9 5 <form action="${loginUrl}" method="post">
10 6 <b><c:out value="${message}"></c:out></b>
... ... @@ -21,5 +17,4 @@
21 17 value="${_csrf.token}"/>
22 18 <button type="submit" class="btn">Log in</button>
23 19 </form>
24   -</body>
25   -</html>
  20 +<jsp:include page="footer.jsp"/>
26 21 \ No newline at end of file
... ...
src/main/webapp/WEB-INF/pages/newUser.jsp
1 1 <%@ page contentType="text/html" pageEncoding="UTF-8" %>
2 2 <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
3 3 <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
4   -
5   -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
6   - "http://www.w3.org/TR/html4/strict.dtd">
7   -
8   -<html>
9   - <head>
10   - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
11   - <title><spring:message code="new.user.page.title"/></title>
12   - </head>
13   - <body>
  4 +<jsp:include page="header.jsp"/>
14 5 <h1><spring:message code="new.user.main.header"/></h1>
15 6 <form:form commandName="userForm" method="POST">
16 7 <table>
... ... @@ -32,5 +23,4 @@
32 23 </tr>
33 24 </table>
34 25 </form:form>
35   - </body>
36   -</html>
  26 +<jsp:include page="footer.jsp"/>
37 27 \ No newline at end of file
... ...
src/main/webapp/WEB-INF/pages/viewUsers.jsp
1 1 <%@ page contentType="text/html" pageEncoding="UTF-8" %>
2 2 <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
3 3 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
4   -
5   -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
6   - "http://www.w3.org/TR/html4/strict.dtd">
7   -
8   -<html>
9   - <head>
10   - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
11   - <title><spring:message code="view.users.page.title"/></title>
12   - </head>
13   - <body>
  4 +<jsp:include page="header.jsp"/>
14 5 <h1><spring:message code="view.users.main.header"/></h1>
15 6  
16 7 <h4><spring:message code="view.users.greetings"/> ${userSession.username} !</h4>
... ... @@ -35,5 +26,4 @@
35 26 <li><a href="login?logout"><spring:message code="view.users.main.logout"/></a></li>
36 27 </ul>
37 28  
38   -</body>
39   -</html>
  29 +<jsp:include page="footer.jsp"/>
40 30 \ No newline at end of file
... ...