Package org.deftserver.web.http.client

Source Code of org.deftserver.web.http.client.HttpRequest

package org.deftserver.web.http.client;

import java.net.MalformedURLException;
import java.net.URL;

import org.deftserver.web.HttpVerb;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class HttpRequest {
 
  private static final Logger logger = LoggerFactory.getLogger(HttpRequest.class);

  private final URL url;
  private final HttpVerb verb;
 
  public HttpRequest(String url, HttpVerb verb) {
    try {
      this.url = new URL(url);
      this.verb = verb;
    } catch (MalformedURLException e) {
      logger.error("Malformed URL: {}", e.getMessage());
      throw new RuntimeException(e);
    }
  }

  public URL getURL() {
    return url;
  }
 
  /**
   *
   * @return The verb (method) name, e.g. "GET" or "POST"
   */
  public String getVerb() {
    return verb.name();
  }
 
}
TOP

Related Classes of org.deftserver.web.http.client.HttpRequest

TOP
Copyright © 2015 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.