Example usage for org.springframework.http HttpHeaders ALLOW

List of usage examples for org.springframework.http HttpHeaders ALLOW

Introduction

In this page you can find the example usage for org.springframework.http HttpHeaders ALLOW.

Prototype

String ALLOW

To view the source code for org.springframework.http HttpHeaders ALLOW.

Click Source Link

Document

The HTTP Allow header field name.

Usage

From source file:nl.dtls.fairdatapoint.api.config.ApplicationFilter.java

@Override
public void doFilter(ServletRequest sr, ServletResponse sr1, FilterChain fc)
        throws IOException, ServletException {
    HttpServletResponse response = (HttpServletResponse) sr1;
    HttpServletRequest request = (HttpServletRequest) sr;
    response.setHeader(HttpHeaders.SERVER, "FAIR data point (JAVA)");
    response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "*");
    response.setHeader(HttpHeaders.ALLOW, (RequestMethod.GET.name()));
    response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, (HttpHeaders.ACCEPT));
    ThreadContext.put("ipAddress", request.getRemoteAddr());
    ThreadContext.put("responseStatus", String.valueOf(response.getStatus()));
    fc.doFilter(sr, sr1);//from  w  w w . j ava2s.  c  o  m
    ThreadContext.clearAll();
}