You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Filipe David Manana <fd...@ieee.org> on 2008/01/12 18:28:14 UTC
Struts2 actions' extension
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.
Re: Struts2 actions' extension
Posted by Laurie Harper <la...@holoweb.net>.
Filipe David Manana wrote:
> Yes, I use Tomcat 5.5. Where in tomcat do I configure directories not
> handled with mod_jk?
He said 'apache+tomcat'; mod_jk is an Apache Httpd component, so it's
not relevant if you aren't using Apache Httpd.
See below for further comments.
> By the way, is there a Struts2 config only?
>
> thank you
>
> On Jan 12, 2008 6:56 PM, GF <ga...@gmail.com> wrote:
>
>> If you are using apache+tomcat, you can place static file in a
>> directory not handled with mod_jk
>>
>> On Jan 12, 2008 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:
You mean without the default .action suffix, right?
>>> css files (ending in .css) and javascript (.js) are no longer accessible
>> to
>>> the client.
>>>
>>> How can I fix this?
If you don't want to use a URL extension (e.g. .action) to identify
which requests should be processed by Struts, you need to partition the
URL namespace. For example, /struts/* gets handled by Struts and
/static/* gets handled by Tomcat for serving CSS, JS, etc.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts2 actions' extension
Posted by Filipe David Manana <fd...@ieee.org>.
Yes, I use Tomcat 5.5. Where in tomcat do I configure directories not
handled with mod_jk?
By the way, is there a Struts2 config only?
thank you
On Jan 12, 2008 6:56 PM, GF <ga...@gmail.com> wrote:
> If you are using apache+tomcat, you can place static file in a
> directory not handled with mod_jk
>
> On Jan 12, 2008 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?
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Filipe David Manana,
fdmanana@ieee.org
Obvious facts are like secrets to those not trained to see them.
Re: Struts2 actions' extension
Posted by GF <ga...@gmail.com>.
If you are using apache+tomcat, you can place static file in a
directory not handled with mod_jk
On Jan 12, 2008 6:28 PM, Filipe David Manana <fd...@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?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts2 actions' extension
Posted by Filipe David Manana <fd...@ieee.org>.
And, set it in the struts.properties file as the ActionMapper:
struts.mapper.class=org.apache.struts2.dispatcher.mapper.LsfwebMapper
On Feb 19, 2008 10:09 AM, Filipe David Manana <fd...@ieee.org> wrote:
> 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 <fd...@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.
>
--
Filipe David Manana,
fdmanana@ieee.org
Obvious facts are like secrets to those not trained to see them.
Re: Struts2 actions' extension
Posted by Filipe David Manana <fd...@ieee.org>.
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 <fd...@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.