Code example for HttpPost

Methods: abort

0
                authResponseData.append(reader.readLine());
            } catch (RuntimeException ex) {
                // In case of an unexpected exception you may want to abort 
                // the HTTP request in order to shut down the underlying 
                // connection and release it back to the connection manager. 
                httppost.abort();
                LOGGER.throwing(AuthServlet.class.getName(), "doLogin", ex);
                throw ex;
            } finally { 
                // Closing the input stream will trigger connection release 
                if (reader != null) {
                    reader.close();
                } 
            } 
 
            // When HttpClient instance is no longer needed, 
            // shut down the connection manager to ensure 
            // immediate deallocation of all system resources 
            httpclient.getConnectionManager().shutdown();
        }