You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Don Brown <mr...@twdata.org> on 2007/09/08 09:32:01 UTC

[s2] The death of the .action extension

A long time coming, it is now possible (and practical) to get rid of
extensions altogether, hence the subject, the death of the .action
extension.  With WW-2163 [1], Struts can make the distinction between
a setting that has Struts match all URL's, and one that only matches
URLs with no extension, and furthermore, extension and no extension
URLs can co-exist.

Accordingly, I changed the default 'struts.action.extension' setting
from 'action' to 'action,,'  This allows the <default-action-ref>
element in struts.xml to do what you would expect - let you define an
action to handle directory URLs such as
http://example.com/myapp/mynamespace/

In a future release, maybe 2.2, I'd like to get rid of the .action
extension altogether.  I think one of the key strengths of Struts 2 is
its closeness to the HTTP protocol, and therefore, I think it has
great potential to be a solid REST platform, an architectural style
that leverages the features of HTTP rather than fight them.

Here's to the death of the .action extension! :)

Don

[1] https://issues.apache.org/struts/browse/WW-2163

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


Re: [s2] The death of the .action extension

Posted by Brian Pontarelli <br...@pontarelli.com>.
Hehe.

I actually did this same exercise for the SmartURLs plugin. It is 
running on a number of live sites we built and works well. I'm glad to 
see that this will be incorporated into core.

One of the things I made sure to handle as well were the indexes for 
URLs like:

1. http://example.com/foo
2. http://example.com/foo/
3. http://example.com/foo/index

For #1 I handle this in the same manner most servers do. If there is an 
action named foo in the namespace / it takes precedence. Otherwise, I 
redirect to #2. Then for #2 it behaves the same as #3. Works great.

Here's the docs I put up on it:

http://code.google.com/p/smarturls-s2/wiki/WalkThrough

It is under the "Index pages and actions" section and the "Extensionless 
URLs" section.

-bp


Don Brown wrote:
> A long time coming, it is now possible (and practical) to get rid of
> extensions altogether, hence the subject, the death of the .action
> extension.  With WW-2163 [1], Struts can make the distinction between
> a setting that has Struts match all URL's, and one that only matches
> URLs with no extension, and furthermore, extension and no extension
> URLs can co-exist.
>
> Accordingly, I changed the default 'struts.action.extension' setting
> from 'action' to 'action,,'  This allows the <default-action-ref>
> element in struts.xml to do what you would expect - let you define an
> action to handle directory URLs such as
> http://example.com/myapp/mynamespace/
>
> In a future release, maybe 2.2, I'd like to get rid of the .action
> extension altogether.  I think one of the key strengths of Struts 2 is
> its closeness to the HTTP protocol, and therefore, I think it has
> great potential to be a solid REST platform, an architectural style
> that leverages the features of HTTP rather than fight them.
>
> Here's to the death of the .action extension! :)
>
> Don
>
> [1] https://issues.apache.org/struts/browse/WW-2163
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>   


Re: [s2] The death of the .action extension

Posted by Ted Husted <hu...@apache.org>.
I'm on board with Don's direction, and I'd like to try doing a
ReSTful, Zero-Configuration, Code Behind MailReader this week, based
on Brian's SmartURLs plugin, which is putting it all together in a
single package.

I believe the key point is that we have to develop architectures and
coding paradigms that let us "say it once". A very good way to say it
once is to say it with naming conventions, and to say it the URI. (And
when that doesn't work, annotations!)

Many of us are already use conventions and packed URIs, we just
haven't been telling the *framework* enough about our conventions so
that it could follow along on its own.

Personally, I don't see this as a move away from the WebWork or Struts
coding styles, but a natural progression. (Code-behind is wildcards
without the wildcards.) We've been trying to write applications this
way all along. We just couldn't see the architectural forest through
the  XML-strewn trees. :)

-Ted.

