You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Phil Davis (JIRA)" <ji...@apache.org> on 2010/06/06 20:02:58 UTC

[jira] Created: (WW-3454) Blank Extensions break the normal processing of non-action files

Blank Extensions break the normal processing of non-action files
----------------------------------------------------------------

                 Key: WW-3454
                 URL: https://issues.apache.org/jira/browse/WW-3454
             Project: Struts 2
          Issue Type: Bug
          Components: Core Actions
    Affects Versions: 2.1.8.1
         Environment: Glassfish v3, Eclipse
            Reporter: Phil Davis 
            Priority: Critical


Given the following configuration:

web.xml:
--------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
http://java.sun.com/xml/ns/javaee" xmlns:web="
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
    <display-name>WebSite</display-name>

    <filter>
        <filter-name>struts2</filter-name>

<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
        <init-param>
            <param-name>actionPackages</param-name>
            <param-value>com.example.actions</param-value>
        </init-param>
    </filter>

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

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

struts.xml:
--------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd" >
<struts>
    <constant name="struts.devMode" value="true"/>
    <constant name="struts.action.extension" value=""/>

    <package name="default" extends="struts-default">
        <action name="home">
            <result>/home.jsp</result>
        </action>
    </package>

</struts>


In addition to these two xml files, I have two image files and two jsp
files:
    /logo.gif
    /images/logo.gif
    /index.jsp
    /home.jsp

The image files are unique so I know which is being displayed.  The JSP
files are unique so I know which is being displayed.  (ie "this is home" and
"this is index")


Results:
---------------------------------------------------------------------
I have gone to each of the specified URLs, with the following results:

/home
This works as expected.  I see a page that says "this is home"

/home.jsp
Error page with the message: There is no Action mapped for namespace / and
action name home.jsp

/index.jsp
Error page with the message: There is no Action mapped for namespace / and
action name index.jsp

/
Error page with the message: There is no Action mapped for namespace / and
action name index.jsp

/logo.gif
Error page with the message: There is no Action mapped for namespace / and
action name logo.gif

/images/logo.gif
Error page with the message: There is no Action mapped for action name
logo.gif


I believe this is not the intended result.  I would expect the same results
that I get if I set the extension to "action" (with the corresponding URLs)
These results are as follows:

/home.action
This works as expected.  I see a page that says "this is home"

/home
Error 404 (expected result)

/home.jsp
I see a page that says "this is home", but it is not the result of the
action (parameters in the action are not processed)

/index.jsp
This works as expected.  I see a page that says "this is index"

/
This works as expected.  I see a page that says "this is index"

/logo.gif
Works as expected, I see the logo image.

/images/logo.gif
Works as expected, I see the other logo image.


I consider this a bug, since the behavior is quite different between the two
scenarios.  Restating it again, I expect the same behavior when the
extension is blank as when it is "action" or "do" or "fred", except there is
no extension.  I also expect non-actions to be processed as normal.


Expected solution:

When an extension is specified, the actual action name is the concatenation
of the specified action name plus the extension.  For example:
"home.action".  Requests that don't match the "actual" action name, are
considered normal file requests.

When a blank extension is specified, the actual action name is exactly what
is specified in the action name, without the addition of the extension.  For
example: "home".  But other requests that don't match specified action names
would be considered normal file requests.  (BTW, with blank extensions the
action name may specify an extension, for example "home.do")



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-3454) Blank Extensions break the normal processing of non-action files

Posted by "Maurizio Cucchiara (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WW-3454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12922393#action_12922393 ] 

Maurizio Cucchiara commented on WW-3454:
----------------------------------------

According to the code, it looks like that the right value for representing empty extension is a simple comma:  
<constant name="struts.action.extension" value=","/>
Could you try with this new value?




> Blank Extensions break the normal processing of non-action files
> ----------------------------------------------------------------
>
>                 Key: WW-3454
>                 URL: https://issues.apache.org/jira/browse/WW-3454
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.1.8.1
>         Environment: Glassfish v3, Eclipse
>            Reporter: Phil Davis 
>            Priority: Critical
>
> Given the following configuration:
> web.xml:
> --------------------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
> http://java.sun.com/xml/ns/javaee" xmlns:web="
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="
> http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
> version="2.5">
>     <display-name>WebSite</display-name>
>     <filter>
>         <filter-name>struts2</filter-name>
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
>         <init-param>
>             <param-name>actionPackages</param-name>
>             <param-value>com.example.actions</param-value>
>         </init-param>
>     </filter>
>     <filter-mapping>
>         <filter-name>struts2</filter-name>
>         <url-pattern>/*</url-pattern>
>     </filter-mapping>
>     <welcome-file-list>
>         <welcome-file>index.jsp</welcome-file>
>     </welcome-file-list>
> </web-app>
> struts.xml:
> --------------------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts
> Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd" >
> <struts>
>     <constant name="struts.devMode" value="true"/>
>     <constant name="struts.action.extension" value=""/>
>     <package name="default" extends="struts-default">
>         <action name="home">
>             <result>/home.jsp</result>
>         </action>
>     </package>
> </struts>
> In addition to these two xml files, I have two image files and two jsp
> files:
>     /logo.gif
>     /images/logo.gif
>     /index.jsp
>     /home.jsp
> The image files are unique so I know which is being displayed.  The JSP
> files are unique so I know which is being displayed.  (ie "this is home" and
> "this is index")
> Results:
> ---------------------------------------------------------------------
> I have gone to each of the specified URLs, with the following results:
> /home
> This works as expected.  I see a page that says "this is home"
> /home.jsp
> Error page with the message: There is no Action mapped for namespace / and
> action name home.jsp
> /index.jsp
> Error page with the message: There is no Action mapped for namespace / and
> action name index.jsp
> /
> Error page with the message: There is no Action mapped for namespace / and
> action name index.jsp
> /logo.gif
> Error page with the message: There is no Action mapped for namespace / and
> action name logo.gif
> /images/logo.gif
> Error page with the message: There is no Action mapped for action name
> logo.gif
> I believe this is not the intended result.  I would expect the same results
> that I get if I set the extension to "action" (with the corresponding URLs)
> These results are as follows:
> /home.action
> This works as expected.  I see a page that says "this is home"
> /home
> Error 404 (expected result)
> /home.jsp
> I see a page that says "this is home", but it is not the result of the
> action (parameters in the action are not processed)
> /index.jsp
> This works as expected.  I see a page that says "this is index"
> /
> This works as expected.  I see a page that says "this is index"
> /logo.gif
> Works as expected, I see the logo image.
> /images/logo.gif
> Works as expected, I see the other logo image.
> I consider this a bug, since the behavior is quite different between the two
> scenarios.  Restating it again, I expect the same behavior when the
> extension is blank as when it is "action" or "do" or "fred", except there is
> no extension.  I also expect non-actions to be processed as normal.
> Expected solution:
> When an extension is specified, the actual action name is the concatenation
> of the specified action name plus the extension.  For example:
> "home.action".  Requests that don't match the "actual" action name, are
> considered normal file requests.
> When a blank extension is specified, the actual action name is exactly what
> is specified in the action name, without the addition of the extension.  For
> example: "home".  But other requests that don't match specified action names
> would be considered normal file requests.  (BTW, with blank extensions the
> action name may specify an extension, for example "home.do")

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.