Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpGet.abort()


                            object.setMimeType(segment.get("content_type").getAsString());
                            containerSegments.add(object);
                        }
                    }
                    else {
                        method.abort();
                        throw new GenericException(response);
                    }
                }
            }
            else {
View Full Code Here


        Response response = this.execute(method);
        if(response.getStatusCode() == HttpStatus.SC_OK) {
            return response.getResponseBodyAsStream();
        }
        else if(response.getStatusCode() == HttpStatus.SC_NOT_FOUND) {
            method.abort();
            throw new NotFoundException(response);
        }
        else {
            method.abort();
            throw new GenericException(response);
View Full Code Here

        else if(response.getStatusCode() == HttpStatus.SC_NOT_FOUND) {
            method.abort();
            throw new NotFoundException(response);
        }
        else {
            method.abort();
            throw new GenericException(response);
        }
    }

    public ContentLengthInputStream getObject(Region region, String container, String object, long offset, long length) throws IOException {
View Full Code Here

        Response response = this.execute(method);
        if(response.getStatusCode() == HttpStatus.SC_PARTIAL_CONTENT) {
            return response.getResponseBodyAsStream();
        }
        else if(response.getStatusCode() == HttpStatus.SC_NOT_FOUND) {
            method.abort();
            throw new NotFoundException(response);
        }
        else {
            method.abort();
            throw new GenericException(response);
View Full Code Here

        else if(response.getStatusCode() == HttpStatus.SC_NOT_FOUND) {
            method.abort();
            throw new NotFoundException(response);
        }
        else {
            method.abort();
            throw new GenericException(response);
        }
    }

    public void updateObjectManifest(Region region, String container, String object, String manifest) throws IOException {
View Full Code Here

            }
            EntityUtils.consume(entity);

            return result;
        } catch (IOException e) {
            get.abort();
            throw e;
        }
    }

    /**
 
View Full Code Here

            }
            EntityUtils.consume(entity);

            return result;
        } catch (IOException e) {
            get.abort();
            throw e;
        }
    }

    /**
 
View Full Code Here

        log.info("retrieving resource {} as Linked Data; request URI is {}",resource.stringValue(),get.getURI());


        HttpResponse result = httpClient.execute(get);
        if(result.getEntity() == null || RDFParserRegistry.getInstance().getFileFormatForMIMEType(result.getEntity().getContentType().getValue().split(";")[0]) == null) {
            get.abort();
            if(result.getEntity() != null) {
                throw new LDClientException("invalid content returned by Linked Data resource "+resource.stringValue()+": "+result.getEntity().getContentType().getValue());
            } else {
                throw new LDClientException("no content returned by Linked Data resource "+resource.stringValue());
            }
View Full Code Here

            } 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.
                httpget.abort();
                throw ex;
               
            } finally {

                // Closing the input stream will trigger connection release
View Full Code Here

        }
        System.out.println("----------------------------------------");

        // Do not feel like reading the response body
        // Call abort on the request object
        httpget.abort();
    }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.