struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Benitez (JIRA)" <j...@apache.org>
Subject [jira] [Issue Comment Edited] (WW-3601) Files starting with "struts" (e.g., "struts.jsp") give 404
Date Thu, 28 Apr 2011 04:28:03 GMT

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

Steven Benitez edited comment on WW-3601 at 4/28/11 4:27 AM:
-------------------------------------------------------------

You guessed it -- the issue is in DefaultStaticContentLoader:345.

public boolean canHandle(String resourcePath) {
    return serveStatic && (resourcePath.startsWith("/struts") || resourcePath.startsWith("/static"));
}

I think it is safe to change it to check for "/struts/" or "/static/" without worry that this
would break anything. The expectation is that you would be referencing an individual file,
for which there would always be a trailing slash after those strings.

      was (Author: sbenitez):
    You guessed it -- the issue is in DefaultStaticContentLoader:345.

{{
public boolean canHandle(String resourcePath) {
    return serveStatic && (resourcePath.startsWith("/struts") || resourcePath.startsWith("/static"));
}
}}

I think it is safe to change it to check for "/struts/" or "/static/" without worry that this
would break anything. The expectation is that you would be referencing an individual file,
for which there would always be a trailing slash after those strings.
  
> Files starting with "struts" (e.g., "struts.jsp") give 404
> ----------------------------------------------------------
>
>                 Key: WW-3601
>                 URL: https://issues.apache.org/jira/browse/WW-3601
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.0, 2.1.8, 2.2.1.1
>         Environment: Operating System:Windows 7
> JDK-version:1.6
> Tomcat-version:7.0.6
>            Reporter: Li Hao Su
>            Priority: Minor
>              Labels: 404-error, filename, request
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> I hope I can explain this bug clear. Forgive me my poor English.
> When I make a file, the filename likes 'struts.jsp', I request this page in my IE, for
example 'http://localhost/struts.jsp', it tells me a 404-error.
> Then I changed the name to '123struts.jsp', request again,  I got the page.
> But if I named the page 'struts123.jsp', it'll give me the 404-error again.
> I also tried to change the suffix, like 'struts.html', while it's happened again, even
though I changed the name like 'struts.txt'.
> This bug has occurred in Struts2.0.0, 2.1.8 and 2.2.1.1.
> Of couse, if I do not use the Struts2, this bug disappeared.
> Thanks.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message