Package org.agorava.api.exception

Examples of org.agorava.api.exception.AgoravaException


        if (bean.getQualifiers().contains(CurrentLiteral.INSTANCE)) {
            Set<Annotation> providerRelatedAnnotations = getAnnotationsWithMeta(bean.getQualifiers(), ProviderRelated.class);

            if (!providerRelatedAnnotations.isEmpty()) {
                throw new AgoravaException("OAuthSession cannot have @Current annotation and a provider " +
                        "related annotation. Error on bean " + pb.getBean().toString());
            }
            if (!pb.getAnnotated().isAnnotationPresent(Named.class)) {
                log.warning("@Current OAuthSession won't be accessible from UI");
            }
View Full Code Here


            }

            OAuth.OAuthVersion version = providerQualifiers2Version.get(qual);
            if (version == null) {
                abd.addDefinitionError(new AgoravaException("There is no OAuth version associated to provider related " +
                        "Qualifier " +
                        "" + qual));
            }

            Class clazz = version2ServiceClass.get(version);
            if (clazz == null) {
                abd.addDefinitionError(new AgoravaException("There is no OAuth Service class for OAuth version " + version));
            }

            beanRegisterer(clazz, qual, Dependent.class, abd, beanManager, OAuthService.class);
        }

        // Adding all Provider Related qualifier on Session producer
        if (osb == null) {
            abd.addDefinitionError(new AgoravaException("Application didn't provided OAuthSession bean. You should add one " +
                    "via a producer or activate automatic management by adding " + ApplicationResolver.RESOLVER +
                    "=<application|session|request|cookie> in " +
                    "agorava.properties file"));
        } else {
            WrappingBeanBuilder<OAuthSession> wbp = new WrappingBeanBuilder<OAuthSession>(osb, beanManager);
View Full Code Here

            String queryString = new URL(url).getQuery();
            result.addQuerystring(queryString);
            result.addAll(querystringParams);
            return result;
        } catch (MalformedURLException mue) {
            throw new AgoravaException("Malformed URL : " + url, mue);
        }
    }
View Full Code Here

    @Override
    public String getBodyContents() {
        try {
            return new String(getByteBodyContents(), getCharset());
        } catch (UnsupportedEncodingException uee) {
            throw new AgoravaException("Unsupported Charset: " + charset, uee);
        }
    }
View Full Code Here

        if (bytePayload != null) return bytePayload;
        String body = (payload != null) ? payload : bodyParams.asFormUrlEncodedString();
        try {
            return body.getBytes(getCharset());
        } catch (UnsupportedEncodingException uee) {
            throw new AgoravaException("Unsupported Charset: " + getCharset(), uee);
        }
    }
View Full Code Here

            InputStream res = isSuccessful() ? connection.getInputStream() : connection.getErrorStream();
            if (GZIP_CONTENT_ENCODING.equals(headers.get(CONTENT_ENCODING)))
                try {
                    stream = new GZIPInputStream(res);
                } catch (IOException e) {
                    throw new AgoravaException("Unable to create GZIPInputStream", e);
                }
            else
                stream = res;
        } catch (IOException e) {
            throw new AgoravaException("The IP address of a host could not be determined.", e);
        }
    }
View Full Code Here

    }

    @Override
    public UserSessionRepository createNew(String id) {
        if (get(id) != null) {
            throw new AgoravaException("Unable to create new user repository : repository with id " + id + " already exists");
        } else {
            UserSessionRepository res = new UserSessionRepositoryImpl(id);
            add(res);
            setCurrent(res);
            return res;
View Full Code Here

        Preconditions.checkEmptyString(response, "Cannot extract a token from a null or empty String");
        Matcher matcher = accessTokenPattern.matcher(response);
        if (matcher.find()) {
            return new Token(matcher.group(1), "");
        } else {
            throw new AgoravaException("Cannot extract an acces token. Response was: " + response);
        }
    }
View Full Code Here

        Matcher matcher = Pattern.compile(TOKEN_REGEX).matcher(response);
        if (matcher.find()) {
            String token = OAuthEncoder.decode(matcher.group(1));
            return new Token(token, EMPTY_SECRET);
        } else {
            throw new AgoravaException("Response body is incorrect. Can't extract a token from this: '" + response + "'", null);
        }
    }
View Full Code Here

        Matcher matcher = Pattern.compile(TOKEN_REGEX).matcher(response);
        if (matcher.find()) {
            String token = OAuthEncoder.decode(matcher.group(1));
            return new Token(token, EMPTY_SECRET);
        } else {
            throw new AgoravaException("Response body is incorrect. Can't extract a token from this: '" + response + "'", null);
        }

    }
View Full Code Here

TOP

Related Classes of org.agorava.api.exception.AgoravaException

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.