On 9/8/07, Don Brown <mr...@twdata.org> wrote:
> Personally, I think we have a lot to learn from rails as they play
> very well off the strengths of the action-based Model2 architecture.
> Action-based frameworks strengths:
>  * Simple workflow as in URL -> Action -> View
>  * Intuitive (using conventions) URL -> Action mappings
>  * RESTful by being close the the HTTP protocol
>  * Scalable by not storing view state on the server
>  * Lightweight in terms of code size and concepts needed to master
>
> As our goal is to make developing scalable applications easier and
> quicker, I think we have a lot to learn from rails.  I hope to spend
> some time beefing up the RESTful aspects of Struts 2 both for web
> services and for regular HTML-based applications.  You are right in
> that there are a lot of options in Struts 2, and we need to do a
> better job of providing a simple front to Struts 2 that doesn't
> bombard you with all its options and features.
>
> As the web moves to embrace more and more Ajax and web service
> functionality, I think Struts 2 and its action-based architecture will
> be well-suited to meet those needs.  If you want to drop components on
> a page, obviously Struts 2 isn't for you, but if you want a framework
> on which to build a scalable, public-facing web application supporting
> mobile, web service, and Ajax clients, I hope Struts 2 will be the
> logical choise.
>
> Don
>
>
>
> On 9/9/07, Tom Schneider <sc...@gmail.com> wrote:
> > Don Brown wrote:
> > > Right, and that's why I didn't move to kill it off for 2.1.  Give it
> > > some time, let the feature get some exercise, then if all agree, we
> > > could change the default later.  As with any new feature, I'd put it
> > > in a sort of experimental category for at least one major release.
> > >
> > So, do you have a final goal in mind for this or are you just working to
> > open up options?  I'd be very interested in hearing of the any options
> > we have.  Are we moving more towards Rails, or are there other better
> > alternatives?

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


Re: [s2] The death of the .action extension

Posted by Don Brown <mr...@twdata.org>.
Personally, I think we have a lot to learn from rails as they play
very well off the strengths of the action-based Model2 architecture.
Action-based frameworks strengths:
 * Simple workflow as in URL -> Action -> View
 * Intuitive (using conventions) URL -> Action mappings
 * RESTful by being close the the HTTP protocol
 * Scalable by not storing view state on the server
 * Lightweight in terms of code size and concepts needed to master

As our goal is to make developing scalable applications easier and
quicker, I think we have a lot to learn from rails.  I hope to spend
some time beefing up the RESTful aspects of Struts 2 both for web
services and for regular HTML-based applications.  You are right in
that there are a lot of options in Struts 2, and we need to do a
better job of providing a simple front to Struts 2 that doesn't
bombard you with all its options and features.

As the web moves to embrace more and more Ajax and web service
functionality, I think Struts 2 and its action-based architecture will
be well-suited to meet those needs.  If you want to drop components on
a page, obviously Struts 2 isn't for you, but if you want a framework
on which to build a scalable, public-facing web application supporting
mobile, web service, and Ajax clients, I hope Struts 2 will be the
logical choise.

Don



On 9/9/07, Tom Schneider <sc...@gmail.com> wrote:
> Don Brown wrote:
> > Right, and that's why I didn't move to kill it off for 2.1.  Give it
> > some time, let the feature get some exercise, then if all agree, we
> > could change the default later.  As with any new feature, I'd put it
> > in a sort of experimental category for at least one major release.
> >
> So, do you have a final goal in mind for this or are you just working to
> open up options?  I'd be very interested in hearing of the any options
> we have.  Are we moving more towards Rails, or are there other better
> alternatives?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>

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


Re: [s2] The death of the .action extension

Posted by Tom Schneider <sc...@gmail.com>.
Don Brown wrote:
> Right, and that's why I didn't move to kill it off for 2.1.  Give it
> some time, let the feature get some exercise, then if all agree, we
> could change the default later.  As with any new feature, I'd put it
> in a sort of experimental category for at least one major release.
>   
So, do you have a final goal in mind for this or are you just working to 
open up options?  I'd be very interested in hearing of the any options 
we have.  Are we moving more towards Rails, or are there other better 
alternatives?

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


Re: [s2] The death of the .action extension

Posted by Don Brown <mr...@twdata.org>.
On 9/8/07, Tom Schneider <sc...@gmail.com> wrote:
> What kind of strange new world will it be without .action?  I've grown
> so used to it I can't imagine not using it.  So you're saying you would
> have the same url without the .action part?

Yes.

> Now that we have all these options for mapping url's to
> actions/parameters, is there a new recommended approach that developers
> should follow?  Essentially you are getting rid of the old recommended
> webwork approach.  Options are great, but if you can't make heads or
> tails of which way is 'recommended' I think it may lead to confusion.
> (Not to mention more issues when trying support less experienced
> developers)  It would require updating all the docs/examples with the
> new approach.

Right, and that's why I didn't move to kill it off for 2.1.  Give it
some time, let the feature get some exercise, then if all agree, we
could change the default later.  As with any new feature, I'd put it
in a sort of experimental category for at least one major release.

