@Test public void shouldConvertToJsonWhenLocaleNotSet() { LanguageCallback languageCallback = new LanguageCallback(); JsonValue jsonObject = restAuthLanguageCallbackHandler.convertToJson(languageCallback, 1); assertEquals(1, jsonObject.size()); assertEquals("LanguageCallback", jsonObject.get("type").asString()); }
public JsonValue convertToJson(LanguageCallback callback, int index) { Locale locale = callback.getLocale(); JsonObject jsonObject = JsonValueBuilder.jsonValue() .put("type", CALLBACK_NAME); if (locale != null) { jsonObject.array("input") .add(createInputField(index, "Language", locale.getLanguage())) .addLast(createInputField(index, "Country", locale.getCountry())); } return jsonObject.build(); }
RestAuthLanguageCallbackHandler extends AbstractRestAuthCallbackHandler<LanguageCallback> { public JsonValue convertToJson(LanguageCallback callback, int index) { Locale locale = callback.getLocale(); JsonObject jsonObject = JsonValueBuilder.jsonValue() .put("type", CALLBACK_NAME); if (locale != null) { jsonObject.array("input") .add(createInputField(index, "Language", locale.getLanguage())) .addLast(createInputField(index, "Country", locale.getCountry())); } return jsonObject.build(); } }
RestAuthLanguageCallbackHandler extends AbstractRestAuthCallbackHandler<LanguageCallback> { public JsonValue convertToJson(LanguageCallback callback, int index) { Locale locale = callback.getLocale(); JsonObject jsonObject = JsonValueBuilder.jsonValue() .put("type", CALLBACK_NAME); if (locale != null) { jsonObject.array("input") .add(createInputField(index, "Language", locale.getLanguage())) .addLast(createInputField(index, "Country", locale.getCountry())); } return jsonObject.build(); }  }
RestAuthLanguageCallbackHandler extends AbstractRestAuthCallbackHandler<LanguageCallback> { public JsonValue convertToJson(LanguageCallback callback, int index) { Locale locale = callback.getLocale(); JsonObject jsonObject = JsonValueBuilder.jsonValue() .put("type", CALLBACK_NAME); if (locale != null) { jsonObject.array("input") .add(createInputField(index, "Language", locale.getLanguage())) .addLast(createInputField(index, "Country", locale.getCountry())); } return jsonObject.build(); }  LanguageCallback handle(HttpHeaders headers, HttpServletRequest request, HttpServletResponse response,
            JsonValue postBody, LanguageCallback originalCallback); String getCallbackClassName(); JsonValue convertToJson(LanguageCallback callback, int index); LanguageCallback convertFromJson(LanguageCallback callback, JsonValue jsonCallback); }
RestAuthLanguageCallbackHandler extends AbstractRestAuthCallbackHandler<LanguageCallback> { public JsonValue convertToJson(LanguageCallback callback, int index) { Locale locale = callback.getLocale(); JsonObject jsonObject = JsonValueBuilder.jsonValue() .put("type", CALLBACK_NAME); if (locale != null) { jsonObject.array("input") .add(createInputField(index, "Language", locale.getLanguage())) .addLast(createInputField(index, "Country", locale.getCountry())); } return jsonObject.build(); }  LanguageCallback handle(HttpHeaders headers, HttpServletRequest request, HttpServletResponse response,
            JsonValue postBody, LanguageCallback originalCallback); String getCallbackClassName(); JsonValue convertToJson(LanguageCallback callback, int index); LanguageCallback convertFromJson(LanguageCallback callback, JsonValue jsonCallback);  }