Package org.springframework.web.bind

# Class MissingPathVariableException

java.lang.Object
java.lang.Throwable
java.lang.Exception
jakarta.servlet.ServletException
org.springframework.web.bind.ServletRequestBindingException
org.springframework.web.bind.MissingRequestValueException
org.springframework.web.bind.MissingPathVariableException

All Implemented Interfaces:
  `Serializable`, `ErrorResponse`

public class MissingPathVariableException extends MissingRequestValueException
`ServletRequestBindingException` subclass that indicates that a path variable expected in the method parameters of an `@RequestMapping` method is not present among the URI variables extracted from the URL. Typically that means the URI template does not match the path variable name declared on the method parameter.

Since:
  4.2
Author:
  Rossen Stoyanchev
See Also:
  - `MissingMatrixVariableException`
  - Serialized Form

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.springframework.web.ErrorResponse

`ErrorResponse.Builder, ErrorResponse.Interceptor`

## Constructor Summary

Constructors
Constructor
Description
`MissingPathVariableException(String variableName, org.springframework.core.MethodParameter parameter)`
Constructor for MissingPathVariableException.
`MissingPathVariableException(String variableName, org.springframework.core.MethodParameter parameter, boolean missingAfterConversion)`
Constructor for use when a value was present but converted to `null`.

## Method Summary

Modifier and Type
Method
Description
`String`
`getMessage()`
`final org.springframework.core.MethodParameter`
`getParameter()`
Return the method parameter bound to the path variable.
`HttpStatusCode`
`getStatusCode()`
Return the HTTP status code to use for the response.
`final String`
`getVariableName()`
Return the expected name of the path variable.

### Methods inherited from class org.springframework.web.bind.MissingRequestValueException

`isMissingAfterConversion`

### Methods inherited from class org.springframework.web.bind.ServletRequestBindingException

`getBody, getDetailMessageArguments, getDetailMessageCode`

### Methods inherited from class jakarta.servlet.ServletException

`getRootCause`

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

`addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

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

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

### Methods inherited from interface org.springframework.web.ErrorResponse

`getDetailMessageArguments, getHeaders, getTitleMessageCode, getTypeMessageCode, updateAndGetBody`

## Constructor Details

### MissingPathVariableException

public MissingPathVariableException(String variableName, org.springframework.core.MethodParameter parameter)
Constructor for MissingPathVariableException.

Parameters:
  `variableName` - the name of the missing path variable
  `parameter` - the method parameter

### MissingPathVariableException

public MissingPathVariableException(String variableName, org.springframework.core.MethodParameter parameter, boolean missingAfterConversion)
Constructor for use when a value was present but converted to `null`.

Parameters:
  `variableName` - the name of the missing path variable
  `parameter` - the method parameter
  `missingAfterConversion` - whether the value became null after conversion
Since:
  5.3.6

## Method Details

### getMessage

public String getMessage()

Overrides:
  `getMessage` in class `Throwable`

### getVariableName

public final String getVariableName()
Return the expected name of the path variable.

### getParameter

public final org.springframework.core.MethodParameter getParameter()
Return the method parameter bound to the path variable.

### getStatusCode

public HttpStatusCode getStatusCode()
Description copied from interface: `ErrorResponse`
Return the HTTP status code to use for the response.

Specified by:
  `getStatusCode` in interface `ErrorResponse`
Overrides:
  `getStatusCode` in class `ServletRequestBindingException`