ICEpush
  1. ICEpush
  2. PUSH-70

icechat-spring does not make resources available

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Alpha3
    • Fix Version/s: 2.0-Alpha3
    • Component/s: Samples
    • Labels:
      None
    • Environment:
      ICEpush

      Description

      Images and CSS files are not being served by the icechat-spring demo.

        Activity

        Repository Revision Date User Message
        ICEsoft Public SVN Repository #21220 Wed Apr 14 11:14:28 MDT 2010 ted.goddard serve resources directly from controller (PUSH-70)
        Files Changed
        Commit graph MODIFY /scratchpads/snowplow/samples/icechat/spring/src/main/java/org/icepush/samples/icechat/spring/mvc/ChatController.java
        Commit graph MODIFY /scratchpads/snowplow/samples/icechat/spring/src/main/webapp/WEB-INF/web.xml
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #21221 Wed Apr 14 12:44:40 MDT 2010 ted.goddard also serve javascript from controller (PUSH-70)
        Files Changed
        Commit graph MODIFY /scratchpads/snowplow/samples/icechat/spring/src/main/java/org/icepush/samples/icechat/spring/mvc/ChatController.java
        Ted Goddard created issue -
        Hide
        Ted Goddard added a comment -

        Spring DispatcherServlet is mapped to "/" to provide REST URLs in the application, but this interferes with default static resource serving:

        <servlet>
        <servlet-name>chat</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
        <servlet-name>chat</servlet-name>
        <url-pattern>/</url-pattern>
        </servlet-mapping>

        It is possible to map *.jpg, *.css to the Servlet named "default", but this is only provided by Tomcat.

        A portable method should use Spring dispatch.

        Show
        Ted Goddard added a comment - Spring DispatcherServlet is mapped to "/" to provide REST URLs in the application, but this interferes with default static resource serving: <servlet> <servlet-name>chat</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>chat</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> It is possible to map *.jpg, *.css to the Servlet named "default", but this is only provided by Tomcat. A portable method should use Spring dispatch.
        Hide
        Ted Goddard added a comment -

        Implementation verified on both Tomcat and GlassFish v3.

        Current code contains:

        InputStream fileStream = session.getServletContext().getResourceAsStream(filePath);

        which causes the creation of a session just for serving resources. This should be optimized
        by implementing ServletContextAware and obtaining the ServletContext without the HttpSession reference.

        (Even better would be to add getServletContext() to ServletRequest.)

        Show
        Ted Goddard added a comment - Implementation verified on both Tomcat and GlassFish v3. Current code contains: InputStream fileStream = session.getServletContext().getResourceAsStream(filePath); which causes the creation of a session just for serving resources. This should be optimized by implementing ServletContextAware and obtaining the ServletContext without the HttpSession reference. (Even better would be to add getServletContext() to ServletRequest.)
        Ted Goddard made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0-Alpha3 [ 10224 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Ted Goddard
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: