Package javax.ws.rs.core

Examples of javax.ws.rs.core.Form.param()


    Annotation[][] parameterAnnotations = method.getParameterAnnotations();
    for( int i = 0; i < parameterAnnotations.length; i++ ) {
      Annotation[] annotations = parameterAnnotations[ i ];
      String paramName = extractFormParam( annotations );
      if( paramName != null ) {
        result.param( paramName, parameter[ i ].toString() );
      }
    }
    return result.asMap().isEmpty() ? null : result;
  }
View Full Code Here


    logger.info("Requesting access and refresh tokens");
    Client client = getClient();
    client.register(HttpAuthenticationFeature.basic(jiveInstance.getClientId(), jiveInstance.getClientSecret()));
    WebTarget target = client.target(jiveInstance.getJiveUrl() + "/oauth2/token");
    Form form = new Form("grant_type", "authorization_code");
    form.param("code", jiveInstance.getCode());
    form.param("client_id", jiveInstance.getClientId());

    JiveOAuthResponse response = target.request().post(Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED),JiveOAuthResponse.class);

    logger.info("Access Token : Response : " + response);
View Full Code Here

    Client client = getClient();
    client.register(HttpAuthenticationFeature.basic(jiveInstance.getClientId(), jiveInstance.getClientSecret()));
    WebTarget target = client.target(jiveInstance.getJiveUrl() + "/oauth2/token");
    Form form = new Form("grant_type", "authorization_code");
    form.param("code", jiveInstance.getCode());
    form.param("client_id", jiveInstance.getClientId());

    JiveOAuthResponse response = target.request().post(Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED),JiveOAuthResponse.class);

    logger.info("Access Token : Response : " + response);
View Full Code Here

    Client client = getClient();
    client.register(HttpAuthenticationFeature.basic(jiveInstance.getClientId(), jiveInstance.getClientSecret()));
    OAuthCredentials credentials = jiveInstance.getCredentials();
    WebTarget target = client.target(jiveInstance.getJiveUrl() + "/oauth2/token");
    Form form = new Form("grant_type", "refresh_token");
    form.param("refresh_token", credentials.getRefreshToken());
    form.param("client_id", jiveInstance.getClientId());

    JiveOAuthResponse response = target.request().post(Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED),JiveOAuthResponse.class);

    logger.info("Access Token : Response : " + response);
View Full Code Here

    client.register(HttpAuthenticationFeature.basic(jiveInstance.getClientId(), jiveInstance.getClientSecret()));
    OAuthCredentials credentials = jiveInstance.getCredentials();
    WebTarget target = client.target(jiveInstance.getJiveUrl() + "/oauth2/token");
    Form form = new Form("grant_type", "refresh_token");
    form.param("refresh_token", credentials.getRefreshToken());
    form.param("client_id", jiveInstance.getClientId());

    JiveOAuthResponse response = target.request().post(Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED),JiveOAuthResponse.class);

    logger.info("Access Token : Response : " + response);
View Full Code Here

    }

    @Test
    public void testPut() {
        Form form = new Form();
        form.param("text", "this is a test");
        String result = target("form-consumption/form-consumption").request().put(Entity.form(form), String.class);
        assertEquals(form.asMap().getFirst("text"), result);
    }

    @Test
View Full Code Here

    }

    @Test
    public void testPost() {
        Form form = new Form();
        form.param("text", "this is a test");
        String result = target("form-consumption/form-consumption").request().post(Entity.form(form), String.class);
        assertEquals(form.asMap().getFirst("text"), result);
    }

    @Test
View Full Code Here

    }

    @Test
    public void testPostWithEncoding() {
        Form form = new Form();
        form.param("text", "this is an encoding test +-*/=");
        String result = target("form-consumption/form-consumption/encoding").request().post(Entity.form(form), String.class);
        assertEquals(form.asMap().getFirst("text"), result);
    }
}
View Full Code Here

                            newTarget = newTarget.matrixParam(((MatrixParam) ann).value(), value);
                        }
                    } else if ((ann = anns.get((FormParam.class))) != null) {
                        if (value instanceof Collection) {
                            for (final Object v : ((Collection) value)) {
                                form.param(((FormParam) ann).value(), v.toString());
                            }
                        } else {
                            form.param(((FormParam) ann).value(), value.toString());
                        }
                    }
View Full Code Here

                        if (value instanceof Collection) {
                            for (final Object v : ((Collection) value)) {
                                form.param(((FormParam) ann).value(), v.toString());
                            }
                        } else {
                            form.param(((FormParam) ann).value(), value.toString());
                        }
                    }
                }
            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.