PageRenderTime 23ms CodeModel.GetById 11ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/sitebricks-client/src/main/java/com/google/sitebricks/client/Web.java

http://github.com/dhanji/sitebricks
Java | 36 lines | 22 code | 11 blank | 3 comment | 0 complexity | 783a0167a44a9ef81f87221d09519937 MD5 | raw file
 1package com.google.sitebricks.client;
 2
 3import com.google.inject.ImplementedBy;
 4import com.google.inject.TypeLiteral;
 5
 6import java.util.Map;
 7
 8/**
 9 * @author Dhanji R. Prasanna (dhanji@gmail.com)
10 */
11@ImplementedBy(CommonsWeb.class)
12public interface Web {
13  enum Auth {
14    BASIC, DIGEST
15  }
16
17  FormatBuilder clientOf(String url);
18
19  FormatBuilder clientOf(String url, Map<String, String> headers);
20
21  static interface FormatBuilder {
22    <T> ReadAsBuilder<T> transports(Class<T> clazz);
23
24    <T> ReadAsBuilder<T> transports(TypeLiteral<T> clazz);
25
26    <T> WebClient<T> transportsText();
27
28    FormatBuilder auth(Auth auth, String username, String password);
29      
30    FormatBuilder auth(Auth auth, String username, String password, boolean usePreemptiveAuth);
31  }
32
33  static interface ReadAsBuilder<T> {
34    WebClient<T> over(Class<? extends Transport> clazz);
35  }
36}