SmartURLs..Are there situations where using action-name based results are
preferable over a declared result?

Where can I get the source for
org.texturemedia.smarturls.SmartURLsConfigurationProvider?

Thanks
Martin
----- Original Message -----
From: "Jeromy Evans" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Friday, January 18, 2008 7:28 PM
Subject: Re: REST vs Original


> Hi Frans,
>
> Unfortunately at the moment you can't mix conventions within the same
> Struts2 webapp.  The trouble is the REST plugin overrides a lot of the
> default behaviour rather than augmenting it. Right now if your commit to
> REST conventions it'll apply to the entire webapp.  With some effort it
> may be possible to use a CompoundActionMapper to to the mix URL-mapping
> schemes though.
>
> It sounds like you're mainly interested in nice URLs...
>
> If you just want nice URLs and not actually REST conventions you may
> prefer the SmartURLs plugin.  It's being merged into Struts2.1
> Convention plugin but is available for 2.0 now. It does a lot, but
> generally it provides that actions in packages at
> com.mycompany.actions.bla.BlaAction are available at the URL
> /bla/bla.action and further that the URL /bar/ will execute
> com.mycompany.actions.bla.IndexAction, and so on.  If you add blank
> extension handline you get some nice urls: /bla/bla -> bla.BlaAction
>
> If you want search-engine friendly URLs that contain parameters in the
> path there are two options:
>   - the RestfulActionMapper in Struts2.0 allows URLs like
> /name1/value1/name2/value2/bla.action where name1 and name2 are
> properties in BlaAction.  It can be used with a CompoundActionMapper to
> mix this with the Default action mapping, or
>   - the NamedVariablePatternMatcher in Struts2.1 allows action
> namespaces to contain properties.  eg. /{state}/{city}/bla.action where
> state and city are properties of the BlaAction
>
> AFAIK, the NamedVariablePatternMatcher can be used with either default
> or REST conventions.  It can't be used at the same time as default
> wildcards implementation though (/*blaAction).  This feature is
> relatively new and undocumented.
>
> It's enabled like this in struts.xml:
>  <bean type="com.opensymphony.xwork2.util.PatternMatcher"
> name="namedVariablePatternMatcher"
> class="com.opensymphony.xwork2.util.NamedVariablePatternMatcher"/>
>  <constant name="struts.patternMatcher"
> value="namedVariablePatternMatcher"/>
>  <constant name="struts.mapper.alwaysSelectFullNamespace" value="true"/>
>
> And used like this:
> @Namespace("/{country}/{state}")
> public class SuburbController implements ModelDriven<Object> {
>    public void String setCountry(String country) ...
>    public void String setState(String state)...
> ...
> }
>
> (The class above is a REST-controller model-driven action but it should
> work with normal actions too).  At this time (Jan08) I can't recommend
> the NamedVariablePatternMatcher unless you're willing to dive into the
> Struts2 source as issues arise as its quite experimental.
>
> Hope that helps,
> Jeromy Evans
>
> Frans Thamura wrote:
> > hi there
> >
> > i just want to know, how to mixe the code between S2 and with REST under
one
> > container.
> >
> > any idea?
> >
> > or anyone have an example that 'this is the old' and 'this is the REST'
> >
> > still cannot get how can .action become /bla/bla
> >
> >
> > ------------------------------------------------------------------------
> >
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.5.516 / Virus Database: 269.19.6/1230 - Release Date:
17/01/2008 4:59 PM
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to