Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3564

Unable to find a result type for extension

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.2.1
    • 2.3.1
    • Plugin - Convention
    • None
    • windows xp, spring 2.5, tomcat 5.0.28, struts2-convention-plugin-2.2.1.jar

    Description

      I set a convention constant like this below:
      ==========================================================================================
      <constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
      ==========================================================================================

      After I deployed my project to tomcat server, I backup a file "search.jsp" and named the backup file with "search.jsp.bak", There is a class named with "SearchAction"。The action's search method is annotated by @Action, like this:
      ==========================================================================================
      @Action(value = "search", results =

      { @Result(name = "search", location = "/WEB-INF/jsp/search.jsp") }

      )
      ==========================================================================================

      When I startup tomcat server, I recieved some message:
      ==========================================================================================
      Unable to find a result type for extension [bak] in location attribute [/WEB-INF/jsp/search.jsp.bak]. - [unknown location]
      ==========================================================================================

      Then I checked org.apache.struts2.convention.DefaultResultMapBuilder.java, I found this exception throwing at line 527。
      I debug that snippet, At line 269, I found some problems,ServletContext.getResourcePaths() method will scan a directory and its sub-directory and return all files in these directories, If a file's extension is not jsp, jspx,vm,ftl,html or htm。 I would get the error。

      So I think this code need to be change to fix this problem。

      Attachments

        1. 11.jpg
          93 kB
          Dan Du
        2. 1.jpg
          9 kB
          Dan Du
        3. 2.jpg
          16 kB
          Dan Du
        4. DefaultResultMapBuilder.java
          24 kB
          Dan Du

        Activity

          People

            jogep Johannes Geppert
            lendo.du Dan Du
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: