Package javax.ws.rs.client

Examples of javax.ws.rs.client.ClientException


            for (ProviderInfo<ClientResponseFilter> filter : filters) {
                InjectionUtils.injectContexts(filter.getProvider(), filter, inMessage);
                try {
                    filter.getProvider().filter(reqContext, respContext);
                } catch (IOException ex) {
                    throw new ClientException(ex);
                }
            }
        }
    }
View Full Code Here


                        MessageObserver observer = exchange.get(MessageObserver.class);
                        observer.onMessage(inMessage);
                        return;
                    }
                } catch (IOException ex) {
                    throw new ClientException(ex);
                }
            }
        }
    }
View Full Code Here

                    sb.append(OAuth.percentEncode(entry.getValue())).append('"');
                }
            }
            return sb.toString();
        } catch (Exception ex) {
            throw new ClientException(ex);
        }
    }
View Full Code Here

        String str = IOUtils.readStringFromStream(is).trim();
        if (str.length() == 0) {
            return Collections.emptyMap();
        }
        if (!str.startsWith("{") || !str.endsWith("}")) {
            throw new ClientException("JSON Sequence is broken");
        }
        Map<String, String> map = new LinkedHashMap<String, String>();
       
        str = str.substring(1, str.length() - 1).trim();
        String[] jsonPairs = str.split(",");
View Full Code Here

                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());
                if (consumer.getSecret() != null) {
                    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, defaultTokenType);
            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

        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

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.