Issue Details (XML | Word | Printable)

Key: SHALE-337
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Craig McClanahan
Reporter: sean schofield
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Shale

Unable to use redirects with dialogs

Created: 16/Nov/06 11:06 PM   Updated: 23/Jan/07 04:40 PM
Return to search
Component/s: Dialog
Affects Version/s: 1.0.4-SNAPSHOT
Fix Version/s: 1.0.4


 Description  « Hide
I'm currently using mod_proxy with Apache 2.x and Tomcat 5.5. Unfortunately I can't start a dialog when doing proxies b/c BasicDialogContext treats all view state transitions as forwards. This ends up confusing my Tomcat server. It would be better if we could specify a <redirect/> option in the view state just like you can with regular JSF navigation outcomes.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Craig McClanahan made changes - 18/Nov/06 04:11 AM
Field Original Value New Value
Assignee Craig McClanahan [ craigmcc ]
Repository Revision Date User Message
ASF #476437 Sat Nov 18 04:35:21 UTC 2006 craigmcc Make it possible to navigate via redirects in the shale-dialog-basic
implementation. Because we could no longer rely on passing the dialog id
via the JSF saved state, it is passed (transparently) as a request parameter
in this scenario.

Thanks to Sean Schofield for the suggestion (SHALE-337).
Files Changed
MODIFY /shale/framework/trunk/shale-dialog/src/main/java/org/apache/shale/dialog/Constants.java
MODIFY /shale/framework/trunk/shale-dialog-basic/src/main/java/org/apache/shale/dialog/basic/BasicDialogContext.java
MODIFY /shale/framework/trunk/shale-dialog
MODIFY /shale/framework/trunk/shale-dialog/src/main/java/org/apache/shale/dialog/faces/DialogPhaseListener.java
MODIFY /shale/framework/trunk/shale-apps/shale-test-dialog-basic
MODIFY /shale/framework/trunk/shale-dialog-basic/src/main/java/org/apache/shale/dialog/basic/model/ViewState.java
MODIFY /shale/framework/trunk/shale-dialog-basic/src/main/java/org/apache/shale/dialog/basic/config/ViewStateImpl.java
MODIFY /shale/framework/trunk/shale-dialog-basic/src/main/resources/org/apache/shale/dialog/dialog-config_1_1.dtd
MODIFY /shale/framework/trunk/shale-dialog-scxml
MODIFY /shale/framework/trunk/shale-apps/shale-test-dialog-basic/src/main/webapp/WEB-INF/dialog-config.xml

Craig McClanahan added a comment - 18/Nov/06 04:38 AM
Improvement completed in nightly build 20061118. You can now declare, in your dialog-config.xml file for the basic implementation, that transitions to a particular view should be done with a redirect instead of the normal call to ViewHandler.createView(). For backwards compatibility, and philosophical compatibility with standard JSF navigation, ViewHandler.createView() is the default.

The underlying mechanism of recognizing a dialog id request parameter is built in to shale-dialog's phase listener, so it would be possible for the shale-dialog-scxml implementation to leverage this approach as well, once it was determined how to represent the request for a redirect in an SCXML configuration file.

Craig McClanahan made changes - 18/Nov/06 04:38 AM
Fix Version/s 1.0.4-SNAPSHOT [ 21740 ]
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Repository Revision Date User Message
ASF #477933 Tue Nov 21 22:27:01 UTC 2006 rahul Allow use of redirects with Shale dialogs when using Commons SCXML implementation.

This is done by defining a custom Commons SCXML action (local name "redirect") which communicates with the SCXMLDialogContext via a DialogProperties instance cached in the state machine's root context under a well-known key.

Example SCXML snippet:

<scxml xmlns="http://www.w3.org/2005/07/scxml"
       xmlns:shale="http://shale.apache.org/dialog-scxml"
       ...>

 <!-- "view" state which needs to use a redirect -->
 <state id="page1">
  <onentry>
   <shale:redirect/>
  </onentry>
  ...
 </state>

