You can't get rid of the ".action", at least in my tests I have not being able to map a clean url without the ".action". Even the Restful2ActionMapper requires a .action at the end.

To make it work without the action you can always set the struts2 extension to "" and map the struts2 filter to somewhere else than /* so struts2 lets you serve other content.
web.xml:
<!-- snip  -->
<filter-mapping>
   <filter-name>struts2</filter-name>
   <url-pattern>/logic/*</url-pattern>
</filter-mapping>
<!-- /snip  -->

struts.xml:
<!-- snip  -->
<constant name="struts.action.extension" value="" />
<!-- /snip  -->

If someone knows other way without extra prefix and no suffix, please share.

Perssy Llamosas

-------- Original Message --------
Subject: Re:Don't expose .action to user?
From: Adam Ruggles <[EMAIL PROTECTED]>
To: Struts Users Mailing List <user@struts.apache.org>
Date: 19/07/2007 02:23 p.m.
Here a couple links that should get you started.

http://struts.apache.org/2.0.8/struts2-core/apidocs/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.html
http://struts.apache.org/2.0.8/docs/restfulactionmapper.html
http://struts.apache.org/2.0.8/docs/actionmapper.html

Kevin Lawrence wrote:
I have not. Can you give me a link?

Thanks,

Kevin

Adam Ruggles wrote:
Have you looked at using the restful url stuff?

Kevin Lawrence wrote:
I know you were joking but, for me, there are two concerns:

1. I want the urls to be memorable

 www.junitfactory.com/demo

is easier to remember than

 www.junitfactory.com/demo.action (or .htm or .html or .jsp)


2. I will almost certainly move part of my site to a CMS in the near future and I don't want to break all the URLs



Kevin


Eric Buitenhuis wrote:
If obscuring the underlying technology is the primary concern, perhaps using
*.htm
 instead of *.action for struts 2 while using *.html for static could
be a solution. Then everyone would think you were writing it using Microsoft
technology :-)



On 7/19/07, Neil Aggarwal <[EMAIL PROTECTED]> wrote:

Matt:

I use URLRewrite.  I only have a few rules since
urlreqrite supports regex pattern mathing.

Thanks,
        Neil

--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
FREE! Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.

-----Original Message-----
From: mraible [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 19, 2007 11:32 AM
To: user@struts.apache.org
Subject: Re: Don't expose .action to user?


I agree it would be nice if you could make totally clean URLs with Struts
2
-
as if you had each action registered as servlets in your web.xml.
Unfortunately, I don't believe it's possible. The only solution I can
think
of is to use the UrlRewriteFilter.

http://tuckey.org/urlrewrite

While this solution would work, it'd require duplicating your action paths in urlrewrite.xml. I guess the best solution is to write some sort of adapter for the UrlRewriteFilter that sweeps your struts.xml and creates rules to forward all action names (w/o an extension) to your actions with
an
extension. In turn, you'd have to write outgoing rules that strip off the
extension from URLs.

If someone has a more elegant solution, I'd love to hear about it.

Matt


Chris Pratt wrote:
>
> We had the same concern, so by putting this in the top of our struts.xml
:
>
>   <constant name="struts.action.extension" value="html"/>
>
> It makes all the actions look like regular old .html requests.
>   (*Chris*)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

--
View this message in context:

http://www.nabble.com/Don%27t-expose-.action-to-user--tf4106649.html#a116921
69
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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]




---------------------------------------------------------------------
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]



---------------------------------------------------------------------
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]




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

Reply via email to