View Javadoc

1   package com.atlassian.sal.api.net;
2   
3   import com.atlassian.sal.api.net.Request.MethodType;
4   
5   /**
6    * Factory to create {@link Request}s. Requests are used to make network calls.
7    *
8    * The rest plugin provides the default implementation for this interface.
9    *
10   * @param <T> The type of request to create
11   * @since 2.0
12   */
13  public interface RequestFactory<T extends Request<?, ?>>
14  {
15      /**
16       * Creates a request of given {@link MethodType} to given url
17       *
18       * @param methodType The HTTP method type
19       * @param url        The url to request
20       * @return The request object
21       */
22      T createRequest(MethodType methodType, String url);
23  
24      /**
25       * Indicates whether the requests can support headers
26       *
27       * @return true if the requests can support headers
28       * @see Request#setHeader(String, String)
29       * @see Request#addHeader(String, String)
30       */
31      boolean supportsHeader();
32  }