|
|
@ -1,9 +1,12 @@ |
|
|
|
package org.libresonic.player.boot; |
|
|
|
package org.libresonic.player.boot; |
|
|
|
|
|
|
|
|
|
|
|
import org.directwebremoting.servlet.DwrServlet; |
|
|
|
import org.directwebremoting.servlet.DwrServlet; |
|
|
|
|
|
|
|
import org.libresonic.player.filter.RESTFilter; |
|
|
|
|
|
|
|
import org.libresonic.player.security.RESTRequestParameterProcessingFilter; |
|
|
|
import org.springframework.boot.SpringApplication; |
|
|
|
import org.springframework.boot.SpringApplication; |
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|
|
|
import org.springframework.boot.builder.SpringApplicationBuilder; |
|
|
|
import org.springframework.boot.builder.SpringApplicationBuilder; |
|
|
|
|
|
|
|
import org.springframework.boot.web.servlet.FilterRegistrationBean; |
|
|
|
import org.springframework.boot.web.servlet.ServletRegistrationBean; |
|
|
|
import org.springframework.boot.web.servlet.ServletRegistrationBean; |
|
|
|
import org.springframework.boot.web.support.SpringBootServletInitializer; |
|
|
|
import org.springframework.boot.web.support.SpringBootServletInitializer; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
@ -19,6 +22,11 @@ import org.springframework.context.annotation.ImportResource; |
|
|
|
"classpath:/libresonic-servlet.xml"}) |
|
|
|
"classpath:/libresonic-servlet.xml"}) |
|
|
|
public class Application extends SpringBootServletInitializer { |
|
|
|
public class Application extends SpringBootServletInitializer { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Registers the DWR servlet. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return a registration bean. |
|
|
|
|
|
|
|
*/ |
|
|
|
@Bean |
|
|
|
@Bean |
|
|
|
public ServletRegistrationBean dwrServletRegistrationBean() { |
|
|
|
public ServletRegistrationBean dwrServletRegistrationBean() { |
|
|
|
ServletRegistrationBean servlet = new ServletRegistrationBean(new DwrServlet(), "/dwr/*"); |
|
|
|
ServletRegistrationBean servlet = new ServletRegistrationBean(new DwrServlet(), "/dwr/*"); |
|
|
@ -26,6 +34,21 @@ public class Application extends SpringBootServletInitializer { |
|
|
|
return servlet; |
|
|
|
return servlet; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Registers the rest servlet filter. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return a registration bean. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Bean |
|
|
|
|
|
|
|
public FilterRegistrationBean restFilterRegistration() { |
|
|
|
|
|
|
|
FilterRegistrationBean registration = new FilterRegistrationBean(); |
|
|
|
|
|
|
|
registration.setFilter(new RESTFilter()); |
|
|
|
|
|
|
|
registration.addUrlPatterns("/rest/*"); |
|
|
|
|
|
|
|
registration.setName("RESTFilter"); |
|
|
|
|
|
|
|
return registration; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
|
|
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
|
|
|