shiro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lhazlew...@apache.org
Subject svn commit: r1138107 - /shiro/trunk/web/src/main/java/org/apache/shiro/web/filter/authc/LogoutFilter.java
Date Tue, 21 Jun 2011 17:52:44 GMT
Author: lhazlewood
Date: Tue Jun 21 17:52:44 2011
New Revision: 1138107

URL: http://svn.apache.org/viewvc?rev=1138107&view=rev
Log:
Added an intermediate getRedirectUrl(request,response) method to allow subclasses to dynamically
configure the redirectUrl if desired.  Default implementation returns getRedirectUrl() to
retain current behavior.

Modified:
    shiro/trunk/web/src/main/java/org/apache/shiro/web/filter/authc/LogoutFilter.java

Modified: shiro/trunk/web/src/main/java/org/apache/shiro/web/filter/authc/LogoutFilter.java
URL: http://svn.apache.org/viewvc/shiro/trunk/web/src/main/java/org/apache/shiro/web/filter/authc/LogoutFilter.java?rev=1138107&r1=1138106&r2=1138107&view=diff
==============================================================================
--- shiro/trunk/web/src/main/java/org/apache/shiro/web/filter/authc/LogoutFilter.java (original)
+++ shiro/trunk/web/src/main/java/org/apache/shiro/web/filter/authc/LogoutFilter.java Tue
Jun 21 17:52:44 2011
@@ -59,16 +59,30 @@ public class LogoutFilter extends Advice
     }
 
     /**
-     * Issues an HTTP redirect after subject logout.  This implementation calls
-     * {@code WebUtils.}{@link WebUtils#issueRedirect(javax.servlet.ServletRequest, javax.servlet.ServletResponse,
String) issueRedirect(request,response,redirectUrl)}
-     * using the configured {@link #getRedirectUrl()}.
+     * Issues an HTTP redirect after subject logout.  This implementation acquires the redirect
URL returned from
+     * {@link #getRedirectUrl(javax.servlet.ServletRequest, javax.servlet.ServletResponse)}
and then calls
+     * {@code WebUtils.}{@link WebUtils#issueRedirect(javax.servlet.ServletRequest, javax.servlet.ServletResponse,
String) issueRedirect(request,response,redirectUrl)}.
      *
      * @param request  the incoming Servlet request
      * @param response the outgoing Servlet response
      * @throws Exception if there is any error.
      */
     protected void issueRedirect(ServletRequest request, ServletResponse response) throws
Exception {
-        WebUtils.issueRedirect(request, response, getRedirectUrl());
+        String redirectUrl = getRedirectUrl(request, response);
+        WebUtils.issueRedirect(request, response, redirectUrl);
+    }
+
+    /**
+     * Returns the redirect URL to send the user after logout.  This default implementation
returns the static
+     * configured {@link #getRedirectUrl() redirectUrl} property, but this method may be
overridden by subclasses
+     * to dynamically construct the URL if necessary.
+     *
+     * @param request the incoming Servlet request
+     * @param response the outgoing ServletResponse
+     * @return the redirect URL to send the user after logout.
+     */
+    protected String getRedirectUrl(ServletRequest request, ServletResponse response) {
+        return getRedirectUrl();
     }
 
     /**



Mime
View raw message