package data;

import util.UserAuthUtil;

public class ResponseBuilder {
  public static String toJson(boolean isLoggedIn, String redirectURL) {
    // logged in: { "isLoggedIn":{"/_ah/logout?continue=%2FLogin"}, "isLoggedOut":{""}}
    // logged out: { "isLoggedIn":{""}, "isLoggedOut":{"/_ah/login?continue=%2FLogin"}}
    return "{ \"isLoggedIn\":{\"" + buildLogout(isLoggedIn, redirectURL) + "\"}, " +
            "\"isLoggedOut\":{\"" + buildLogin(isLoggedIn, redirectURL) + "\"}}";
  }

  private static String buildLogin(boolean isLoggedIn, String redirectURL) {
    return isLoggedIn ? "" : UserAuthUtil.getLoginURL(redirectURL);
  }

  private static String buildLogout(boolean isLoggedIn, String redirectURL) {
    return isLoggedIn ? UserAuthUtil.getLogoutURL(redirectURL) : "";
  }
}

@@ -39,117 +39,277 @@
 l;%0A%0A
-public class ResponseBuilder %7B%0A  public static String toJson(boolean isLoggedIn, String redirectURL) %7B%0A    //
+/** Class to build Login/Logout response objects in JSON format */%0Apublic class ResponseBuilder %7B%0A  /**%0A   * @param isLoggedIn user login status%0A   * @param redirectURL URL to redirect after login/logout%0A   * @return JSON string with login/logout URL%0A   *         e.g.,
  log
@@ -393,11 +393,17 @@
 %0A   
- //
+*        
  log
@@ -480,16 +480,94 @@
 ogin%22%7D%7D%0A
+   */%0A  public static String toJson(boolean isLoggedIn, String redirectURL) %7B%0A
     retu

add javadoc