You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Mike McMahon (JIRA)" <ji...@apache.org> on 2006/09/24 02:23:31 UTC

[jira] Updated: (WW-1451) struts.action.extension=html

     [ http://issues.apache.org/struts/browse/WW-1451?page=all ]

Mike McMahon updated WW-1451:
-----------------------------

    Description: 
Some folks (such as AppFuse) like to set struts.action.extension=html
Thats fine but that it becomes impossible to use Strut's Dojo widgets like
struts/dojo/struts/widgets/BindButton.html  due to a "no Action mapped " exception

It would be pretty simple to modify FilterDispatcher.doFilter as below to first look for an
action mapping, and if none is found, then check to see if Struts would otherwise serve
an internal static resource.

        if (mapping == null ||
        (mapping.getMethod() == null && ("").equals(mapping.getNamespace()) && mapping.getParams() == null && mapping.getResult() == null
        && "true".equals(Settings.get(StrutsConstants.STRUTS_SERVE_STATIC_CONTENT)))) {    
            // there is no action in this request, should we look for a static resource?
            String resourcePath = RequestUtils.getServletPath(request);

            if ("".equals(resourcePath) && null != request.getPathInfo()) {
                resourcePath = request.getPathInfo();
            }

            if ("true".equals(Settings.get(StrutsConstants.STRUTS_SERVE_STATIC_CONTENT))
                    && resourcePath.startsWith("/struts")) {
                String name = resourcePath.substring("/struts".length());
                findStaticResource(name, response);
                return;
            } else if (mapping == null){
                // this is a normal request, let it pass through
                chain.doFilter(request, response);
            }
            if (mapping == null)  // The framework did its job here
            return;
        }
 

  was:
Some folks (such as AppFuse) like to set struts.action.extension=html
Thats fine but that it becomes impossible to use Strut's Dojo widgets like
struts/dojo/struts/widgets/BindButton.html  due to a "no Action mapped " exception

It would be pretty simple to modify FilterDispatcher.doFilter as below to first look for an
action mapping, and if none is found, then check to see if Struts would otherwise serve
an internal static resource.

        if (mapping == null ||
        (mapping.getMethod() == null && ("").equals(mapping.getNamespace()) && mapping.getParams() == null && mapping.getResult() == null
        && "true".equals(Settings.get(StrutsConstants.STRUTS_SERVE_STATIC_CONTENT)))) {    
            // there is no action in this request, should we look for a static resource?
            String resourcePath = RequestUtils.getServletPath(request);

            if ("".equals(resourcePath) && null != request.getPathInfo()) {
                resourcePath = request.getPathInfo();
            }

            if ("true".equals(Settings.get(StrutsConstants.STRUTS_SERVE_STATIC_CONTENT))
                    && resourcePath.startsWith("/struts")) {
                String name = resourcePath.substring("/struts".length());
                findStaticResource(name, response);
            } else if (mapping == null){
                // this is a normal request, let it pass through
                chain.doFilter(request, response);
            }
            if (mapping == null)  // The framework did its job here
            return;
        }
 


> struts.action.extension=html
> ----------------------------
>
>                 Key: WW-1451
>                 URL: http://issues.apache.org/struts/browse/WW-1451
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Dispatch
>    Affects Versions: 2.0.0
>            Reporter: Mike McMahon
>            Priority: Minor
>
> Some folks (such as AppFuse) like to set struts.action.extension=html
> Thats fine but that it becomes impossible to use Strut's Dojo widgets like
> struts/dojo/struts/widgets/BindButton.html  due to a "no Action mapped " exception
> It would be pretty simple to modify FilterDispatcher.doFilter as below to first look for an
> action mapping, and if none is found, then check to see if Struts would otherwise serve
> an internal static resource.
>         if (mapping == null ||
>         (mapping.getMethod() == null && ("").equals(mapping.getNamespace()) && mapping.getParams() == null && mapping.getResult() == null
>         && "true".equals(Settings.get(StrutsConstants.STRUTS_SERVE_STATIC_CONTENT)))) {    
>             // there is no action in this request, should we look for a static resource?
>             String resourcePath = RequestUtils.getServletPath(request);
>             if ("".equals(resourcePath) && null != request.getPathInfo()) {
>                 resourcePath = request.getPathInfo();
>             }
>             if ("true".equals(Settings.get(StrutsConstants.STRUTS_SERVE_STATIC_CONTENT))
>                     && resourcePath.startsWith("/struts")) {
>                 String name = resourcePath.substring("/struts".length());
>                 findStaticResource(name, response);
>                 return;
>             } else if (mapping == null){
>                 // this is a normal request, let it pass through
>                 chain.doFilter(request, response);
>             }
>             if (mapping == null)  // The framework did its job here
>             return;
>         }
>  

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira