Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3630

Spring - checking path variable for null at controller

$
0
0

I define a path variable at controller Get request using:

@PathVariable("ticketId") final Long ticketId

How can I check this value is not null ?

Reading https://www.baeldung.com/spring-validate-requestparam-pathvariable@NotBlank is utilised but checking for null is not mentioned.

Using:

if ticketId == Null {//return message indicating to user that null has been passed to path}

Seems a bad practice and instead try/catch should be used ?


Viewing all articles
Browse latest Browse all 3630

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>