Search code examples
javaspringurl-mapping

Spring 3.1 ViewResolver for local content (swf object)


In my project my jsp form contains a swf object which is placed in "WEB-INF/fl". When I publish project I am getting "url mapping not found" error for swf object. How can I make my local content available?

My ViewResolver Bean:

<context:component-scan base-package="com.udb.common.controllers" />

<bean 
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix">
        <value>/WEB-INF/pages/</value>
    </property>
    <property name="suffix">
        <value>.jsp</value>
    </property>
</bean>

Controller class:

@Controller
public class LoginController{


    @RequestMapping(value="/welcome",method=RequestMethod.GET)
    public String printWelcome(ModelMap map, Principal principal){

        String name = principal.getName();
        map.addAttribute("username", name);
        map.addAttribute("message", "Spring Security Custom Form Exmple");


        return "hello";

    }

But when I publish project on server I am getting below error:

Dec 30, 2011 3:49:29 AM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/security/param.swf] in DispatcherServlet with name 'mvc-dispatcher'

Solution

  • To serve static content using the tag

    <mvc:resources mapping="/security/**" location="/fl/" />