Sample app build adjustments to remove unwanted deps such as jsp-api, tidy up use of JSTL, make sure all are using servlet 2.5 etc.

This commit is contained in:
Luke Taylor
2010-08-19 22:41:51 +01:00
parent 1680807470
commit c37ca1c2a9
23 changed files with 86 additions and 71 deletions

View File

@@ -19,16 +19,18 @@
-->
</global-method-security>
<http pattern="/loggedout.jsp" security="none"/>
<http use-expressions="true">
<intercept-url pattern="/secure/extreme/**" access="hasRole('ROLE_SUPERVISOR')"/>
<intercept-url pattern="/secure/**" access="isAuthenticated()" />
<!-- Disable web URI authorization, as we're using <global-method-security> and have @Secured the services layer instead
<intercept-url pattern="/listAccounts.html" access="isRememberMe()" />
<intercept-url pattern="/post.html" access="hasRole('ROLE_TELLER')" />
-->
<!--
Allow all other requests. In a real application you should
adopt a whitelisting approach where access is not allowed by default
-->
<intercept-url pattern="/**" access="permitAll" />
<form-login />
<logout />
<logout logout-success-url="/loggedout.jsp"/>
<remember-me />
<!--
Uncomment to enable X509 client authentication support

View File

@@ -1,4 +1,4 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<h1>Accounts</h1>
@@ -14,23 +14,15 @@
</tr>
<c:forEach var="account" items="${accounts}">
<tr>
<td>${account.id}</td>
<td>${account.holder}</td>
<td>${account.balance}</td>
<td>${account.overdraft}</td>
<td>
<c:out value="${account.id}"/>
</td>
<td>
<c:out value="${account.holder}"/>
</td>
<td>
<c:out value="${account.balance}"/>
</td>
<td>
<c:out value="${account.overdraft}"/>
</td>
<td>
<a href="post.html?id=<c:out value="${account.id}"/>&amount=-20.00">-$20</a>
<a href="post.html?id=<c:out value="${account.id}"/>&amount=-5.00">-$5</a>
<a href="post.html?id=<c:out value="${account.id}"/>&amount=5.00">+$5</a>
<a href="post.html?id=<c:out value="${account.id}"/>&amount=20.00">+$20</a>
<a href="post.html?id=${account.id}&amp;amount=-20.00">-$20</a>
<a href="post.html?id=${account.id}&amp;amount=-5.00">-$5</a>
<a href="post.html?id=${account.id}&amp;amount=5.00">+$5</a>
<a href="post.html?id=${account.id}&amp;amount=20.00">+$20</a>
</td>
</tr>
</c:forEach>

View File

@@ -4,9 +4,9 @@
-
-->
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>Spring Security Tutorial Application</display-name>

View File

@@ -0,0 +1,22 @@
<%@page session="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
Cookie cookie = new Cookie("JSESSIONID", null);
cookie.setPath(request.getContextPath());
cookie.setMaxAge(0);
response.addCookie(cookie);
%>
<html>
<head>
<title>Logged Out</title>
</head>
<body>
<h2>Logged Out</h2>
<p>
You have been logged out. <a href="<c:url value='/'/>">Start again</a>.
</p>
</body>
</html>

View File

@@ -1,8 +1,10 @@
<%@page session="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>Session Timeout</title>
</head>
<body>
<h2>Invalid Session</h2>