keycloak
静的公開メンバ関数 | 静的非公開メンバ関数 | 全メンバ一覧
org.keycloak.adapters.HttpAdapterUtils クラス
org.keycloak.adapters.HttpAdapterUtils 連携図
Collaboration graph

静的公開メンバ関数

static< T > T sendJsonHttpRequest (KeycloakDeployment deployment, HttpRequestBase httpRequest, Class< T > clazz) throws HttpClientAdapterException
 

静的非公開メンバ関数

static void close (HttpResponse response)
 

詳解

著者
Marek Posolda

関数詳解

◆ close()

static void org.keycloak.adapters.HttpAdapterUtils.close ( HttpResponse  response)
inlinestaticprivate
63  {
64  if (response.getEntity() != null) {
65  try {
66  response.getEntity().getContent().close();
67  } catch (IOException e) {
68 
69  }
70  }
71  }

◆ sendJsonHttpRequest()

static <T> T org.keycloak.adapters.HttpAdapterUtils.sendJsonHttpRequest ( KeycloakDeployment  deployment,
HttpRequestBase  httpRequest,
Class< T >  clazz 
) throws HttpClientAdapterException
inlinestatic
35  {
36  try {
37  HttpResponse response = deployment.getClient().execute(httpRequest);
38  int status = response.getStatusLine().getStatusCode();
39  if (status != 200) {
40  close(response);
41  throw new HttpClientAdapterException("Unexpected status = " + status);
42  }
43  HttpEntity entity = response.getEntity();
44  if (entity == null) {
45  throw new HttpClientAdapterException("There was no entity.");
46  }
47  InputStream is = entity.getContent();
48  try {
49  return JsonSerialization.readValue(is, clazz);
50  } finally {
51  try {
52  is.close();
53  } catch (IOException ignored) {
54 
55  }
56  }
57  } catch (IOException e) {
58  throw new HttpClientAdapterException("IO error", e);
59  }
60  }
static void close(HttpResponse response)
Definition: HttpAdapterUtils.java:63

このクラス詳解は次のファイルから抽出されました: