@ Override public boolean isBodyExpected ( ) { if ( VersionValues . V10 . equals ( getVersionValue ( ) ) ) { // if 1.0 then check the isBodyAllowed because the scenario of 1.0 // servers dumping bodies and closing the socket without any body // indicator throws this logic off return isBodyAllowed ( ) ; } // sending a body with the response is not valid for a HEAD request if ( getServiceContext ( ) . getRequestMethod ( ) . equals ( MethodValues . HEAD ) ) { return false ; } // base layer checks explicit length markers (chunked, content-length); boolean rc = super . isBodyExpected ( ) ; if ( ! rc ) { // if content-length or chunked encoding don't explicitly mark a body // we could still have one if certain content headers are present since // a response can be sent until socket closure with no length delimiters rc = containsHeader ( HttpHeaderKeys . HDR_CONTENT_ENCODING ) || containsHeader ( HttpHeaderKeys . HDR_CONTENT_RANGE ) ; } if ( rc ) { // if we think a body exists, then check the status code flag rc = this . myStatusCode . isBodyAllowed ( ) ; } return rc ; }
Query whether a body is expected to be present with this message . Note that this is only an expectation and not a definitive answer . This will check the necessary headers status codes etc to see if any indicate a body should be present . Without actually reading for a body this cannot be sure however .