Package javax.ws.rs.core

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


    }
   
    public void filter(ContainerRequestContext context) {
        Message message = JAXRSUtils.getCurrentMessage();
        Form form = readFormData(message);
        MultivaluedMap<String, String> formData = form.asMap();
        String assertionType = formData.getFirst(Constants.CLIENT_AUTH_ASSERTION_TYPE);
        String decodedAssertionType = assertionType != null ? HttpUtils.urlDecode(assertionType) : null;
        if (decodedAssertionType == null || !Constants.CLIENT_AUTH_SAML2_BEARER.equals(decodedAssertionType)) {
            throw new NotAuthorizedException(errorResponse());
        }
View Full Code Here


                                                 tokenService.getBaseURI().toString(),
                                                 parameters);
        try {
            tokenService.replaceHeader("Authorization", header);
            Form form = tokenService.post(null, Form.class);
            return new Token(form.asMap().getFirst("oauth_token"),
                    form.asMap().getFirst("oauth_token_secret"));
        } catch (WebApplicationException ex) {
            throw new OAuthServiceException(ex);
        }
    }
View Full Code Here

                                                 parameters);
        try {
            tokenService.replaceHeader("Authorization", header);
            Form form = tokenService.post(null, Form.class);
            return new Token(form.asMap().getFirst("oauth_token"),
                    form.asMap().getFirst("oauth_token_secret"));
        } catch (WebApplicationException ex) {
            throw new OAuthServiceException(ex);
        }
    }
   
View Full Code Here

    public OOBAuthorizationResponse readFrom(
        Class<OOBAuthorizationResponse> clazz, Type genericType, Annotation[] annotations, MediaType mt,
        MultivaluedMap<String, String> headers, InputStream is) throws IOException {
        Form form = formProvider.readFrom(Form.class, Form.class, annotations, mt, headers, is);
        MultivaluedMap<String, String> data = form.asMap();
        OOBAuthorizationResponse resp = new OOBAuthorizationResponse();
       
        resp.setRequestToken(data.getFirst(OAuth.OAUTH_TOKEN));
        resp.setVerifier(data.getFirst(OAuth.OAUTH_VERIFIER));
        resp.setState(data.getFirst(OAuthConstants.X_OAUTH_STATE));
View Full Code Here

   
    public void filter(ContainerRequestContext context) {
        Message message = JAXRSUtils.getCurrentMessage();
       
        Form form = readFormData(message);   
        MultivaluedMap<String, String> formData = form.asMap();
        String assertion = formData.getFirst(SAML_ELEMENT);
       
        handleToken(message, assertion);        

        // redirect if needed
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

      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

            try {
                final String key = decode ?
                        URLDecoder.decode(entry.getKey(), charsetName) : URLEncoder.encode(entry.getKey(), charsetName);

                for (String value : entry.getValue()) {
                    newForm.asMap().add(key, decode ?
                            URLDecoder.decode(value, charsetName) : URLEncoder.encode(value, charsetName));
                }

            } catch (UnsupportedEncodingException uee) {
                throw new ProcessingException(LocalizationMessages.ERROR_UNSUPPORTED_ENCODING(charsetName,
View Full Code Here

            while (parameterNames.hasMoreElements()) {
                final String name = (String) parameterNames.nextElement();
                final String[] values = servletRequest.getParameterValues(name);

                form.asMap().put(name, Arrays.asList(values));
            }

            if (!form.asMap().isEmpty()) {
                containerRequest.setProperty(InternalServerProperties.FORM_DECODED_PROPERTY, form);
View Full Code Here

                final String[] values = servletRequest.getParameterValues(name);

                form.asMap().put(name, Arrays.asList(values));
            }

            if (!form.asMap().isEmpty()) {
                containerRequest.setProperty(InternalServerProperties.FORM_DECODED_PROPERTY, form);

                if (LOGGER.isLoggable(Level.WARNING)) {
                    LOGGER.log(Level.WARNING, LocalizationMessages.FORM_PARAM_CONSUMED(containerRequest.getRequestUri()));
                }
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.