Package javax.ws.rs.core

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


      String paramName = extractFormParam( annotations );
      if( paramName != null ) {
        result.param( paramName, parameter[ i ].toString() );
      }
    }
    return result.asMap().isEmpty() ? null : result;
  }

  private String extractFormParam( Annotation[] annotations ) {
    for( Annotation annotation : annotations ) {
      if( annotation.annotationType() == FormParam.class ) {
View Full Code Here


      FormParam formParam = extractAnnotation( annotations, FormParam.class );
      if( formParam != null ) {
        result.param( formParam.value(), parameter[ i ].toString() );
      }
    }
    return result.asMap().isEmpty() ? null : result;
  }

  private boolean hasMultiPartFormParameter( Method method ) {
    return ClientHelper.hasFormAnnotation( method, FormDataParam.class );
  }
View Full Code Here

         final String result1 = client.target(generateURL("/form")).request().post(Entity.form(new Form().param("value", "value")), String.class);
         Assert.assertEquals(result1, "value");

         Form form = new Form().param("bill", "burke").param("foo", "bar");
         Form rtn = proxy.post(form);
         Assert.assertEquals(rtn.asMap().size(), form.asMap().size());
         Assert.assertEquals(rtn.asMap().getFirst("bill"), "burke");
         Assert.assertEquals(rtn.asMap().getFirst("foo"), "bar");

      }
      finally
View Full Code Here

         Assert.assertEquals(result1, "value");

         Form form = new Form().param("bill", "burke").param("foo", "bar");
         Form rtn = proxy.post(form);
         Assert.assertEquals(rtn.asMap().size(), form.asMap().size());
         Assert.assertEquals(rtn.asMap().getFirst("bill"), "burke");
         Assert.assertEquals(rtn.asMap().getFirst("foo"), "bar");

      }
      finally
      {
View Full Code Here

         Form form = new Form().param("bill", "burke").param("foo", "bar");
         Form rtn = proxy.post(form);
         Assert.assertEquals(rtn.asMap().size(), form.asMap().size());
         Assert.assertEquals(rtn.asMap().getFirst("bill"), "burke");
         Assert.assertEquals(rtn.asMap().getFirst("foo"), "bar");

      }
      finally
      {
         client.close();
View Full Code Here

      String paramName = extractFormParam( annotations );
      if( paramName != null ) {
        result.param( paramName, parameter[ i ].toString() );
      }
    }
    return result.asMap().isEmpty() ? null : result;
  }

  private String extractFormParam( Annotation[] annotations ) {
    for( Annotation annotation : annotations ) {
      if( annotation.annotationType() == FormParam.class ) {
View Full Code Here

        if (type != null && MediaType.APPLICATION_FORM_URLENCODED.startsWith(type)
            && method != null && (method.equals(HttpMethod.POST) || method.equals(HttpMethod.PUT))) {
            try {
                FormEncodingProvider<Form> provider = new FormEncodingProvider<Form>(true);
                Form form = FormUtils.readForm(provider, message);
                MultivaluedMap<String, String> formData = form.asMap();
                String token = formData.getFirst(OAuthConstants.ACCESS_TOKEN);
                if (token != null) {
                    FormUtils.restoreForm(provider, form, message);
                    return token;
                }
View Full Code Here

            Form f = new Form();
            Enumeration e = hsr.getParameterNames();
            while (e.hasMoreElements()) {
                String name = (String) e.nextElement();
                String[] values = hsr.getParameterValues(name);
                f.asMap().put(name, Arrays.asList(values));
            }

            if (!f.asMap().isEmpty()) {
                request.setProperty(HttpContext.FORM_DECODED_PROPERTY, f);
                if (LOGGER.isLoggable(Level.WARNING)) {
View Full Code Here

                String name = (String) e.nextElement();
                String[] values = hsr.getParameterValues(name);
                f.asMap().put(name, Arrays.asList(values));
            }

            if (!f.asMap().isEmpty()) {
                request.setProperty(HttpContext.FORM_DECODED_PROPERTY, f);
                if (LOGGER.isLoggable(Level.WARNING)) {
                    LOGGER.log(Level.WARNING, LocalizationMessages.FORM_PARAM_CONSUMED(request.getRequestUri()));
                }
            }
View Full Code Here

      String paramName = extractFormParam( annotations );
      if( paramName != null ) {
        result.param( paramName, parameter[ i ].toString() );
      }
    }
    return result.asMap().isEmpty() ? null : result;
  }

  private String extractFormParam( Annotation[] annotations ) {
    for( Annotation annotation : annotations ) {
      if( annotation.annotationType() == FormParam.class ) {
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.