title: Problems with Spring Security 4 and REST, does not display HTML files
body: <p>I have a problem with my proyect, I've tried to configure Spring Security 4 with Spring REST, but there is a problem when I try to access with any context.</p>
  
  <p>Here  is my project structure:</p>
  
  <p><a href="https://i.stack.imgur.com/sPmrX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sPmrX.png" alt="enter image description here"></a></p>
  
  <p>Inside of "views" are my html pages.</p>
  
  <p>And here is my spring configuration.</p>
  
  <pre><code>&lt;import resource="classpath:applicationContext-business.xml"/&gt;
  &lt;mvc:annotation-driven /&gt;
  
  
  &lt;security:http auto-config="true" &gt;
  
      &lt;security:intercept-url pattern="/" access="permitAll" /&gt;
      &lt;security:intercept-url pattern="/home" access="permitAll" /&gt;
  
      &lt;security:form-login  login-page="/iniciar_sesion"
                   username-parameter="email"
                   password-parameter="password"
                   authentication-failure-url="/Access_Denied" /&gt;
      &lt;security:csrf/&gt;
  
  &lt;/security:http&gt;
  &lt;context:component-scan base-package="turing.solutions.dy.web" &gt;
      &lt;context:include-filter type="regex" expression=".*\.(.)*"/&gt;
      &lt;context:exclude-filter type="regex" expression="security"/&gt;
  &lt;/context:component-scan&gt;
  
  &lt;bean id="customUserDetailsService" class="turing.solutions.dy.web.security.CustomUserDetailService" /&gt;
  
  &lt;security:authentication-manager&gt;
      &lt;security:authentication-provider user-service-ref="customUserDetailsService"/&gt;
  &lt;/security:authentication-manager&gt;
  </code></pre>
  
  <p>And my web.xml</p>
  
  <pre><code>&lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;dy&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;dy&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  
  &lt;filter&gt;
      &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
      &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
  &lt;/filter&gt;
  
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  
  &lt;session-config&gt;
      &lt;session-timeout&gt;
          10
      &lt;/session-timeout&gt;
  &lt;/session-config&gt;
  &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  </code></pre>
  
  <p>And this is my RestController:</p>
  
  <pre><code>@RestController
  public class LoginController {
  
  @RequestMapping(value = { "/", "/home" }, method = RequestMethod.GET)
  public String homePage() {
      System.out.println("Redirect");
      return "index";
  }
  
  @RequestMapping(value="iniciar_sesion",method = RequestMethod.GET)
  public String iniciarSession(ModelMap model){
      model.put("login", "log");
      return "iniciar_sesion";
  }
  
  @RequestMapping(value = "/login", method = RequestMethod.POST, produces = "application/json")
  public Map&lt;String, Object&gt; login() {
      Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;();
      map.put("login", "ok");
      return map;
  }
  
  @RequestMapping(value = "/Access_Denied", method = RequestMethod.GET)
  public String accessDeniedPage(ModelMap model) {
      model.addAttribute("user", getPrincipal());
      return "accessDenied";
  }
  
  private String getPrincipal() {
      String userName = null;
      Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
  
      if (principal instanceof UserDetails) {
          userName = ((UserDetails) principal).getUsername();
      } else {
          userName = principal.toString();
      }
      return userName;
  }
  
  }
  </code></pre>
  
  <p>Ant this is my CustomUserDetailService</p>
  
  <pre><code>@Service("customUserDetailService")
  public class CustomUserDetailService implements UserDetailsService {
  
  @Autowired
  private UsuariosService usuariosService;
  
  @Override
  public UserDetails loadUserByUsername(String correo) throws UsernameNotFoundException {
      Usuarios usuario = this.usuariosService.findByCorreo(correo);
      if (usuario == null) {
          throw new UsernameNotFoundException("El usuairo " + correo + " no existe, favor de verificar");
      }
      return new User(usuario.getEmail(), usuario.getPassword(), usuario.getActivo(), true, true, true, getGrantedAuthorities(usuario));
  }
  
  private List&lt;GrantedAuthority&gt; getGrantedAuthorities(Usuarios usuario) {
      List&lt;GrantedAuthority&gt; authorities = new ArrayList&lt;GrantedAuthority&gt;();
      for (Roles rol : usuario.getRolesList()) {
          System.out.println("Usuario " + usuario.getEmail() + " ROl" + rol.getDescRol().toUpperCase());
          authorities.add(new SimpleGrantedAuthority("ROLE_" + rol.getDescRol().toUpperCase()));
      }
      return authorities;
  }
  }
  </code></pre>
  
  <p>When I try to access to the URL "<a href="http://localhost:9080/DespreocupateYA/home" rel="nofollow noreferrer">http://localhost:9080/DespreocupateYA/home</a>" I see this</p>
  
  <p><a href="https://i.stack.imgur.com/1Lu6s.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1Lu6s.png" alt="enter image description here"></a></p>
  
  <p>But I should see this</p>
  
  <p><a href="https://i.stack.imgur.com/bvGv4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bvGv4.png" alt="enter image description here"></a></p>
  
  <p>So,my question is: Why i can't see the html pages in my project? I've searched and I found many Spring configurations, but I've not been able to solve the problem.</p>
  
  <p>My Server is an Apache Tomcat 8.0.28.</p>
  
  <p>I hope you can help me, Thanks.</p>