1

When trying to stop a job from within the spring-batch-admin webapp (version 1.3.0) the follwing error page appears:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Sep 04 17:57:05 CEST 2014
There was an unexpected error (type=Method Not Allowed, status=405).
Request method 'POST' not supported

The controller expects a DELETE method to stop the job, but from the stop button a POST is triggered. Does anyone know how to fix that?

enter image description here

EDIT: I did some further research and stumbled upon a three years old post from the spring forum. It suggests that I am probably missing a HiddenMethodFilter in my web.xml. As I integrated the batch-admin into a spring boot application there might be a configuration issue. Now I just need to figure out how to add the afromentioned filter to my spring-boot-mvc defaults.

EDIT: I gradually understand better what's going on under the hood. I asked a more specific question to my problem here.

Any help is appreciated!

Community
  • 1
  • 1
achingfingers
  • 1,827
  • 5
  • 24
  • 48

2 Answers2

1

The same filters can be configured via the web.xml like this

<filter>
    <filter-name>shallowEtagHeaderFilter</filter-name>
    <filter-class>org.springframework.web.filter.ShallowEtagHeaderFilter</filter-class>
</filter>

<filter>
    <filter-name>hiddenHttpMethodFilter</filter-name>
    <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>shallowEtagHeaderFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<filter-mapping>
    <filter-name>hiddenHttpMethodFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
emeraldjava
  • 10,894
  • 26
  • 97
  • 170
0

My servlet configuration was missing the following beans:

import org.springframework.web.filter.HiddenHttpMethodFilter;
import org.springframework.web.filter.ShallowEtagHeaderFilter;

@Bean
public Filter shallowEtagHeaderFilter() {
  ShallowEtagHeaderFilter filter = new ShallowEtagHeaderFilter();
  return filter; 
}

@Bean
public Filter hiddenHttpMethodFilter() {
  HiddenHttpMethodFilter filter = new HiddenHttpMethodFilter();      
  return filter;
}
achingfingers
  • 1,827
  • 5
  • 24
  • 48