@Override
 public GoPluginApiResponse handle(GoPluginApiRequest goPluginApiRequest) {
   try {
     if (handlerMap.containsKey(goPluginApiRequest.requestName())) {
       return handlerMap.get(goPluginApiRequest.requestName()).handle(goPluginApiRequest);
     }
     return DefaultGoPluginApiResponse.badRequest(
         String.format("Invalid request name %s", goPluginApiRequest.requestName()));
   } catch (Throwable e) {
     return DefaultGoPluginApiResponse.error(e.getMessage());
   }
 }
  @Override
  public GoPluginApiResponse call(GoPluginApiRequest request) {
    String responseBody =
        toJson(create().add(CONFIG_WEB_AUTH, false).add(CONFIG_PASSWORD_AUTH, true).build());

    return DefaultGoPluginApiResponse.success(responseBody);
  }
Exemple #3
0
 private GoPluginApiResponse createResponse(int responseCode, Map body) {
   final DefaultGoPluginApiResponse response = new DefaultGoPluginApiResponse(responseCode);
   response.setResponseBody(new GsonBuilder().serializeNulls().create().toJson(body));
   return response;
 }