com.arsdigita.web
Class RedirectSignal

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Error
          extended bycom.arsdigita.web.TransactionSignal
              extended bycom.arsdigita.web.RedirectSignal
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
LoginSignal, ReturnSignal

public class RedirectSignal
extends com.arsdigita.web.TransactionSignal

A signal that requests to commit or abort the current transaction and to send a redirect to a new URL. BaseServlet traps this signal when it is thrown and finishes the transaction before it sends the redirect to the response. This way the client cannot see state inconsistent with work performed in the previous request.

RedirectSignals are usually sent after doing work on behalf of the user:

 private final void saveUserSettings(final HttpServletRequest sreq) {
     m_user.setGivenName("Gibbon");
     m_user.setFamilyName("Homily");

     m_user.save();

     // The boolean argument true signifies that we want to commit
     // the transaction.
     throw new RedirectSignal(URL.here(sreq, "/user-detail.jsp"), true);
 }
 

Version:
$Id: //core-platform/dev/src/com/arsdigita/web/RedirectSignal.java#8 $
Author:
Justin Ross <jross@redhat.com>
See Also:
BaseServlet, LoginSignal, ReturnSignal, Serialized Form

Field Summary
static String versionId
           
 
Constructor Summary
RedirectSignal(String url, boolean isCommitRequested)
           
RedirectSignal(URL url, boolean isCommitRequested)
           
 
Method Summary
 String getDestinationURL()
           
 boolean isCommitRequested()
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

RedirectSignal

public RedirectSignal(String url,
                      boolean isCommitRequested)

RedirectSignal

public RedirectSignal(URL url,
                      boolean isCommitRequested)
Method Detail

getDestinationURL

public final String getDestinationURL()

isCommitRequested

public final boolean isCommitRequested()


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC