struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wkbutler <kent.but...@gmail.com>
Subject Re: Mapping FreeMarker results in struts-rest-plugin
Date Wed, 11 Mar 2009 14:50:37 GMT

Thanks Bill -  my action class is actually called SubdivisionController. 
Interesting you're getting responses for ftl requests. 

These URI's resolve for me:
   http://localhost:8080/lotmap/subdivision/id1
   http://localhost:8080/lotmap/subdivision/id1.xml

and these fail with a 404
   http://localhost:8080/lotmap/subdivision/id1.jsp   (can't find local file
- see below)
   http://localhost:8080/lotmap/subdivision/id1.ftl    (nothing logged at
all)

and these are what I think should be the relevant templates 
   WEB-INF/content/subdivision-show.jsp
   WEB-INF/content/subdivision-show.ftl

The URI with no extension is resolved via a forward from
ServletDispatcherResult. It is the only one of this group that is handled
this way though.  Of note, for the cases that succeed, the action method
appears to be unknown in the ActionInvocation:

DEBUG [btpool0-2] RestWorkflowInterceptor.debug(57) | Skipping
Interceptor... Method [show] found in exclude list.
DEBUG [btpool0-2] RestActionInvocation.debug(57) | Executing action method =
null

which I think means that a registered UnknownHandler should process this
Result, based on the RestActionInvocation class's invokeAction() method. And
the only UnknownHandler candidate I see is Convention's, and it seems to
give up on unknown methods. So I don't think I found the right handler. 

It's a bit confusing that with no extension the result is processed, and
with a .jsp extension, this error is logged:

2009-03-11 07:11:51.703::WARN:  PWC6117: File
"D:\projects\lotmap-restful-ep\src\main\webapp\subdivision\F11.jsp" not
found

And for the .ftl extension there is nothing logged at all.

Musachy - thanks for the reminder, in haste I had blurred the distinction. 
It appears that the Rest plugin's strategy for result handling defers to
Convention or struts core definitions, but this appears to be working only
for the rest-plugin's default extension "" (or "xhtml" to be more correct). 

The rest plugin does properly handle different ContentTypes based on
extension via its Interceptor, which is much different than the Action
mechanism's use of extension to map result type.  

I think my URL's above and their content templates are accurate. I have also
tried some nonsensical templates (for a rest-plugin action) like
   WEB-INF/content/subdivision-success.ftl
   WEB-INF/content/subdivision.ftl

I wonder if something else is required to invoke the
FreemarkerTemplateEngine for the ftl extension.  The rest plugin seems to
squash this somehow.  What am I missing...?




Bill Stilwell wrote:
> 
> I'm not sure if this applies, but I have found that with the rest
> plugin and freemarker, I _have_ to have a Controller. It's not clear
> to me from reading the docs if this is the intention with the rest
> plugin, but that's how things are working for me.
> 
> -b
> 
> On Tue, Mar 10, 2009 at 1:56 PM, Musachy Barroso <musachy@gmail.com>
> wrote:
>> xml and json are the output types (the response sent to the client).
>> JSP and FreeMarker are the result types, which are mapped by
>> Convention. Check the Convention documentation for details on how the
>> templates are found (same rules apply for jsp(s) and ftl(s))
> 
> 
> -- 
> Bill Stilwell - http://www.marginalia.org/
> bill.stilwell@gmail.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Mapping-FreeMarker-results-in-struts-rest-plugin-tp22443339p22456790.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message