Back Forum Reply New

View Agnostic Conversational States

Hi all,

I am working on using Spring Web Flow 2 (SWF2) to re-implement what I did few years ago using SCXML.

Basically I need both State-full and State-less Controllers.

When a State-full behavior is needed I do not want it accessible in a State-less way.

Looking at the provided Out Of The Box (OOB) functionality I understand the closest I can get is using Logical view ids as the documentation says:

With some view frameworks, such as Spring MVC's view framework, the view id may also be a logical identifier resolved by the framework:

lt;view-state id=quot;enterBookingDetailsquot; view=quot;bookingDetailsquot;gt;

The question is how I make sure BookingDetailsController is available only from flows and not as a state-less @Controller?

Thanks in advance!

-Nestor Urquiza

Let me clarify a little bit what I am trying to do.

I need to decide what content to serve based not on a ViewName but on request parameters and headers.

From Spring MVC Documentation:

The two interfaces which are important to the way Spring handles views are ViewResolver and View. The ViewResolver  provides a mapping between view names and actual views. The View interface addresses the preparation of the request and hands the request over to one of the view technologies.

According to the above SWF architecture cannot solve my issue at ViewResolver level but rather at View level. My custom ViewResolver then will just return a custom View:Code:
public class CustomViewResolver extends WebApplicationObjectSupport implements ViewResolver, Ordered { private int order = Integer.MAX_VALUE; // default: same as non-Ordered public void setOrder(int order) {   this.order = order; }
public int getOrder() {   return order; }
public View resolveViewName(String viewName, Locale locale) throws BeansException {   return new CustomView(); }
}
My custom View will then inspect let us say a param to decide if I need JSON or if I need HTML. I can deal with a JSON or XML view for example, however I would still like to support JSP, JSTL and even tiles for cases like HTML and WML for example. The big problem is though that once the custom view has been resolved I will need to reinvent the wheel from it as pretty much I need all the logic from uclBasedViewResolver to resolve the View file (JSP) as well as the logic from InternalResourceView, RedirectView, AbstractuclBasedView and perhaps more.

This is clearly not the path to go. If we think about breaking the  concept and have a View per content type and a ViewResolver that will allow to pick the View we face with a Dispatcher lifecycle problem as far as I can see since there is no accessibility to the Request object from inside ViewResolvers.

I would like to understand what is the recommended way to manage different content type responses using SWF2. I prefer of course convention over configuration.

Thanks again,

-Nestor
¥
Back Forum Reply New