You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Philipp Leusmann (JIRA)" <ji...@apache.org> on 2010/02/03 13:53:28 UTC

[jira] Created: (WW-3381) Better support for "empty extension actions"

Better support for "empty extension actions"
--------------------------------------------

                 Key: WW-3381
                 URL: https://issues.apache.org/jira/browse/WW-3381
             Project: Struts 2
          Issue Type: Improvement
          Components: Core Actions
    Affects Versions: 2.1.8
            Reporter: Philipp Leusmann


The current support for the empty action extension is somehow strange. 

This is a copy of my comment on the related issue, but I decided to open a new issue, to have any chance of getting attention:

I was trying to decorate plain html files using the sitemesh-plugin.
I expected it to work using the empty-string action mapper, and thus added a link to /decorated_html/foo.html . The reslut was an error page since all the variables in the template could not be resolved, due to a missing action.
If org.apache.struts2.dispatcher.mapper.DefaultActionMapper.dropExtension(String, ActionMapping) would not return null for any url containing a dot but no slash and no supported action-extension after it, it would have worked.
By looking at the tests, I found that the returned null was expected behaviour introduced for this issue.

I think to resolve this issue it would have been better to promote more sofisticated filter mappings in the web.xml to avoid the empty action side effects described in a previous comment.

In my case it would be sufficient to use filter mappings

<filter-mapping>
<filter-name>struts2-prepare</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2-prepare</filter-name>
<url-pattern>decorated_html/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>sitemesh-struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>struts2-execute</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2-execute</filter-name>
<url-pattern>/decorated_html/*</url-pattern>
</filter-mapping>


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


[jira] Commented: (WW-3381) Suport for decorating static content

Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WW-3381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12849603#action_12849603 ] 

Lukasz Lenart commented on WW-3381:
-----------------------------------

Could you attach a patch?

Thanks in advance!

> Suport for decorating static content
> ------------------------------------
>
>                 Key: WW-3381
>                 URL: https://issues.apache.org/jira/browse/WW-3381
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - SiteMesh
>    Affects Versions: 2.1.8
>            Reporter: Philipp Leusmann
>            Priority: Critical
>             Fix For: Future
>
>   Original Estimate: 8h
>  Remaining Estimate: 8h
>
> In my case this issue is occuring when trying to decorate static content with sitemesh, but it generally is more an struts-core ActionMapper issue. 
> I was trying to decorate plain html files using the sitemesh-plugin.
> I expected it to work using the empty-string action mapper, and thus added a link to /decorated_html/foo.html . The reslut was an error page since all the variables in the template could not be resolved, due to a missing action.
> If org.apache.struts2.dispatcher.mapper.DefaultActionMapper.dropExtension(String, ActionMapping) would not return null for any url containing a dot but no slash and no supported action-extension after it, it would have worked.
> By looking at the tests, I found that the returned null was expected behaviour introduced for WW-2163.
> I think to resolve this issue it would have been better to promote more sofisticated filter mappings in the web.xml to avoid the empty action side effects described in a previous comment.
> In my case it would be sufficient to use filter mappings
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>decorated_html/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>sitemesh-struts</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>/decorated_html/*</url-pattern>
> </filter-mapping>

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


[jira] Updated: (WW-3381) Suport for decorating static content

Posted by "Philipp Leusmann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WW-3381?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Philipp Leusmann updated WW-3381:
---------------------------------

           Component/s:     (was: Core Actions)
                        Plugin - SiteMesh
           Description: 
In my case this issue is occuring when trying to decorate static content with sitemesh, but it generally is more an struts-core ActionMapper issue. 

I was trying to decorate plain html files using the sitemesh-plugin.
I expected it to work using the empty-string action mapper, and thus added a link to /decorated_html/foo.html . The reslut was an error page since all the variables in the template could not be resolved, due to a missing action.
If org.apache.struts2.dispatcher.mapper.DefaultActionMapper.dropExtension(String, ActionMapping) would not return null for any url containing a dot but no slash and no supported action-extension after it, it would have worked.
By looking at the tests, I found that the returned null was expected behaviour introduced for WW-2163.

I think to resolve this issue it would have been better to promote more sofisticated filter mappings in the web.xml to avoid the empty action side effects described in a previous comment.

In my case it would be sufficient to use filter mappings

<filter-mapping>
<filter-name>struts2-prepare</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2-prepare</filter-name>
<url-pattern>decorated_html/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>sitemesh-struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>struts2-execute</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2-execute</filter-name>
<url-pattern>/decorated_html/*</url-pattern>
</filter-mapping>


  was:
The current support for the empty action extension is somehow strange. 

This is a copy of my comment on the related issue, but I decided to open a new issue, to have any chance of getting attention:

I was trying to decorate plain html files using the sitemesh-plugin.
I expected it to work using the empty-string action mapper, and thus added a link to /decorated_html/foo.html . The reslut was an error page since all the variables in the template could not be resolved, due to a missing action.
If org.apache.struts2.dispatcher.mapper.DefaultActionMapper.dropExtension(String, ActionMapping) would not return null for any url containing a dot but no slash and no supported action-extension after it, it would have worked.
By looking at the tests, I found that the returned null was expected behaviour introduced for this issue.

I think to resolve this issue it would have been better to promote more sofisticated filter mappings in the web.xml to avoid the empty action side effects described in a previous comment.

In my case it would be sufficient to use filter mappings

<filter-mapping>
<filter-name>struts2-prepare</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2-prepare</filter-name>
<url-pattern>decorated_html/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>sitemesh-struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>struts2-execute</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2-execute</filter-name>
<url-pattern>/decorated_html/*</url-pattern>
</filter-mapping>


              Priority: Critical  (was: Major)
    Remaining Estimate: 8h
     Original Estimate: 8h
               Summary: Suport for decorating static content  (was: Better support for "empty extension actions")

> Suport for decorating static content
> ------------------------------------
>
>                 Key: WW-3381
>                 URL: https://issues.apache.org/jira/browse/WW-3381
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - SiteMesh
>    Affects Versions: 2.1.8
>            Reporter: Philipp Leusmann
>            Priority: Critical
>   Original Estimate: 8h
>  Remaining Estimate: 8h
>
> In my case this issue is occuring when trying to decorate static content with sitemesh, but it generally is more an struts-core ActionMapper issue. 
> I was trying to decorate plain html files using the sitemesh-plugin.
> I expected it to work using the empty-string action mapper, and thus added a link to /decorated_html/foo.html . The reslut was an error page since all the variables in the template could not be resolved, due to a missing action.
> If org.apache.struts2.dispatcher.mapper.DefaultActionMapper.dropExtension(String, ActionMapping) would not return null for any url containing a dot but no slash and no supported action-extension after it, it would have worked.
> By looking at the tests, I found that the returned null was expected behaviour introduced for WW-2163.
> I think to resolve this issue it would have been better to promote more sofisticated filter mappings in the web.xml to avoid the empty action side effects described in a previous comment.
> In my case it would be sufficient to use filter mappings
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>decorated_html/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>sitemesh-struts</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>/decorated_html/*</url-pattern>
> </filter-mapping>

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


[jira] Issue Comment Edited: (WW-3381) Suport for decorating static content

Posted by "Philipp Leusmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WW-3381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12829064#action_12829064 ] 

Philipp Leusmann edited comment on WW-3381 at 2/18/10 5:09 PM:
---------------------------------------------------------------

Possible solution:

Change org.apache.struts2.dispatcher.mapper.DefaultActionMapper.dropExtension(String, ActionMapping) to:

protected String dropExtension(String name, ActionMapping mapping) {
		if (extensions == null) {
			return name;
		}
		for (String ext : extensions) {
			if ("".equals(ext)) {
				return name;
			} else {
				String extension = "." + ext;
				if (name.endsWith(extension)) {
					name = name
							.substring(0, name.length() - extension.length());
					mapping.setExtension(ext);
					return name;
				}
			}
		}
		return null;
	}


Thus, if the empty extension is enabled, it accepts any URL, Which I think is what the user expects. If enabling the empty action by default is another story. I do not recomment it.

But IF the empty extension is enabled, it should be mapped as described in the original description of this issue. 
Or maybe by some addition parameters in struts.properties.

An idea for struts.properties would be adding something like:

struts.action.emptyExtension.enabled=true
struts.action.emptyExtension.mapping=/decorated_html/*,some_other_regExp


The result will, in my case, be a sitemesh-decorated html page when accession  the url /decorated_html/foo.html


      was (Author: p.leusmann):
    Possible solution:

Change com.byteshift.vobaclub.struts.VBClubActionMapper.dropExtension(String, ActionMapping) to:

protected String dropExtension(String name, ActionMapping mapping) {
		if (extensions == null) {
			return name;
		}
		for (String ext : extensions) {
			if ("".equals(ext)) {
				return name;
			} else {
				String extension = "." + ext;
				if (name.endsWith(extension)) {
					name = name
							.substring(0, name.length() - extension.length());
					mapping.setExtension(ext);
					return name;
				}
			}
		}
		return null;
	}


Thus, if the empty extension is enabled, it accepts any URL, Which I think is what the user expects. If enabling the empty action by default is another story. I do not recomment it.

But IF the empty extension is enabled, it should be mapped as described in the original description of this issue. 
Or maybe by some addition parameters in struts.properties.

An idea for struts.properties would be adding something like:

struts.action.emptyExtension.enabled=true
struts.action.emptyExtension.mapping=/decorated_html/*,some_other_regExp


The result will, in my case, be a sitemesh-decorated html page when accession  the url /decorated_html/foo.html

  
> Suport for decorating static content
> ------------------------------------
>
>                 Key: WW-3381
>                 URL: https://issues.apache.org/jira/browse/WW-3381
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - SiteMesh
>    Affects Versions: 2.1.8
>            Reporter: Philipp Leusmann
>            Priority: Critical
>   Original Estimate: 8h
>  Remaining Estimate: 8h
>
> In my case this issue is occuring when trying to decorate static content with sitemesh, but it generally is more an struts-core ActionMapper issue. 
> I was trying to decorate plain html files using the sitemesh-plugin.
> I expected it to work using the empty-string action mapper, and thus added a link to /decorated_html/foo.html . The reslut was an error page since all the variables in the template could not be resolved, due to a missing action.
> If org.apache.struts2.dispatcher.mapper.DefaultActionMapper.dropExtension(String, ActionMapping) would not return null for any url containing a dot but no slash and no supported action-extension after it, it would have worked.
> By looking at the tests, I found that the returned null was expected behaviour introduced for WW-2163.
> I think to resolve this issue it would have been better to promote more sofisticated filter mappings in the web.xml to avoid the empty action side effects described in a previous comment.
> In my case it would be sufficient to use filter mappings
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>decorated_html/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>sitemesh-struts</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>/decorated_html/*</url-pattern>
> </filter-mapping>

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


[jira] Commented: (WW-3381) Suport for decorating static content

Posted by "Philipp Leusmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WW-3381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12846831#action_12846831 ] 

Philipp Leusmann commented on WW-3381:
--------------------------------------

One addition:

To keep serving static content from jars working, an additional mapping is required:

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

> Suport for decorating static content
> ------------------------------------
>
>                 Key: WW-3381
>                 URL: https://issues.apache.org/jira/browse/WW-3381
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - SiteMesh
>    Affects Versions: 2.1.8
>            Reporter: Philipp Leusmann
>            Priority: Critical
>             Fix For: Future
>
>   Original Estimate: 8h
>  Remaining Estimate: 8h
>
> In my case this issue is occuring when trying to decorate static content with sitemesh, but it generally is more an struts-core ActionMapper issue. 
> I was trying to decorate plain html files using the sitemesh-plugin.
> I expected it to work using the empty-string action mapper, and thus added a link to /decorated_html/foo.html . The reslut was an error page since all the variables in the template could not be resolved, due to a missing action.
> If org.apache.struts2.dispatcher.mapper.DefaultActionMapper.dropExtension(String, ActionMapping) would not return null for any url containing a dot but no slash and no supported action-extension after it, it would have worked.
> By looking at the tests, I found that the returned null was expected behaviour introduced for WW-2163.
> I think to resolve this issue it would have been better to promote more sofisticated filter mappings in the web.xml to avoid the empty action side effects described in a previous comment.
> In my case it would be sufficient to use filter mappings
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>decorated_html/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>sitemesh-struts</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>/decorated_html/*</url-pattern>
> </filter-mapping>

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


[jira] Issue Comment Edited: (WW-3381) Suport for decorating static content

Posted by "Philipp Leusmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WW-3381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12852433#action_12852433 ] 

Philipp Leusmann edited comment on WW-3381 at 4/1/10 4:14 PM:
--------------------------------------------------------------

I don't know what changed in my setup, but something has. Suddenly decorating stati content works with the default ActionMapper and serving static content from jars does not work anymore.

 I will look into the issue again as soon as I have some spare time.

      was (Author: p.leusmann):
    I don't know what changed in my setup, but something has. Suddenly decorating stati content works with the default ActionMapper and serving content from jars did not work anymore.

 I will look into the issue again as soon as I have some spare time.
  
> Suport for decorating static content
> ------------------------------------
>
>                 Key: WW-3381
>                 URL: https://issues.apache.org/jira/browse/WW-3381
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - SiteMesh
>    Affects Versions: 2.1.8
>            Reporter: Philipp Leusmann
>            Priority: Critical
>             Fix For: Future
>
>   Original Estimate: 8h
>  Remaining Estimate: 8h
>
> In my case this issue is occuring when trying to decorate static content with sitemesh, but it generally is more an struts-core ActionMapper issue. 
> I was trying to decorate plain html files using the sitemesh-plugin.
> I expected it to work using the empty-string action mapper, and thus added a link to /decorated_html/foo.html . The reslut was an error page since all the variables in the template could not be resolved, due to a missing action.
> If org.apache.struts2.dispatcher.mapper.DefaultActionMapper.dropExtension(String, ActionMapping) would not return null for any url containing a dot but no slash and no supported action-extension after it, it would have worked.
> By looking at the tests, I found that the returned null was expected behaviour introduced for WW-2163.
> I think to resolve this issue it would have been better to promote more sofisticated filter mappings in the web.xml to avoid the empty action side effects described in a previous comment.
> In my case it would be sufficient to use filter mappings
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>decorated_html/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>sitemesh-struts</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>/decorated_html/*</url-pattern>
> </filter-mapping>

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


[jira] Commented: (WW-3381) Suport for decorating static content

Posted by "Philipp Leusmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WW-3381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12852433#action_12852433 ] 

Philipp Leusmann commented on WW-3381:
--------------------------------------

I don't know what changed in my setup, but something has. Suddenly decorating stati content works with the default ActionMapper and serving content from jars did not work anymore.

 I will look into the issue again as soon as I have some spare time.

> Suport for decorating static content
> ------------------------------------
>
>                 Key: WW-3381
>                 URL: https://issues.apache.org/jira/browse/WW-3381
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - SiteMesh
>    Affects Versions: 2.1.8
>            Reporter: Philipp Leusmann
>            Priority: Critical
>             Fix For: Future
>
>   Original Estimate: 8h
>  Remaining Estimate: 8h
>
> In my case this issue is occuring when trying to decorate static content with sitemesh, but it generally is more an struts-core ActionMapper issue. 
> I was trying to decorate plain html files using the sitemesh-plugin.
> I expected it to work using the empty-string action mapper, and thus added a link to /decorated_html/foo.html . The reslut was an error page since all the variables in the template could not be resolved, due to a missing action.
> If org.apache.struts2.dispatcher.mapper.DefaultActionMapper.dropExtension(String, ActionMapping) would not return null for any url containing a dot but no slash and no supported action-extension after it, it would have worked.
> By looking at the tests, I found that the returned null was expected behaviour introduced for WW-2163.
> I think to resolve this issue it would have been better to promote more sofisticated filter mappings in the web.xml to avoid the empty action side effects described in a previous comment.
> In my case it would be sufficient to use filter mappings
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>decorated_html/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>sitemesh-struts</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>/decorated_html/*</url-pattern>
> </filter-mapping>

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


[jira] Updated: (WW-3381) Suport for decorating static content

Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WW-3381?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukasz Lenart updated WW-3381:
------------------------------

    Fix Version/s: Future

> Suport for decorating static content
> ------------------------------------
>
>                 Key: WW-3381
>                 URL: https://issues.apache.org/jira/browse/WW-3381
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - SiteMesh
>    Affects Versions: 2.1.8
>            Reporter: Philipp Leusmann
>            Priority: Critical
>             Fix For: Future
>
>   Original Estimate: 8h
>  Remaining Estimate: 8h
>
> In my case this issue is occuring when trying to decorate static content with sitemesh, but it generally is more an struts-core ActionMapper issue. 
> I was trying to decorate plain html files using the sitemesh-plugin.
> I expected it to work using the empty-string action mapper, and thus added a link to /decorated_html/foo.html . The reslut was an error page since all the variables in the template could not be resolved, due to a missing action.
> If org.apache.struts2.dispatcher.mapper.DefaultActionMapper.dropExtension(String, ActionMapping) would not return null for any url containing a dot but no slash and no supported action-extension after it, it would have worked.
> By looking at the tests, I found that the returned null was expected behaviour introduced for WW-2163.
> I think to resolve this issue it would have been better to promote more sofisticated filter mappings in the web.xml to avoid the empty action side effects described in a previous comment.
> In my case it would be sufficient to use filter mappings
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>decorated_html/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>sitemesh-struts</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>/decorated_html/*</url-pattern>
> </filter-mapping>

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


[jira] Commented: (WW-3381) Better support for "empty extension actions"

Posted by "Philipp Leusmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WW-3381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12829064#action_12829064 ] 

Philipp Leusmann commented on WW-3381:
--------------------------------------

Possible solution:

Change com.byteshift.vobaclub.struts.VBClubActionMapper.dropExtension(String, ActionMapping) to:

protected String dropExtension(String name, ActionMapping mapping) {
		if (extensions == null) {
			return name;
		}
		for (String ext : extensions) {
			if ("".equals(ext)) {
				return name;
			} else {
				String extension = "." + ext;
				if (name.endsWith(extension)) {
					name = name
							.substring(0, name.length() - extension.length());
					mapping.setExtension(ext);
					return name;
				}
			}
		}
		return null;
	}


Thus, if the empty extension is enabled, it accepts any URL, Which I think is what the user expects. If enabling the empty action by default is another story. I do not recomment it.

But IF the empty extension is enabled, it should be mapped as described in the original description of this issue. 
Or maybe by some addition parameters in struts.properties.

An idea for struts.properties would be adding something like:

struts.action.emptyExtension.enabled=true
struts.action.emptyExtension.mapping=/decorated_html/*,some_other_regExp


The result will, in my case, be a sitemesh-decorated html page when accession  the url /decorated_html/foo.html


> Better support for "empty extension actions"
> --------------------------------------------
>
>                 Key: WW-3381
>                 URL: https://issues.apache.org/jira/browse/WW-3381
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Actions
>    Affects Versions: 2.1.8
>            Reporter: Philipp Leusmann
>
> The current support for the empty action extension is somehow strange. 
> This is a copy of my comment on the related issue, but I decided to open a new issue, to have any chance of getting attention:
> I was trying to decorate plain html files using the sitemesh-plugin.
> I expected it to work using the empty-string action mapper, and thus added a link to /decorated_html/foo.html . The reslut was an error page since all the variables in the template could not be resolved, due to a missing action.
> If org.apache.struts2.dispatcher.mapper.DefaultActionMapper.dropExtension(String, ActionMapping) would not return null for any url containing a dot but no slash and no supported action-extension after it, it would have worked.
> By looking at the tests, I found that the returned null was expected behaviour introduced for this issue.
> I think to resolve this issue it would have been better to promote more sofisticated filter mappings in the web.xml to avoid the empty action side effects described in a previous comment.
> In my case it would be sufficient to use filter mappings
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-prepare</filter-name>
> <url-pattern>decorated_html/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>sitemesh-struts</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>*.action</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2-execute</filter-name>
> <url-pattern>/decorated_html/*</url-pattern>
> </filter-mapping>

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