Hi Craig,
guess you are right that the remoting is not the solution for my
problem. What I like to realize is the following:
- The user gets an email with a link to the webapp.
- When the user click on this link an action method should decide
whether the link is still valid or not.
- If the link is still valid the user is redirected to the login page.
- If not the user is redirected to a new request page.
So what I need is a solution to trigger an action method by a get
request that returns an outcome that is handled by jsf?
My current solution is a configurable phaselistener that checks whether
or not the requested link. If requested viewId is equal to a configured
action the action method will be invoked and the outcome of the method
will be analyzed by the navigation handler.
Any simpler solution or maybe more jsf like solution is very welcomed.
Regards
Ingo
Here is my action process method:
...
final UIViewRoot view = facesContext.getViewRoot();
final String viewId = view.getViewId();
if (StringUtils.isNotBlank(viewId)) {
for (PageAction action : actions) {
if (action.matches(viewId)) {
if (logger.isDebugEnabled()) {
logger.debug("perform page action " +
action.getAction());
}
final String outcome = action.perform(facesContext);
if (outcome != null) {
final Application application =
facesContext.getApplication();
NavigationHandler navigationHandler =
application.getNavigationHandler();
navigationHandler.handleNavigation(facesContext,
action.getFromAction(), outcome);
break;
}
}
}
}
Craig McClanahan schrieb:
Sorry for the late response (I've been in an airplane a lot in the
last few
days). But I have a basic question for you.
Why are you using Shale Remoting if you are expecting to navigate to a
new
page? The design purpose of these dynamic callbacks is to set up
handlers
for an asynchronous callback (such as from XmlHTTPRequest calls in an
AJAX
component). For that scenario, Shale Remoting expects your handler to:
* Prepare the complete response (typically in XML or JSON or whatever).
The most convenient way is to get an appropriate ResponseWriter and
write all of the output.
* Call FacesContext.responseComplete() to indicate to JSF that you have
already completed the response for this request, so Render Response
phase is skipped.
On the other hand, a standard JSF request (i.e. the complete page
submit) is
passed through JSF navigation in the usual way, because the purpose of
the
response is to replace the *entire* page.
So, based on this, it seems like you are trying to mix things that
were not
designed to be mixed.
Craig