Subversion Repositories eFlore/Applications.cel

Rev

Rev 2806 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2806 Rev 2808
Line 4... Line 4...
4
 
4
 
Line 5... Line 5...
5
import com.google.gwt.http.client.RequestBuilder;
5
import com.google.gwt.http.client.RequestBuilder;
Line -... Line 6...
-
 
6
 
-
 
7
public class RequestBuilderWithCredentials extends RequestBuilder {
-
 
8
 
-
 
9
	/**
6
 
10
	 * Crée une requête avec des headers "Credentials" pour CORS et "Authorization" contenant
-
 
11
	 * le jeton (s'il existe)
-
 
12
	 */
-
 
13
	public RequestBuilderWithCredentials(Method httpMethod, String url) {
-
 
14
		this(httpMethod, url, true);
-
 
15
	}
-
 
16
 
-
 
17
	/**
-
 
18
	 * Crée une requête avec des headers "Credentials" pour CORS, et si authorizationHeader vaut true,
7
public class RequestBuilderWithCredentials extends RequestBuilder {
19
	 * un header "Authorization" contenant le jeton (s'il existe)
8
 
20
	 */
9
	public RequestBuilderWithCredentials(Method httpMethod, String url) {
21
	public RequestBuilderWithCredentials(Method httpMethod, String url, boolean authorizationHeader) {
10
		super(httpMethod, url);
22
		super(httpMethod, url);
11
		if(!Utilisateur.getJeton().isEmpty()) {
23
		if(authorizationHeader && (Utilisateur.getJeton() != null && !Utilisateur.getJeton().isEmpty())) {
12
			this.setHeader("Authorization", Utilisateur.getJeton());
24
			this.setHeader("Authorization", Utilisateur.getJeton());
13
		}
25
		}