protected MultivaluedMap<String, String> toRequestState(ContainerRequestContext rc, UriInfo ui) {
   MultivaluedMap<String, String> requestState = new MetadataMap<String, String>();
   requestState.putAll(ui.getQueryParameters(decodeRequestParameters));
   if (MediaType.APPLICATION_FORM_URLENCODED_TYPE.isCompatible(rc.getMediaType())) {
     String body = FormUtils.readBody(rc.getEntityStream(), StandardCharsets.UTF_8.name());
     FormUtils.populateMapFromString(
         requestState,
         JAXRSUtils.getCurrentMessage(),
         body,
         StandardCharsets.UTF_8.name(),
         decodeRequestParameters);
   }
   return requestState;
 }
Пример #2
0
 private void addFormValue(
     MultivaluedMap<String, String> form, String name, Object pValue, Annotation[] anns) {
   if (pValue != null) {
     if (InjectionUtils.isSupportedCollectionOrArray(pValue.getClass())) {
       Collection<?> c =
           pValue.getClass().isArray() ? Arrays.asList((Object[]) pValue) : (Collection<?>) pValue;
       for (Iterator<?> it = c.iterator(); it.hasNext(); ) {
         FormUtils.addPropertyToForm(form, name, convertParamValue(it.next(), anns));
       }
     } else {
       FormUtils.addPropertyToForm(
           form, name, name.isEmpty() ? pValue : convertParamValue(pValue, anns));
     }
   }
 }