Package com.sun.jersey.api.client

Examples of com.sun.jersey.api.client.ClientHandlerException


                            protected void commit() throws IOException {
                                writeOutBoundHeaders(cr.getMetadata(), method);
                            }
                        });
                    } catch (IOException ex) {
                        throw new ClientHandlerException(ex);
                    }

                    final byte[] content = baos.toByteArray();
                    entMethod.setRequestEntity(new RequestEntity() {

                        @Override
                        public boolean isRepeatable() {
                            return true;
                        }

                        @Override
                        public void writeRequest(OutputStream out) throws IOException {
                            out.write(content);
                        }

                        @Override
                        public long getContentLength() {
                            return content.length;
                        }

                        @Override
                        public String getContentType() {
                            return re.getMediaType().toString();
                        }
                    });
                }
            } else {
                writeOutBoundHeaders(cr.getHeaders(), method);
            }
        } else {
            writeOutBoundHeaders(cr.getHeaders(), method);

            // Follow redirects
            method.setFollowRedirects(cr.getPropertyAsFeature(ApacheHttpClientConfig.PROPERTY_FOLLOW_REDIRECTS));
        }
        try {
            httpClient.executeMethod(getHostConfiguration(httpClient, props), method, getHttpState(props));
        } catch (Exception e) {
            method.releaseConnection();
            throw new ClientHandlerException(e);
        }
    }
View Full Code Here


        if (proxy instanceof URI) {
            return (URI) proxy;
        } else if (proxy instanceof String) {
            return URI.create((String) proxy);
        } else {
            throw new ClientHandlerException("The proxy URI property MUST be an instance of String or URI");
        }
    }
View Full Code Here

            try {
                OAuthSignature.sign(new RequestWrapper(request, providers), p, secrets);
            }
            catch (OAuthSignatureException se) {
                throw new ClientHandlerException(se);
            }
        }

        // next filter in chain
        ClientResponse response;
View Full Code Here

        return this.getNext().handle(cr);
      } catch (ClientHandlerException e) {
        LOGGER.warn("Exception thrown while quering " + cr.getURI(), e);
      }
    }
    throw new ClientHandlerException("Connection retries limit of " + this.maximumRetryCount + " exceeded.");
  }
View Full Code Here

                    return outputStream;
                }
            });

        } catch (IOException e) {
            throw new ClientHandlerException("Unable to serialize request entity", e);
        }

        return outputStream.toByteArray();
    }
View Full Code Here

                    return baos;
                }
            });
            return baos.toByteArray();
        } catch (IOException ex) {
            throw new ClientHandlerException(ex);
        }
    }
View Full Code Here

        while (response.getClientResponseStatus() == ClientResponse.Status.MOVED_PERMANENTLY) {
            try {
                locationManager.setRedirectedURI(response.getHeaders()
                        .getFirst("Location"));
            } catch (NullPointerException e) {
                throw new ClientHandlerException(
                        "HTTP Redirect did not include Location header");
            } catch (URISyntaxException e) {
                throw new ClientHandlerException(
                        "HTTP Redirect location is not a valid URI");
            }

            request.setURI(locationManager.getRedirectedURI(originalURI));
            response = getNext().handle(request);
View Full Code Here

                        }
                    });

            return ((JerseyServiceResponseContext) resp).getClientResponse();
        } catch (Exception e) {
            throw new ClientHandlerException(e);
        }
    }
View Full Code Here

    @Override
    public ClientResponse handle(final ClientRequest ro) {
        try {
            return doHandle(ro);
        } catch (Exception e) {
            throw new ClientHandlerException(e);
        }
    }
View Full Code Here

                new ByteArrayInputStream(new byte[0]), null);
        UniformInterfaceException rootCause = new UniformInterfaceException(
                response);
        ServiceException originalDescription = ServiceExceptionFactory.process(
                "underlying", new ServiceException(rootCause));
        ClientHandlerException wrappingException = new ClientHandlerException(
                originalDescription);

        // Act
        ServiceException exception = ServiceExceptionFactory.process("actual",
                new ServiceException(wrappingException));
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.client.ClientHandlerException

Copyright © 2018 www.massapicom. 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.