protected < T , E > T handleResponse ( final HttpURLConnection connection , final DataTypeDescriptor < T > datad , final DataTypeDescriptor < E > errord ) throws IOException { connection . connect ( ) ; int status = connection . getResponseCode ( ) ; if ( status == HttpURLConnection . HTTP_OK ) { // It's a successful response, try to read the result. return readResult ( connection , datad ) ; } else if ( status == APPLICATION_EXC_STATUS ) { // It's an expected application exception. throw ( RuntimeException ) readApplicationException ( connection , errord ) ; } else { // Something bad happened, try to read the error message. throw readError ( connection ) ; } }
Reads a response .