Search in sources :

Example 1 with JsonbTransient

use of javax.json.bind.annotation.JsonbTransient in project styx by petafuel.

the class AuthorizationCodeRequest method getRawBody.

@JsonbTransient
@Override
public Optional<String> getRawBody() {
    String rawBody;
    if (isJsonBody()) {
        try (Jsonb jsonb = JsonbBuilder.create()) {
            rawBody = jsonb.toJson(this);
        } catch (Exception e) {
            throw new SerializerException("Unable to create request body for AuthorizationCodeRequest", e);
        }
    } else {
        Map<String, String> params = new HashMap<>();
        params.put("grant_type", getGrantType());
        params.put("client_id", getClientId());
        params.put("code", getCode());
        params.put("code_verifier", getCodeVerifier());
        params.put("redirect_uri", getRedirectUri());
        rawBody = BasicService.httpBuildQuery(params).substring(1);
    }
    return Optional.ofNullable(rawBody);
}
Also used : Jsonb(javax.json.bind.Jsonb) HashMap(java.util.HashMap) SerializerException(net.petafuel.styx.core.xs2a.exceptions.SerializerException) SerializerException(net.petafuel.styx.core.xs2a.exceptions.SerializerException) JsonbTransient(javax.json.bind.annotation.JsonbTransient)

Example 2 with JsonbTransient

use of javax.json.bind.annotation.JsonbTransient in project SourceCodePortal by Cantara.

the class ScmCommitRevision method getProjectId.

@JsonbTransient
public String getProjectId() {
    try {
        URL url = new URL(htmlUrl);
        String[] pathArray = url.getPath().split("\\/");
        return pathArray[2];
    } catch (MalformedURLException e) {
        throw new RuntimeException(e);
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) URL(java.net.URL) JsonbTransient(javax.json.bind.annotation.JsonbTransient)

Example 3 with JsonbTransient

use of javax.json.bind.annotation.JsonbTransient in project SourceCodePortal by Cantara.

the class GitHubCommitRevision method getProjectId.

@Deprecated
@JsonbTransient
public String getProjectId() {
    try {
        URL url = new URL(htmlUrl);
        String[] pathArray = url.getPath().split("\\/");
        return pathArray[2];
    } catch (MalformedURLException e) {
        throw new RuntimeException(e);
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) URL(java.net.URL) JsonbTransient(javax.json.bind.annotation.JsonbTransient)

Aggregations

JsonbTransient (javax.json.bind.annotation.JsonbTransient)3 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 HashMap (java.util.HashMap)1 Jsonb (javax.json.bind.Jsonb)1 SerializerException (net.petafuel.styx.core.xs2a.exceptions.SerializerException)1