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       * Creates a request of given {@link MethodType} to given url
16       *
17       * @param methodType The HTTP method type
18       * @param url        The url to request
19       * @return The request object
20       */
21      T createRequest(MethodType methodType, String url);
22  
23      /**
24       * Indicates whether the requests can support headers
25       *
26       * @return true if the requests can support headers
27       * @see Request#setHeader(String, String)
28       * @see Request#addHeader(String, String)
29       */
30      boolean supportsHeader();
31  }