Package javax.ws.rs.core

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


    @Test
    public void testFormRepresentation() {
        final Form fp = new Form();
        fp.param("Email", "johndoe@gmail.com");
        fp.param("Passwd", "north 23AZ");
        fp.param("service", "cl");
        fp.param("source", "Gulp-CalGul-1.05");

        final WebTarget target = target("FormResource");
        final Form response = target.request().post(Entity.entity(fp, MediaType.APPLICATION_FORM_URLENCODED_TYPE), Form.class);
View Full Code Here


    @Test
    public void testFormRepresentation() {
        final Form fp = new Form();
        fp.param("Email", "johndoe@gmail.com");
        fp.param("Passwd", "north 23AZ");
        fp.param("service", "cl");
        fp.param("source", "Gulp-CalGul-1.05");

        final WebTarget target = target("FormResource");
        final Form response = target.request().post(Entity.entity(fp, MediaType.APPLICATION_FORM_URLENCODED_TYPE), Form.class);
View Full Code Here

    public void testFormRepresentation() {
        final Form fp = new Form();
        fp.param("Email", "johndoe@gmail.com");
        fp.param("Passwd", "north 23AZ");
        fp.param("service", "cl");
        fp.param("source", "Gulp-CalGul-1.05");

        final WebTarget target = target("FormResource");
        final Form response = target.request().post(Entity.entity(fp, MediaType.APPLICATION_FORM_URLENCODED_TYPE), Form.class);

        assertEquals(fp.asMap().size(), response.asMap().size());
View Full Code Here

    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

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

      String client_id = realmInfo.getClientId();
      String password = realmInfo.getCredentials().asMap().getFirst("password");
      String authHeader = BasicAuthHelper.createHeader(client_id, password);
      String redirectUri = stripOauthParametersFromRedirect();
      Form form = new Form();
      form.param("grant_type", "authorization_code")
              .param("code", code)
              .param("redirect_uri", redirectUri);

      Response res = realmInfo.getCodeUrl().request().header(HttpHeaders.AUTHORIZATION, authHeader).post(Entity.form(form));
      AccessTokenResponse tokenResponse;
View Full Code Here

      {
         form = new Form();
         target.getInvocation().setEntity(Entity.form(form));
      }
      String value = target.getInvocation().getClientConfiguration().toString(object);
      form.param(paramName, value);
      return target;
   }

}
View Full Code Here

      Assert.assertEquals("bee bop", entity);
      response.close();

      target = client.target("http://localhost:8081/encoded/form");
      Form form = new Form();
      form.param("f", "bee bop");
      response = target.request().post(Entity.form(form));
      entity = response.readEntity(String.class);
      System.out.println("Received encoded form param: " + entity);
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("bee+bop", entity);
View Full Code Here

      Assert.assertEquals("bee+bop", entity);
      response.close();

      target = client.target("http://localhost:8081/decoded/form");
      form = new Form();
      form.param("f", "bee bop");
      response = target.request().post(Entity.form(form));
      entity = response.readEntity(String.class);
      System.out.println("Received decoded form param: " + entity);
      Assert.assertEquals(200, response.getStatus());
      Assert.assertEquals("bee bop", entity);
View Full Code Here

   @Test
   public void testSuccessfulToken() throws Exception
   {

      Form form = new Form();
      form.param(RequiredCredentialRepresentation.PASSWORD, "userpassword")
          .param("client_id", "wburke");
      System.out.println(realmInfo.getGrantUrl());
      Response response = client.target(realmInfo.getGrantUrl()).request().post(Entity.form(form));
      if (response.getStatus() != 200)
      {
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.