struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Filipe David Manana" <fdman...@ieee.org>
Subject Re: Struts2 actions' extension
Date Tue, 19 Feb 2008 09:09:07 GMT
I managed to find a solution to be able to use extensionless actions.
Just subclass the DefaultActionMapper like this:

package org.apache.struts2.dispatcher.mapper;
>
> import java.util.*;
>
> public class LsfwebMapper extends DefaultActionMapper
> {
>    private static List<String> ignoredExtensions = new
> ArrayList<String>();
>
>    static
>    {
>       ignoredExtensions.add(".jsp");
>       ignoredExtensions.add(".css");
>       ignoredExtensions.add(".js");
>       ignoredExtensions.add(".gif");
>       ignoredExtensions.add(".png");
>       ignoredExtensions.add(".html");
>    }
>
>
>    String dropExtension(String name)
>    {
>       Iterator<String> it = ignoredExtensions.iterator();
>
>       while ( it.hasNext() )
>       {
>          if ( name.endsWith(it.next()) )
>             return null;
>       }
>
>       return super.dropExtension(name);
>    }
> }
>
>
Don't forget to place this class in a directory named
org/apache/struts2/dispatcher/mapper/  within your source directory,
src/main/java/ (if using maven).


On Sat, Jan 12, 2008 at 6:28 PM, Filipe David Manana <fdmanana@ieee.org>
wrote:

> Hi,
>
> I have set the property struts.action.extension to the empty string. I can
> now invoke my actions with the default ".action" suffix, although I have a
> problem:
>
> css files (ending in .css) and javascript (.js) are no longer accessible
> to the client.
>
> How can I fix this?
>
> cheers
>
> --
> Filipe David Manana,
> fdmanana@ieee.org
>
> Obvious facts are like secrets to those not trained to see them.




-- 
Filipe David Manana,
fdmanana@ieee.org

Obvious facts are like secrets to those not trained to see them.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message