Package br.com.mirabilis.http

Source Code of br.com.mirabilis.http.HttpBuilder

package br.com.mirabilis.http;

import org.apache.http.HttpException;

import br.com.mirabilis.http.exception.HttpRequestException;
import br.com.mirabilis.http.info.HttpType;
import br.com.mirabilis.http.jakarta.HttpJakarta;
import br.com.mirabilis.http.java.HttpJava;

/**
* Class that build objects http to request�s.
*
* @author Rodrigo Sim�es Rosa
*
*/
public class HttpBuilder {
  /**
   * Return request type.
   *
   * @param context
   * @param type
   * @return
   * @throws HttpException
   */
  public static HttpRequest build(HttpType type) throws HttpRequestException {

    if (type == null) {
      return new HttpJakarta();
    }

    switch (type) {
    case JAVA:
      return new HttpJava();

    case JAKARTA:
      return new HttpJakarta();

    default:
      throw new HttpRequestException("This type of request not exist");
    }
  }

  /**
   * Return request type.
   *
   * @param context
   * @return
   * @throws HttpRequestException
   */
  public static HttpRequest build() throws HttpRequestException {
    return build(null);
  }
}
TOP

Related Classes of br.com.mirabilis.http.HttpBuilder

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.