Ejemplo n.º 1
0
  /**
   * Takes the extracted base URI and parameters from the {@link RequestConfig} consolidated
   * parameter type and creates a {@link HttpRequestBase} of the designated method type.
   *
   * @param uri the {@link URI} whose parameters should be populated
   * @param annotatedParams the list of {@link Param}s and the parameter objects which were
   *     annotated with them; <b>Complex objects should supply a formatted version of their String
   *     representation via {@link Object#toString()}</b>
   * @param staticParams the list of {@link Request.Param}s and the parameter objects which were
   *     annotated with them <br>
   *     <br>
   * @return the created {@link HttpRequestBase} which is an instance of {@link HttpPost} <br>
   *     <br>
   * @throws Exception when the {@link HttpRequestBase} could not be created due to an exception
   *     <br>
   *     <br>
   * @since 1.1.3
   */
  private static HttpRequestBase populateDeleteParameters(
      URI uri, Map<Object, Param> annotatedParams, List<Request.Param> staticParams)
      throws Exception {

    HttpParams httpParams = new BasicHttpParams();

    for (Request.Param param : staticParams) httpParams.setParameter(param.name(), param.value());

    Set<Entry<Object, Param>> methodParams = annotatedParams.entrySet();

    for (Entry<Object, Param> entry : methodParams)
      httpParams.setParameter(entry.getValue().value(), entry.getKey().toString());

    HttpDelete httpDelete = new HttpDelete(uri);
    httpDelete.setParams(httpParams);

    return httpDelete;
  }
Ejemplo n.º 2
0
 public static void setParameter(HttpDelete delete) {
   delete.setParams(HTTPBuilder.getHttpParams());
 }