오태식
오태식

Reputation: 23

tiles url mapping with spring boot

I'm using tiles with spring boot, and want to mapping 2 url pattern

ex)

~~/something -> normal spring boot controller
~~/something.tiles -> tiles pattern

I checked each module works fine, but idont know how to map url pattern.

When i use Spring, i was configured dispatcherServlet setting in web.xml like this

<servlet>
    <servlet-name>Tiles Dispatch Servlet</servlet-name>
    <servlet-class>org.apache.tiles.web.util.TilesDispatchServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>Tiles Dispatch Servlet</servlet-name>
    <url-pattern>*.tiles</url-pattern>
</servlet-mapping>

but how can i configure it in spring boot?

Upvotes: 2

Views: 817

Answers (1)

shazin
shazin

Reputation: 21883

You can add a ServletRegistrationBean annotated with @Bean in one of your @Configuration classes

   @Bean
   public ServletRegistrationBean tilesServletRegistrationBean() {
      return new ServletRegistrationBean(new TilesDispatchServlet(), "*.tiles");
   }

Upvotes: 1

Related Questions