0

everyone! Please, I have a Spring boot project in my computer and I need access an external thymeleaf file, but I have no idea how to do this.

Here is my code bellow

@GetMapping("/produtos")
public ModelAndView produtos(HttpServletRequest request, ProdutoFilter produtoFilter) {
    ModelAndView mv = new ModelAndView("/product");

And I need to redirect this request to a external folder. A folder that it is not inside the project folders.

Thank you!

Tiago Mussi
  • 801
  • 3
  • 13
  • 20
  • [This](https://stackoverflow.com/questions/32339172/add-external-resources-folder-to-spring-boot) might help. – Andrew S Jul 17 '18 at 15:01
  • I don't think so. The link you given is about access a static resource, and the OP is about resolving a view. Generally, it is the same, but it should relate to ViewResolver but not ResourceHandler – kidnan1991 Jul 17 '18 at 15:23
  • what about if i tryed to use jsp and servlet to do this? can i solve this problem? – Guilherme Santana Jul 17 '18 at 15:38

1 Answers1

0

Please configure UrllTemplateResolver and set higher priority.

@Bean
    public UrlTemplateResolver urltemplateResolver()
    {

        LOGGER.info( "Initializing second view resolver to bind the url templates..." );
        UrlTemplateResolver urltemplateResolver = new UrlTemplateResolver();
        urltemplateResolver.setCacheable( Boolean.TRUE );
        urltemplateResolver.setCharacterEncoding( CHARACTER_ENCODING );
        // urltemplateResolver.setCacheTTLMs( ( long ) 10000 );
        urltemplateResolver.setOrder( 1);
        return urltemplateResolver;
    }
Supun Dharmarathne
  • 1,138
  • 1
  • 10
  • 19