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

        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.)

          People

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

            Dates

            • Created:
              Updated:
              Resolved: