Package org.springframework.security.web.firewall

# Class HttpStatusRequestRejectedHandler

java.lang.Object
org.springframework.security.web.firewall.HttpStatusRequestRejectedHandler

All Implemented Interfaces:
  `RequestRejectedHandler`

public class HttpStatusRequestRejectedHandler extends Object implements RequestRejectedHandler
A simple implementation of `RequestRejectedHandler` that sends an error with configurable status code.

Since:
  5.4

## Constructor Summary

Constructors
Constructor
Description
`HttpStatusRequestRejectedHandler()`
Constructs an instance which uses `400` as response code.
`HttpStatusRequestRejectedHandler(int httpError)`
Constructs an instance which uses a configurable http code as response.

## Method Summary

Modifier and Type
Method
Description
`void`
`handle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, RequestRejectedException requestRejectedException)`
Handles an request rejected failure.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### HttpStatusRequestRejectedHandler

public HttpStatusRequestRejectedHandler()
Constructs an instance which uses `400` as response code.

### HttpStatusRequestRejectedHandler

public HttpStatusRequestRejectedHandler(int httpError)
Constructs an instance which uses a configurable http code as response.

Parameters:
  `httpError` - http status code to use

## Method Details

### handle

public void handle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, RequestRejectedException requestRejectedException) throws IOException
Description copied from interface: `RequestRejectedHandler`
Handles an request rejected failure.

Specified by:
  `handle` in interface `RequestRejectedHandler`
Parameters:
  `request` - that resulted in an `RequestRejectedException`
  `response` - so that the user agent can be advised of the failure
  `requestRejectedException` - that caused the invocation
Throws:
  `IOException` - in the event of an IOException