Package com.sun.jersey.api.representation

Examples of com.sun.jersey.api.representation.Form


    }

    @Override
    public WrapAccessTokenResult wrapAccessToken(String uri, String name,
            String password, String scope) throws ServiceException {
        Form requestForm = new Form();
        requestForm.add("wrap_name", name);
        requestForm.add("wrap_password", password);
        requestForm.add("wrap_scope", scope);

        Form responseForm;
        try {
            responseForm = channel.resource(uri)
                    .accept(MediaType.APPLICATION_FORM_URLENCODED)
                    .type(MediaType.APPLICATION_FORM_URLENCODED)
                    .post(Form.class, requestForm);
        } catch (UniformInterfaceException e) {
            log.warn("WRAP server returned error acquiring access_token", e);
            throw ServiceExceptionFactory.process("WRAP", new ServiceException(
                    "WRAP server returned error acquiring access_token", e));
        }

        WrapAccessTokenResult response = new WrapAccessTokenResult();

        response.setAccessToken(responseForm.getFirst("wrap_access_token"));

        String expiresIn = responseForm
                .getFirst("wrap_access_token_expires_in");
        response.setExpiresIn(Long.parseLong(expiresIn));

        return response;
    }
View Full Code Here


     */
    @Override
    public OAuthTokenResponse getAccessToken(URI oAuthUri, String clientId,
            String clientSecret, String scope) throws ServiceException {
        OAuthTokenResponse response = null;
        Form requestForm = new Form();
        ClientResponse clientResponse;
        String responseJson;

        requestForm.add("grant_type", grantType);
        requestForm.add("client_id", clientId);
        requestForm.add("client_secret", clientSecret);
        requestForm.add("scope", scope);

        try {
            clientResponse = channel.resource(oAuthUri)
                    .accept(MediaType.APPLICATION_FORM_URLENCODED)
                    .type(MediaType.APPLICATION_FORM_URLENCODED)
View Full Code Here

*/
public class FluxClient {
    public static void main(String[] args) {
        Client client = Client.create();
        WebResource resource = client.resource("http://localhost:8080");
        Form form = new Form();
        form.add("namespace", "one shot job");
        form.add("schedule", "+5s");
        String name = resource.path("scheduler").post(String.class, form);
        System.out.println("Scheduled " + name + " at " + new Date());
    }
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.representation.Form

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.