Is there a way to hide .action & .do by using filter & url-pattern?

For example, I have the following codes:

 <filter>
        <filter-name>tutorial</filter-name>
        <filter-class>
           org.apache.struts2.dispatcher.FilterDispatcher
        </filter-class>
    </filter>



    <filter-mapping>
        <filter-name>tutorial</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>


How would the the following tech be applied to struts2 web.xml?

<servlet>
<servlet-name>action</servlet-name>
                
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
</servlet>
<servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
</servlet-mapping>



Here is another approach suggested by Peter Hilton.

On 20 Sep 2007, at 06:37, Vo Van Thuong wrote:
I've just read your article at http://www.lunatech-research.com/archives/2005/07/29/struts-urls,
 and i find it very useful for me.
I'm glad if it helps you.


 would you pls give me some idea about Ebay's url.
http://antiques.listings.ebay.com/Antiquities-Classical-Amer_W0QQcoactionZcompareQQcoentrypageZsearchQQcopagenumZ1QQfromZR2QQftrtZ1QQftrvZ1QQsabfmtsZ1QQsacatZ37903QQsaobfmtsZinsifQQsocmdZListingItemList

 I'm wondering why they do that,



It looks like they have replaced ? = and & in the query string with letters, because search engines sometimes treat URLs with a query string differently.


 and how they do that?
 Can i also implement something like that?
Sure. You need to do two things. First change the characters in URLs that appear in HTML your application generates. In JSP or JSF you could use a custom tag for that. Second, in the web server use some kind of rewriting such as Apache mod_rewrite or a Servlet filter to translate the characters back again before they are used by your application.


Peter

----- Original Message ----- From: "hezjing" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Friday, September 21, 2007 3:00 PM
Subject: Re: Struts URLs for perfectionists like Ebay's URLs


I think that is called URL's parameter encryption.

You may want to take a look at
http://www.avedatech.com/Products/QueryCrypt/index.jsp,
I haven't try it by myself though.


On 9/20/07, Vo Van Thuong <[EMAIL PROTECTED]> wrote:
Hi Vinny,

I'd like users to access to my website by URLs like Ebay's:
http://listings.ebay.com/_W0QQcoactionZcompareQQcoentrypageZsearchQQcopagenumZ1QQfromZR2QQftrtZ1QQftrvZ1QQsabfmtsZ1QQsacatZQ2d1QQsaobfmtsZinsifQQsocmdZListingCategoryList
In which we can't see which one is get parameters which one is value
obviously.

I've already read an article at
http://www.lunatech-research.com/archives/2005/07/29/struts-urls
Which gives guides to remove the request extension (.do), the parameter and
value from urls.
eg:
   customer.do?method=edit&id=42
   /customer/edit/42

Thanks for quick response.

----- Original Message -----
From: "Vinny" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Thursday, September 20, 2007 12:54 PM
Subject: Re: Struts URLs for perfectionists like Ebay's URLs


> Can you give an example of what you are trying to do?
> There a few plugins/tools/filters that can effect urls in struts and
> webapps in general
>

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

Reply via email to