SHALE-337

This is also a general recipe for Shale dialog domain specific tweaks using custom SCXML actions. The dialog configuration file is a compound document with multiple namespaces:
 * The SCXML namespace provides the state machine abstraction and a set of "standard" actions (var, assign, if etc.)
 * The Shale dialogs custom SCXML actions namespace, which contains actions defined out-of-the-box by the shale-dialog-scxml library (currently, just <redirect>)
 * Potentially other namespaces by developers (might be application specific or merely repeatable actions that are not in the shale-dialog-scxml library) -- it will be similarly possible (via state machine's root context) to make the current FacesContext available to custom actions, greatly improving their capabilities in the context of Shale dialogs

Furthermore, the example above can be further tweaked, such as:

<scxml:if cond="...">
 <shale:redirect/>
</scxml:if>

where the custom action is conditionally invoked (thats probably of limited use for the redirection scenario, but potentially that could be a <shale:foo/> where it makes sense to do "foo" conditionally).

Finally, its possible to use custom actions as one exits a state (descendent of <onexit>) or as one transitions across states (descendent of <transition>) for further control over their invocation.
Files Changed
MODIFY /shale/framework/trunk/shale-dialog-scxml/src/main/java/org/apache/shale/dialog/scxml/Globals.java
ADD /shale/framework/trunk/shale-dialog-scxml/src/main/java/org/apache/shale/dialog/scxml/DialogProperties.java
ADD /shale/framework/trunk/shale-dialog-scxml/src/main/java/org/apache/shale/dialog/scxml/action/RedirectAction.java
MODIFY /shale/framework/trunk/shale-dialog-scxml/src/main/java/org/apache/shale/dialog/scxml/config/ConfigurationParser.java
ADD /shale/framework/trunk/shale-dialog-scxml/src/main/java/org/apache/shale/dialog/scxml/action
ADD /shale/framework/trunk/shale-dialog-scxml/src/main/java/org/apache/shale/dialog/scxml/action/package.html
MODIFY /shale/framework/trunk/shale-dialog-scxml/src/main/java/org/apache/shale/dialog/scxml/SCXMLDialogContext.java

Repository Revision Date User Message
ASF #477934 Tue Nov 21 22:28:43 UTC 2006 rahul Illustrate use of redirection.
SHALE-337
Files Changed
MODIFY /shale/framework/trunk/shale-apps/shale-test-dialog-scxml/src/main/webapp/WEB-INF/wizard.xml

Repository Revision Date User Message
ASF #490579 Wed Dec 27 22:32:26 UTC 2006 rahul Catching up on documentation (alas). Added bits for shale-dialog-scxml custom actions (redirect, view), application developer defined custom actions, DTD for dialog-config and authoring best practices. Also fixed a botched conditional in code. Includes docs for:
SHALE-61 SHALE-337 SHALE-347 SHALE-348 SHALE-366

The shale-dialog-scxml docs have become too bulky for one page, need to refactor into a "true" site (post v1.0.4)
Files Changed
MODIFY /shale/framework/trunk/shale-dialog-scxml/src/site/xdoc/index.xml
MODIFY /shale/framework/trunk/shale-dialog-scxml/src/main/java/org/apache/shale/dialog/scxml/SCXMLDialogContext.java

Rahul Akolkar made changes - 23/Jan/07 04:40 PM
Fix Version/s 1.0.4 [ 21790 ]
Fix Version/s 1.0.4-SNAPSHOT [ 21740 ]
Jeff Turner made changes - 09/Aug/07 07:17 AM
Workflow Struts [ 38937 ] Struts - editable closed status [ 42388 ]
Antonio Petrelli made changes - 08/Jan/09 08:57 AM
Workflow Struts - editable closed status [ 42388 ] Struts - editable closed status (temporary) [ 46294 ]
Antonio Petrelli made changes - 08/Jan/09 09:08 AM
Workflow Struts - editable closed status (temporary) [ 46294 ] Struts - editable closed status [ 52928 ]