Subversion Repositories SmartDukaan

Rev

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

Rev 22217 Rev 23505
Line 2... Line 2...
2
 
2
 
3
import java.io.IOException;
3
import java.io.IOException;
4
import java.util.HashMap;
4
import java.util.HashMap;
5
import java.util.Map;
5
import java.util.Map;
6
 
6
 
-
 
7
import org.apache.http.conn.HttpHostConnectException;
7
import org.springframework.http.HttpHeaders;
8
import org.springframework.http.HttpHeaders;
8
import org.springframework.http.MediaType;
9
import org.springframework.http.MediaType;
9
import org.springframework.stereotype.Component;
10
import org.springframework.stereotype.Component;
10
 
11
 
11
import com.fasterxml.jackson.core.JsonProcessingException;
12
import com.fasterxml.jackson.core.JsonProcessingException;
Line 28... Line 29...
28
		RestClient restClient = new RestClient(SchemeType.HTTPS, V3_HOST_NAME, PORT_NUMBER);
29
		RestClient restClient = new RestClient(SchemeType.HTTPS, V3_HOST_NAME, PORT_NUMBER);
29
		Map<String, String> params = new HashMap<>();
30
		Map<String, String> params = new HashMap<>();
30
		params.put(ProfitMandiConstants.ID_TOKEN, token);
31
		params.put(ProfitMandiConstants.ID_TOKEN, token);
31
		Map<String, String> headers = new HashMap<>(1);
32
		Map<String, String> headers = new HashMap<>(1);
32
		headers.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
33
		headers.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
-
 
34
		String responseString = null;
-
 
35
		try {
33
		String responseString = restClient.get(V3_URI, params, headers);
36
			responseString = restClient.get(V3_URI, params, headers);
-
 
37
		} catch (HttpHostConnectException e) {
-
 
38
			throw new ProfitMandiBusinessException("googleServerResponse", responseString, "GE_1006");
-
 
39
		}
34
		try {
40
		try {
35
			JsonNode rootNode = objectMapper.readTree(responseString);
41
			JsonNode rootNode = objectMapper.readTree(responseString);
36
			return rootNode.get("email").asText();
42
			return rootNode.get("email").asText();
37
			
43
			
38
		}catch (JsonProcessingException jsonProcessingException) {
44
		}catch (JsonProcessingException jsonProcessingException) {