Odhlašování pomocí servletu.
authorFrantišek Kučera <franta-hg@frantovo.cz>
Tue, 19 Jul 2011 15:20:47 +0200
changeset 187e7b3ef7aaef4
parent 186 b0f7d9ab4a07
child 188 74d06a8a4948
Odhlašování pomocí servletu.
java/nekurak.net-web/src/java/cz/frantovo/nekurak/servlet/Odhlaseni.java
java/nekurak.net-web/web/WEB-INF/web.xml
java/nekurak.net-web/web/index.jsp
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/java/nekurak.net-web/src/java/cz/frantovo/nekurak/servlet/Odhlaseni.java	Tue Jul 19 15:20:47 2011 +0200
     1.3 @@ -0,0 +1,22 @@
     1.4 +package cz.frantovo.nekurak.servlet;
     1.5 +
     1.6 +import java.io.IOException;
     1.7 +import javax.servlet.ServletException;
     1.8 +import javax.servlet.http.HttpServletRequest;
     1.9 +import javax.servlet.http.HttpServletResponse;
    1.10 +
    1.11 +/**
    1.12 + *
    1.13 + * @author fiki
    1.14 + */
    1.15 +public class Odhlaseni extends SuperServlet {
    1.16 +
    1.17 +	@Override
    1.18 +	protected void doGet(HttpServletRequest požadavek, HttpServletResponse odpověď) throws ServletException, IOException {
    1.19 +		požadavek.logout();
    1.20 +		super.doGet(požadavek, odpověď);
    1.21 +		zpracujJSP("odhlášení-dokončeno.jsp", požadavek, odpověď);
    1.22 +	}
    1.23 +
    1.24 +	
    1.25 +}
     2.1 --- a/java/nekurak.net-web/web/WEB-INF/web.xml	Fri Jul 15 22:25:39 2011 +0200
     2.2 +++ b/java/nekurak.net-web/web/WEB-INF/web.xml	Tue Jul 19 15:20:47 2011 +0200
     2.3 @@ -62,6 +62,16 @@
     2.4  		<servlet-name>komentare</servlet-name>
     2.5  		<servlet-class>cz.frantovo.nekurak.servlet.Komentare</servlet-class>
     2.6  	</servlet>
     2.7 +	<servlet>
     2.8 +		<description>Přihlašovací formulář</description>
     2.9 +		<servlet-name>prihlaseni</servlet-name>
    2.10 +		<jsp-file>/WEB-INF/casti/prihlaseni.jsp</jsp-file>
    2.11 +	</servlet>
    2.12 +	<servlet>
    2.13 +		<description>Odhlášení uživatele</description>
    2.14 +		<servlet-name>odhlaseni</servlet-name>
    2.15 +		<servlet-class>cz.frantovo.nekurak.servlet.Odhlaseni</servlet-class>
    2.16 +	</servlet>
    2.17      <!-- </definiceServletů> -->
    2.18      <!-- <mapováníServletů> -->
    2.19  	<servlet-mapping>
    2.20 @@ -89,6 +99,15 @@
    2.21  		<servlet-name>komentare</servlet-name>
    2.22  		<url-pattern>/komentare</url-pattern>
    2.23  	</servlet-mapping>
    2.24 +	<servlet-mapping>
    2.25 +		<servlet-name>prihlaseni</servlet-name>
    2.26 +		<url-pattern>/prihlaseni</url-pattern>
    2.27 +		<url-pattern>/prihlaseni-chyba</url-pattern>		
    2.28 +	</servlet-mapping>
    2.29 +	<servlet-mapping>
    2.30 +		<servlet-name>odhlaseni</servlet-name>
    2.31 +		<url-pattern>/odhlaseni</url-pattern>
    2.32 +	</servlet-mapping>
    2.33      <!-- </mapováníServletů> -->
    2.34  	<context-param>
    2.35          <!-- Pro případ, že chybí hlavička „Accept-language“ v HTTP požadavku -->
    2.36 @@ -103,21 +122,12 @@
    2.37  	<security-role>
    2.38  		<role-name>opravneny</role-name>
    2.39  	</security-role>
    2.40 -	<security-constraint>
    2.41 -		<web-resource-collection>
    2.42 -			<web-resource-name>Správa Nekuřák.net</web-resource-name>
    2.43 -			<url-pattern>/sprava/*</url-pattern>
    2.44 -		</web-resource-collection>
    2.45 -		<auth-constraint>
    2.46 -			<role-name>opravneny</role-name>
    2.47 -		</auth-constraint>
    2.48 -	</security-constraint>
    2.49  	<login-config>
    2.50  		<auth-method>FORM</auth-method>
    2.51  		<realm-name>nekurakNET</realm-name>
    2.52  		<form-login-config>
    2.53 -			<form-login-page>/?akce=prihlaseni</form-login-page>
    2.54 -			<form-error-page>/?akce=prihlaseni&amp;chyba=ano</form-error-page>
    2.55 +			<form-login-page>/prihlaseni</form-login-page>
    2.56 +			<form-error-page>/prihlaseni-chyba</form-error-page>
    2.57  		</form-login-config>
    2.58  	</login-config>
    2.59      <!--  </zabezpečení> -->
     3.1 --- a/java/nekurak.net-web/web/index.jsp	Fri Jul 15 22:25:39 2011 +0200
     3.2 +++ b/java/nekurak.net-web/web/index.jsp	Tue Jul 19 15:20:47 2011 +0200
     3.3 @@ -23,16 +23,10 @@
     3.4  		</c:when>
     3.5  		<c:when test="${param.akce == 'registrovatUzivatele'}">
     3.6  			<jsp:include page="/WEB-INF/casti/registrovatUzivatele.jsp" flush="false"/>
     3.7 -		</c:when>
     3.8 -		<c:when test="${param.akce == 'prihlaseni'}">
     3.9 -			<jsp:include page="/WEB-INF/casti/prihlaseni.jsp" flush="false"/>
    3.10 -		</c:when>
    3.11 +		</c:when>		
    3.12  		<c:when test="${param.akce == 'odeslatKomentar'}">
    3.13  			<jsp:include page="/WEB-INF/casti/odeslatKomentar.jsp" flush="false"/>
    3.14 -		</c:when>
    3.15 -		<c:when test="${param.akce == 'chat'}">
    3.16 -			<jsp:include page="/WEB-INF/casti/chat.jsp" flush="false"/>
    3.17 -		</c:when>
    3.18 +		</c:when>		
    3.19  		<c:otherwise>
    3.20  			<jsp:include page="/WEB-INF/casti/uvod.jsp" flush="false"/>
    3.21  		</c:otherwise>