All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.clouway.friendlyserve.Request Maven / Gradle / Ivy

There is a newer version: 0.1.5
Show newest version
package com.clouway.friendlyserve;

import java.io.IOException;
import java.io.InputStream;

/**
 * Request is representing a HTTP request.
 *
 * @author Miroslav Genov ([email protected])
 */
public interface Request {
  /**
   * Get request path.
   *
   * @return the requested path
   */
  String path();

  /**
   * Get parameter value by it's key.
   *
   * @param name the name of the parameter
   * @return the parameter value
   */
  String param(String name);

  /**
   * Get all parameter names.
   *
   * @return all names
   */
  Iterable names();

  /**
   * Get single cookie.
   *
   * @param name Cookie name
   * @return list of values (can be empty)
   */
  Iterable cookie(String name);

  /**
   * Get header value by it's key.
   *
   * @param name the name of the header
   * @return the value that is associated with provided name
   */
  String header(String name);

  /**
   * Get body of the request.
   *
   * @return an input stream of the body of the request
   * @throws IOException is thrown when body cannot be read due IO error
   */
  InputStream body() throws IOException;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy