com.sdm.quasar.client.jsf.dialog
Class DefaultDialogParameterHandler

java.lang.Object
  extended bycom.sdm.quasar.client.jsf.dialog.DefaultDialogParameterHandler
All Implemented Interfaces:
DialogParameterHandler
Direct Known Subclasses:
ShowcaseDialogParameterHandler

public class DefaultDialogParameterHandler
extends java.lang.Object
implements DialogParameterHandler

Default implementation of the DialogParameterHandler interface

Author:
Martin Haft , sd&m AG, Carsten Lucke , sd&m AG

Field Summary
 
Fields inherited from interface com.sdm.quasar.client.jsf.dialog.DialogParameterHandler
DIALOG_PARAMETER_HANDLER_CONFIG_KEY
 
Constructor Summary
DefaultDialogParameterHandler()
           
 
Method Summary
 boolean checkIsAjaxRequest(HttpServletRequest request, ServletResponse response)
          The indication of an AJAX request depends on the concrete ajax framework.
 boolean handleInvalidSequenceNumber(HttpServletRequest request, ServletResponse response, DialogControl sessionDialogControl, DialogInstanceId dialogInstanceId, java.lang.String webPageUrl, DialogParameterHandlerCallback callback)
          The sequence number is invalid: the request was from a dialog in an old state or a double submit of the same request.
 boolean handleMissingDialogParameters(HttpServletRequest request, ServletResponse response, DialogControl sessionDialogControl, DialogParameterHandlerCallback callback)
          This method is called when the dialog parameters, i.e. the dialog id or the dialog instance id, are incomplete. This may be a request to enter the application, a request from a bookmark or a request from a dialog that is closed and should not be recreated automatically.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDialogParameterHandler

public DefaultDialogParameterHandler()
Method Detail

handleMissingDialogParameters

public boolean handleMissingDialogParameters(HttpServletRequest request,
                                             ServletResponse response,
                                             DialogControl sessionDialogControl,
                                             DialogParameterHandlerCallback callback)
This method is called when the dialog parameters, i.e. the dialog id or the dialog instance id, are incomplete. This may be a request to enter the application, a request from a bookmark or a request from a dialog that is closed and should not be recreated automatically.

Specified by:
handleMissingDialogParameters in interface DialogParameterHandler
Returns:
true if the response is completed e.g. due to a redirect to a determined dialog. The servlet filter chain will not be processed further, but the redirect will be performed immediately.
See Also:
When no dialog context could be reconstructed we bypass as default. Overwrite this method for three cases
  • direct entry: define the URLs your application will be entered and create corresponding dialog
  • bookmarkable dialogs: reconize bookmarked urls, if this is an url of an bookmarkable dialog, create this dialog and pass parameters. Caution: If bookmarked dialog is a subdialog you have to reconstruct all super dialogs as well! Or redirect to an entry page.
  • back navigation to a closed dialog: if the url is from the browser history and the corresponding dialog is closed you may create a new instance of this dialog or show an error dialog instead.

handleInvalidSequenceNumber

public boolean handleInvalidSequenceNumber(HttpServletRequest request,
                                           ServletResponse response,
                                           DialogControl sessionDialogControl,
                                           DialogInstanceId dialogInstanceId,
                                           java.lang.String webPageUrl,
                                           DialogParameterHandlerCallback callback)
The sequence number is invalid: the request was from a dialog in an old state or a double submit of the same request. Thus we throw an Exception to avoid double submit or request based on old data. You can override this to display your own dialog. For example see the implementation of this method in the showcase. If you do not use sequence numbers, just return.

Specified by:
handleInvalidSequenceNumber in interface DialogParameterHandler
Parameters:
dialogInstanceId - DialogInstanceId of the dialog that is out of sequence
webPageUrl - an URL for the corresponding dialog in its actual state
Returns:
true if the response is completed e.g. due to a redirect to a determined dialog. The servlet filter chain will not be processed further, but the redirect will be performed immediately.
See Also:
com.sdm.quasar.client.jsf.dialog.DialogParameterHandler#handleInvalidSequenceNumber(ServiceProvider, DialogRequestParameters)

checkIsAjaxRequest

public boolean checkIsAjaxRequest(HttpServletRequest request,
                                  ServletResponse response)
Description copied from interface: DialogParameterHandler
The indication of an AJAX request depends on the concrete ajax framework. Please take a look at the request parameters to tell us if we are dealing with an AJAX request.

Specified by:
checkIsAjaxRequest in interface DialogParameterHandler
Returns:
true, if the given request is an AJAX request.