Package javax.ws.rs.client

Examples of javax.ws.rs.client.ClientException


                sb.append("Basic ");
                try {
                    String data = consumer.getKey() + ":" + consumer.getSecret();
                    sb.append(Base64Utility.encode(data.getBytes("UTF-8")));
                } catch (Exception ex) {
                    throw new ClientException(ex);
                }
                accessTokenService.header("Authorization", sb.toString());
            } else {
                form.set(OAuthConstants.CLIENT_ID, consumer.getKey());
                form.set(OAuthConstants.CLIENT_SECRET, consumer.getSecret());
            }
        } else {
            // in this case the AccessToken service is expected to find a mapping between
            // the authenticated credentials and the client registration id
        }
        Response response = accessTokenService.form(form);
        Map<String, String> map = null;
        try {
            map = new OAuthJSONProvider().readJSONResponse((InputStream)response.getEntity());
        } catch (IOException ex) {
            throw new ClientException(ex);
        }
        if (200 == response.getStatus()) {
            ClientAccessToken token = fromMapToClientToken(map);
            if (token == null) {
                throw new OAuthServiceException(OAuthConstants.SERVER_ERROR);
View Full Code Here


            MacAuthorizationScheme macAuthData = new MacAuthorizationScheme(httpProps, token);
            String macAlgo = token.getParameters().get(OAuthConstants.MAC_TOKEN_ALGORITHM);
            String macKey = token.getParameters().get(OAuthConstants.MAC_TOKEN_KEY);
            sb.append(macAuthData.toAuthorizationHeader(macAlgo, macKey));
        } else {
            throw new ClientException(new OAuthServiceException("Unsupported token type"));
        }
       
    }
View Full Code Here

            }
        } catch (Exception ex) {
            throw ex instanceof WebApplicationException
                ? (WebApplicationException)ex
                : ex instanceof ClientException
                ? new ClientException(ex) : new RuntimeException(ex);
        }
       
        Response response = null;
        Object entity = null;
        try {
View Full Code Here

            getState().setResponse(r);
           
            return r;
        } catch (Throwable ex) {
            throw (ex instanceof ClientException) ? (ClientException)ex
                                                  : new ClientException(ex);
        } finally {
            ProviderFactory.getInstance(outMessage).clearThreadLocalProxies();
        }
    }
View Full Code Here

        Integer responseCode = getResponseCode(outMessage.getExchange());
        if (responseCode == null) {
            if (ex instanceof ClientException) {
                throw ex;
            } else if (ex != null) {
                throw new ClientException(ex);
            } else if (!outMessage.getExchange().isOneWay() || cfg.isResponseExpectedForOneway()) {
                waitForResponseCode(outMessage.getExchange());
            }
        }
    }
View Full Code Here

                // ignore
            }
        }
       
        if (getResponseCode(exchange) == null) {
            throw new ClientException("Response timeout");
        }
    }
View Full Code Here

            new org.apache.cxf.common.i18n.Message(name,
                                                   BUNDLE,
                                                   cls,
                                                   ct.toString());
        LOG.severe(errorMsg.toString());
        throw new ClientException(errorMsg.toString(), cause);
    }
View Full Code Here

            new org.apache.cxf.common.i18n.Message(name,
                                                   BUNDLE,
                                                   m.getDeclaringClass().getName(),
                                                   m.getName());
        LOG.severe(errorMsg.toString());
        throw new ClientException(errorMsg.toString());
    }
View Full Code Here

        Integer responseCode = getResponseCode(outMessage.getExchange());
        if (responseCode == null) {
            if (ex instanceof ClientException) {
                throw ex;
            } else if (ex != null) {
                throw new ClientException(ex);
            } else if (!outMessage.getExchange().isOneWay() || cfg.isResponseExpectedForOneway()) {
                waitForResponseCode(outMessage.getExchange());
            }
        }
    }
View Full Code Here

                return;
            }
        }
       
        if (getResponseCode(exchange) == null) {
            throw new ClientException("Response timeout");
        }
    }
View Full Code Here

TOP

Related Classes of javax.ws.rs.client.ClientException

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.