struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <>
Subject Re: Rest Plugin + IndexController and disabling content types
Date Mon, 01 Sep 2008 13:20:56 GMT
rakeshxp wrote:
> Hi All,
> I have 2 questions regarding the struts-rest plugin ( 2.1.3-snapshot)
> 1) How can I write a controller that will handle the request on "/" ( i.e
> )?

No, there isn't. 

If you substitute the CodeBehind plugin for the Convention plugin, then 
you can (probably) use an IndexConroller for that. I haven't attempted 
it myself.
The Convention plugin is in the sandbox (not released, and not likely to 
be until 2.2.x) but Musachy made it work with the rest plugin.

Otherwise, create a custom ActionMapper that detects that URI.  I create 
a simple one in an application that instead of returning null (action 
not found), just returned "index"; if an IndexController exists it will 
be invoked. 

I've found the CompoundActionMapper quite useful to split conventions 
rather than extending the RestActionMapper.

> 2) As I understand, the rest plugin by default handles XML and JSON
> extensions too ( ) . Is
> there a way to disable these extensions ? ( Other than overriding
> and providing a dummy implementation )
> Thanks!

You can probably change the struts.action.extension property back so one 
that excludes xml and json.
Otherwise I don't think there's a way to disable an existing 
ContentTypeHandler other than the way you suggest.
Eventually this will need to be controlled on a per package or per 
action case.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message