public boolean isContentTypeValid ( HttpHeaders headers ) { String contentType = headers . get ( HttpHeaders . Names . CONTENT_TYPE ) ; // if we get no Content-Type or we get application/json, then it's valid // any other, it's invalid return ( Strings . isNullOrEmpty ( contentType ) || contentType . toLowerCase ( ) . contains ( MEDIA_TYPE_APPLICATION_JSON ) ) ; }
Checks the Content - Type header to see if clients specify the right media type