View Javadoc

1   package com.atlassian.httpclient.api;
2   
3   import java.io.InputStream;
4   import java.util.Map;
5   
6   /**
7    * A basic contract to be implemented by all entity builders.
8    */
9   public interface EntityBuilder {
10      /**
11       * Builds an {@link Entity}.
12       *
13       * @return The built entity
14       */
15      Entity build();
16  
17      /**
18       * Represents a built entity consisting of a set of HTTP headers and an {@link InputStream}.
19       */
20      static interface Entity {
21          /**
22           * Gets all HTTP headers for the represented entity.  At a minimum, this should include
23           * an appropriate "Content-Type" header.
24           *
25           * @return A map of all HTTP headers for the entity
26           */
27          public Map<String, String> getHeaders();
28  
29          /**
30           * Gets the input stream for the built entity.
31           *
32           * @return An entity input stream
33           */
34          public InputStream getInputStream();
35      }
36  }