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:49:28 UTC

[jira] Commented: (WW-2163) Support actions with no extensions, including directory urls

    [ https://issues.apache.org/jira/browse/WW-2163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12829059#action_12829059 ] 

Philipp Leusmann commented on WW-2163:
--------------------------------------

I also think the resuting behaviour for this fix does not work out very good.
For example 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>

> Support actions with no extensions, including directory urls
> ------------------------------------------------------------
>
>                 Key: WW-2163
>                 URL: https://issues.apache.org/jira/browse/WW-2163
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Dispatch Filter
>    Affects Versions: 2.0.9
>            Reporter: Don Brown
>            Assignee: Don Brown
>             Fix For: 2.1.0
>
>
> Currently, you cannot really expose your actions without using an extension via the 'struts.action.extension' setting.  If you set it to an empty string, Struts will try to handle every URL as an action, not only blocking webapp static resources but also its internally served static resources.  Furthermore, you cannot define an action that will respond to a directory url (http://foo.com/myapp/dir/), without using a workaround like a redirection jsp page.
> This improvement would allow actions to be accessed without an extension, but still allow static resources and other extensions.  In otherwords, the death of the ".action" extension.

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