Don

> Tom
>
> Don Brown wrote:
> > A long time coming, it is now possible (and practical) to get rid of
> > extensions altogether, hence the subject, the death of the .action
> > extension.  With WW-2163 [1], Struts can make the distinction between
> > a setting that has Struts match all URL's, and one that only matches
> > URLs with no extension, and furthermore, extension and no extension
> > URLs can co-exist.
> >
> > Accordingly, I changed the default 'struts.action.extension' setting
> > from 'action' to 'action,,'  This allows the <default-action-ref>
> > element in struts.xml to do what you would expect - let you define an
> > action to handle directory URLs such as
> > http://example.com/myapp/mynamespace/
> >
> > In a future release, maybe 2.2, I'd like to get rid of the .action
> > extension altogether.  I think one of the key strengths of Struts 2 is
> > its closeness to the HTTP protocol, and therefore, I think it has
> > great potential to be a solid REST platform, an architectural style
> > that leverages the features of HTTP rather than fight them.
> >
> > Here's to the death of the .action extension! :)
> >
> > Don
> >
> > [1] https://issues.apache.org/struts/browse/WW-2163
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> > For additional commands, e-mail: dev-help@struts.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>

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


Re: [s2] The death of the .action extension

Posted by Tom Schneider <sc...@gmail.com>.
What kind of strange new world will it be without .action?  I've grown 
so used to it I can't imagine not using it.  So you're saying you would 
have the same url without the .action part?

Now that we have all these options for mapping url's to 
actions/parameters, is there a new recommended approach that developers 
should follow?  Essentially you are getting rid of the old recommended 
webwork approach.  Options are great, but if you can't make heads or 
tails of which way is 'recommended' I think it may lead to confusion.  
(Not to mention more issues when trying support less experienced 
developers)  It would require updating all the docs/examples with the 
new approach.
Tom

Don Brown wrote:
> A long time coming, it is now possible (and practical) to get rid of
> extensions altogether, hence the subject, the death of the .action
> extension.  With WW-2163 [1], Struts can make the distinction between
> a setting that has Struts match all URL's, and one that only matches
> URLs with no extension, and furthermore, extension and no extension
> URLs can co-exist.
>
> Accordingly, I changed the default 'struts.action.extension' setting
> from 'action' to 'action,,'  This allows the <default-action-ref>
> element in struts.xml to do what you would expect - let you define an
> action to handle directory URLs such as
> http://example.com/myapp/mynamespace/
>
> In a future release, maybe 2.2, I'd like to get rid of the .action
> extension altogether.  I think one of the key strengths of Struts 2 is
> its closeness to the HTTP protocol, and therefore, I think it has
> great potential to be a solid REST platform, an architectural style
> that leverages the features of HTTP rather than fight them.
>
> Here's to the death of the .action extension! :)
>
> Don
>
> [1] https://issues.apache.org/struts/browse/WW-2163
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>
>   


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


RE: [s2] The death of the .action extension

Posted by James Holmes <ja...@jamesholmes.com>.
Nice work!

I've just started working on a Rails app to get more familiar with the Rails
framework and I must say I like the Rails "routing" scheme a lot! The closer
we can get to the way Rails does things, the better we are in my opinion.

James

-----Original Message-----
From: Don Brown [mailto:mrdon@twdata.org] 
Sent: Saturday, September 08, 2007 3:32 AM
To: Struts Developers List
Subject: [s2] The death of the .action extension

A long time coming, it is now possible (and practical) to get rid of
extensions altogether, hence the subject, the death of the .action
extension.  With WW-2163 [1], Struts can make the distinction between
a setting that has Struts match all URL's, and one that only matches
URLs with no extension, and furthermore, extension and no extension
URLs can co-exist.

Accordingly, I changed the default 'struts.action.extension' setting
from 'action' to 'action,,'  This allows the <default-action-ref>
element in struts.xml to do what you would expect - let you define an
action to handle directory URLs such as
http://example.com/myapp/mynamespace/

In a future release, maybe 2.2, I'd like to get rid of the .action
extension altogether.  I think one of the key strengths of Struts 2 is
its closeness to the HTTP protocol, and therefore, I think it has
great potential to be a solid REST platform, an architectural style
that leverages the features of HTTP rather than fight them.

Here's to the death of the .action extension! :)

Don

[1] https://issues.apache.org/struts/browse/WW-2163

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


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