Example usage for twitter4j User getName

List of usage examples for twitter4j User getName

Introduction

In this page you can find the example usage for twitter4j User getName.

Prototype

String getName();

Source Link

Document

Returns the name of the user

Usage

From source file:org.getlantern.firetweet.util.ContentValuesCreator.java

License:Open Source License

public static ContentValues createAccount(final Configuration conf, final String basicUsername,
        final String basicPassword, final User user, final int color, final String apiUrlFormat,
        final boolean noVersionSuffix) {
    if (user == null || user.getId() <= 0)
        return null;
    final ContentValues values = new ContentValues();
    if (basicUsername == null || basicPassword == null)
        return null;
    values.put(Accounts.BASIC_AUTH_USERNAME, basicUsername);
    values.put(Accounts.BASIC_AUTH_PASSWORD, basicPassword);
    values.put(Accounts.AUTH_TYPE, Accounts.AUTH_TYPE_BASIC);
    values.put(Accounts.ACCOUNT_ID, user.getId());
    values.put(Accounts.SCREEN_NAME, user.getScreenName());
    values.put(Accounts.NAME, user.getName());
    values.put(Accounts.PROFILE_IMAGE_URL, user.getProfileImageUrlHttps());
    values.put(Accounts.PROFILE_BANNER_URL, user.getProfileBannerImageUrl());
    values.put(Accounts.COLOR, color);/*from   w  ww .  j a  v a  2 s .c om*/
    values.put(Accounts.IS_ACTIVATED, 1);
    values.put(Accounts.API_URL_FORMAT, apiUrlFormat);
    values.put(Accounts.NO_VERSION_SUFFIX, noVersionSuffix);
    return values;
}

From source file:org.getlantern.firetweet.util.ContentValuesCreator.java

License:Open Source License

public static ContentValues createAccount(final Configuration conf, final AccessToken accessToken,
        final User user, final int authType, final int color, final String apiUrlFormat,
        final boolean sameOAuthSigningUrl, final boolean noVersionSuffix) {
    if (user == null || user.getId() <= 0 || accessToken == null || user.getId() != accessToken.getUserId())
        return null;
    final ContentValues values = new ContentValues();
    values.put(Accounts.OAUTH_TOKEN, accessToken.getToken());
    values.put(Accounts.OAUTH_TOKEN_SECRET, accessToken.getTokenSecret());
    values.put(Accounts.CONSUMER_KEY, conf.getOAuthConsumerKey());
    values.put(Accounts.CONSUMER_SECRET, conf.getOAuthConsumerSecret());
    values.put(Accounts.AUTH_TYPE, authType);
    values.put(Accounts.ACCOUNT_ID, user.getId());
    values.put(Accounts.SCREEN_NAME, user.getScreenName());
    values.put(Accounts.NAME, user.getName());
    values.put(Accounts.PROFILE_IMAGE_URL, user.getProfileImageUrlHttps());
    values.put(Accounts.PROFILE_BANNER_URL, user.getProfileBannerImageUrl());
    values.put(Accounts.COLOR, color);/*  w  ww .j  ava  2  s  .c om*/
    values.put(Accounts.IS_ACTIVATED, 1);
    values.put(Accounts.API_URL_FORMAT, apiUrlFormat);
    values.put(Accounts.SAME_OAUTH_SIGNING_URL, sameOAuthSigningUrl);
    values.put(Accounts.NO_VERSION_SUFFIX, noVersionSuffix);
    return values;
}

From source file:org.getlantern.firetweet.util.ContentValuesCreator.java

License:Open Source License

public static ContentValues createAccount(final Configuration conf, final User user, final int color,
        final String apiUrlFormat, final boolean noVersionSuffix) {
    if (user == null || user.getId() <= 0)
        return null;
    final ContentValues values = new ContentValues();
    values.put(Accounts.AUTH_TYPE, Accounts.AUTH_TYPE_TWIP_O_MODE);
    values.put(Accounts.ACCOUNT_ID, user.getId());
    values.put(Accounts.SCREEN_NAME, user.getScreenName());
    values.put(Accounts.NAME, user.getName());
    values.put(Accounts.PROFILE_IMAGE_URL, (user.getProfileImageUrlHttps()));
    values.put(Accounts.PROFILE_BANNER_URL, (user.getProfileBannerImageUrl()));
    values.put(Accounts.COLOR, color);/*from   ww w  . j  av  a2  s.  c om*/
    values.put(Accounts.IS_ACTIVATED, 1);
    values.put(Accounts.API_URL_FORMAT, apiUrlFormat);
    values.put(Accounts.NO_VERSION_SUFFIX, noVersionSuffix);
    return values;
}

From source file:org.getlantern.firetweet.util.ContentValuesCreator.java

License:Open Source License

public static ContentValues createCachedUser(final User user) {
    if (user == null || user.getId() <= 0)
        return null;
    final String profile_image_url = user.getProfileImageUrlHttps();
    final String url = user.getURL();
    final URLEntity[] urls = user.getURLEntities();
    final ContentValues values = new ContentValues();
    values.put(CachedUsers.USER_ID, user.getId());
    values.put(CachedUsers.NAME, user.getName());
    values.put(CachedUsers.SCREEN_NAME, user.getScreenName());
    values.put(CachedUsers.PROFILE_IMAGE_URL, profile_image_url);
    values.put(CachedUsers.PROFILE_BANNER_URL, user.getProfileBannerImageUrl());
    values.put(CachedUsers.CREATED_AT, user.getCreatedAt().getTime());
    values.put(CachedUsers.IS_PROTECTED, user.isProtected());
    values.put(CachedUsers.IS_VERIFIED, user.isVerified());
    values.put(CachedUsers.IS_FOLLOWING, user.isFollowing());
    values.put(CachedUsers.FAVORITES_COUNT, user.getFavouritesCount());
    values.put(CachedUsers.FOLLOWERS_COUNT, user.getFollowersCount());
    values.put(CachedUsers.FRIENDS_COUNT, user.getFriendsCount());
    values.put(CachedUsers.STATUSES_COUNT, user.getStatusesCount());
    values.put(CachedUsers.LISTED_COUNT, user.getListedCount());
    values.put(CachedUsers.LOCATION, user.getLocation());
    values.put(CachedUsers.DESCRIPTION_PLAIN, user.getDescription());
    values.put(CachedUsers.DESCRIPTION_HTML, TwitterContentUtils.formatUserDescription(user));
    values.put(CachedUsers.DESCRIPTION_EXPANDED, TwitterContentUtils.formatExpandedUserDescription(user));
    values.put(CachedUsers.URL, url);
    if (url != null && urls != null && urls.length > 0) {
        values.put(CachedUsers.URL_EXPANDED, urls[0].getExpandedURL());
    }//from www.j  a v  a  2 s .c o  m
    values.put(CachedUsers.BACKGROUND_COLOR, ParseUtils.parseColor("#" + user.getProfileBackgroundColor(), 0));
    values.put(CachedUsers.LINK_COLOR, ParseUtils.parseColor("#" + user.getProfileLinkColor(), 0));
    values.put(CachedUsers.TEXT_COLOR, ParseUtils.parseColor("#" + user.getProfileTextColor(), 0));
    return values;
}

From source file:org.getlantern.firetweet.util.ContentValuesCreator.java

License:Open Source License

public static ContentValues createDirectMessage(final DirectMessage message, final long accountId,
        final boolean isOutgoing) {
    if (message == null)
        return null;
    final ContentValues values = new ContentValues();
    final User sender = message.getSender(), recipient = message.getRecipient();
    if (sender == null || recipient == null)
        return null;
    final String sender_profile_image_url = sender.getProfileImageUrlHttps();
    final String recipient_profile_image_url = recipient.getProfileImageUrlHttps();
    values.put(DirectMessages.ACCOUNT_ID, accountId);
    values.put(DirectMessages.MESSAGE_ID, message.getId());
    values.put(DirectMessages.MESSAGE_TIMESTAMP, message.getCreatedAt().getTime());
    values.put(DirectMessages.SENDER_ID, sender.getId());
    values.put(DirectMessages.RECIPIENT_ID, recipient.getId());
    if (isOutgoing) {
        values.put(DirectMessages.CONVERSATION_ID, recipient.getId());
    } else {/*  w  ww  .  j a v a2 s .  c  o m*/
        values.put(DirectMessages.CONVERSATION_ID, sender.getId());
    }
    final String text_html = TwitterContentUtils.formatDirectMessageText(message);
    values.put(DirectMessages.TEXT_HTML, text_html);
    values.put(DirectMessages.TEXT_PLAIN, message.getText());
    values.put(DirectMessages.TEXT_UNESCAPED, toPlainText(text_html));
    values.put(DirectMessages.IS_OUTGOING, isOutgoing);
    values.put(DirectMessages.SENDER_NAME, sender.getName());
    values.put(DirectMessages.SENDER_SCREEN_NAME, sender.getScreenName());
    values.put(DirectMessages.RECIPIENT_NAME, recipient.getName());
    values.put(DirectMessages.RECIPIENT_SCREEN_NAME, recipient.getScreenName());
    values.put(DirectMessages.SENDER_PROFILE_IMAGE_URL, sender_profile_image_url);
    values.put(DirectMessages.RECIPIENT_PROFILE_IMAGE_URL, recipient_profile_image_url);
    final ParcelableMedia[] mediaArray = ParcelableMedia.fromEntities(message);
    if (mediaArray != null) {
        values.put(DirectMessages.MEDIA_LIST, SimpleValueSerializer.toSerializedString(mediaArray));
    }
    return values;
}

From source file:org.getlantern.firetweet.util.ContentValuesCreator.java

License:Open Source License

public static ContentValues createStatus(final Status orig, final long accountId) {
    if (orig == null || orig.getId() <= 0)
        return null;
    final ContentValues values = new ContentValues();
    values.put(Statuses.ACCOUNT_ID, accountId);
    values.put(Statuses.STATUS_ID, orig.getId());
    values.put(Statuses.STATUS_TIMESTAMP, orig.getCreatedAt().getTime());
    final Status status;
    if (orig.isRetweet()) {
        final Status retweetedStatus = orig.getRetweetedStatus();
        final User retweetUser = orig.getUser();
        final long retweetedById = retweetUser.getId();
        values.put(Statuses.RETWEET_ID, retweetedStatus.getId());
        values.put(Statuses.RETWEET_TIMESTAMP, retweetedStatus.getCreatedAt().getTime());
        values.put(Statuses.RETWEETED_BY_USER_ID, retweetedById);
        values.put(Statuses.RETWEETED_BY_USER_NAME, retweetUser.getName());
        values.put(Statuses.RETWEETED_BY_USER_SCREEN_NAME, retweetUser.getScreenName());
        values.put(Statuses.RETWEETED_BY_USER_PROFILE_IMAGE, (retweetUser.getProfileImageUrlHttps()));
        values.put(Statuses.IS_RETWEET, true);
        if (retweetedById == accountId) {
            values.put(Statuses.MY_RETWEET_ID, orig.getId());
        } else {/*from w  w  w  . j  av  a2s  .  c  o  m*/
            values.put(Statuses.MY_RETWEET_ID, orig.getCurrentUserRetweet());
        }
        status = retweetedStatus;
    } else if (orig.isQuote()) {
        final Status quotedStatus = orig.getQuotedStatus();
        final User quoteUser = orig.getUser();
        final long quotedById = quoteUser.getId();
        values.put(Statuses.QUOTE_ID, quotedStatus.getId());
        final String textHtml = TwitterContentUtils.formatStatusText(orig);
        values.put(Statuses.QUOTE_TEXT_HTML, textHtml);
        values.put(Statuses.QUOTE_TEXT_PLAIN, orig.getText());
        values.put(Statuses.QUOTE_TEXT_UNESCAPED, toPlainText(textHtml));
        values.put(Statuses.QUOTE_TIMESTAMP, orig.getCreatedAt().getTime());
        values.put(Statuses.QUOTE_SOURCE, orig.getSource());

        values.put(Statuses.QUOTED_BY_USER_ID, quotedById);
        values.put(Statuses.QUOTED_BY_USER_NAME, quoteUser.getName());
        values.put(Statuses.QUOTED_BY_USER_SCREEN_NAME, quoteUser.getScreenName());
        values.put(Statuses.QUOTED_BY_USER_PROFILE_IMAGE, quoteUser.getProfileImageUrlHttps());
        values.put(Statuses.QUOTED_BY_USER_IS_VERIFIED, quoteUser.isVerified());
        values.put(Statuses.QUOTED_BY_USER_IS_PROTECTED, quoteUser.isProtected());
        values.put(Statuses.IS_QUOTE, true);
        if (quotedById == accountId) {
            values.put(Statuses.MY_QUOTE_ID, orig.getId());
            //            } else {
            //                values.put(Statuses.MY_QUOTE_ID, orig.getCurrentUserRetweet());
        }
        status = quotedStatus;
    } else {
        values.put(Statuses.MY_RETWEET_ID, orig.getCurrentUserRetweet());
        status = orig;
    }
    final User user = status.getUser();
    final long userId = user.getId();
    final String profileImageUrl = (user.getProfileImageUrlHttps());
    final String name = user.getName(), screenName = user.getScreenName();
    values.put(Statuses.USER_ID, userId);
    values.put(Statuses.USER_NAME, name);
    values.put(Statuses.USER_SCREEN_NAME, screenName);
    values.put(Statuses.IS_PROTECTED, user.isProtected());
    values.put(Statuses.IS_VERIFIED, user.isVerified());
    values.put(Statuses.USER_PROFILE_IMAGE_URL, profileImageUrl);
    values.put(CachedUsers.IS_FOLLOWING, user.isFollowing());
    final String textHtml = TwitterContentUtils.formatStatusText(status);
    values.put(Statuses.TEXT_HTML, textHtml);
    values.put(Statuses.TEXT_PLAIN, status.getText());
    values.put(Statuses.TEXT_UNESCAPED, toPlainText(textHtml));
    values.put(Statuses.RETWEET_COUNT, status.getRetweetCount());
    values.put(Statuses.REPLY_COUNT, status.getReplyCount());
    values.put(Statuses.FAVORITE_COUNT, status.getFavoriteCount());
    values.put(Statuses.DESCENDENT_REPLY_COUNT, status.getDescendentReplyCount());
    values.put(Statuses.IN_REPLY_TO_STATUS_ID, status.getInReplyToStatusId());
    values.put(Statuses.IN_REPLY_TO_USER_ID, status.getInReplyToUserId());
    values.put(Statuses.IN_REPLY_TO_USER_NAME, TwitterContentUtils.getInReplyToName(status));
    values.put(Statuses.IN_REPLY_TO_USER_SCREEN_NAME, status.getInReplyToScreenName());
    values.put(Statuses.SOURCE, status.getSource());
    values.put(Statuses.IS_POSSIBLY_SENSITIVE, status.isPossiblySensitive());
    final GeoLocation location = status.getGeoLocation();
    if (location != null) {
        values.put(Statuses.LOCATION,
                ParcelableLocation.toString(location.getLatitude(), location.getLongitude()));
    }
    final Place place = status.getPlace();
    if (place != null) {
        values.put(Statuses.PLACE_FULL_NAME, place.getFullName());
    }
    values.put(Statuses.IS_FAVORITE, status.isFavorited());
    final ParcelableMedia[] media = ParcelableMedia.fromEntities(status);
    if (media != null) {
        values.put(Statuses.MEDIA_LIST, SimpleValueSerializer.toSerializedString(media));
    }
    final ParcelableUserMention[] mentions = ParcelableUserMention.fromStatus(status);
    if (mentions != null) {
        values.put(Statuses.MENTIONS_LIST, SimpleValueSerializer.toSerializedString(mentions));
    }
    final ParcelableCardEntity card = ParcelableCardEntity.fromCardEntity(status.getCard(), accountId);
    if (card != null) {
        values.put(Statuses.CARD_NAME, card.name);
        values.put(Statuses.CARD, JSONSerializer.toJSONObjectString(card));
    }
    return values;
}

From source file:org.getlantern.firetweet.util.Utils.java

License:Open Source License

public static String getUserName(final Context context, final User user) {
    if (context == null || user == null)
        return null;
    return UserColorNameUtils.getDisplayName(context, user.getId(), user.getName(), user.getScreenName());
}

From source file:org.jibble.simplewebserver.RequestThread.java

License:Open Source License

public void run() {
    InputStream reader = null;/*w  w w.ja va 2 s. co  m*/
    try {
        _socket.setSoTimeout(30000);
        BufferedReader in = new BufferedReader(new InputStreamReader(_socket.getInputStream()));
        BufferedOutputStream out = new BufferedOutputStream(_socket.getOutputStream());

        String request = in.readLine();
        if (request == null || !request.startsWith("GET ")
                || !(request.endsWith(" HTTP/1.0") || request.endsWith("HTTP/1.1"))) {
            // Invalid request type (no "GET")
            sendError(out, 500, "Invalid Method.");
            return;
        }
        String path = request.substring(4, request.length() - 9);

        if (path.indexOf("collection") > -1) {

            Twitter twitter = TF.getInstance();
            try {

                // Uncomment to send tweet and test credentials
                // Status status = twitter.updateStatus("Try this tweet.");

                String id = "custom-549647846786347008";
                int collectionIdIdx = path.indexOf("custom-");
                if (collectionIdIdx > 0) {
                    id = path.substring(collectionIdIdx);
                }
                List<Status> statuses = twitter.getCustomTimeline(id);

                sendHeader(out, 200, "text/html", -1, System.currentTimeMillis());

                String title = "Tweets for '" + id + "'";
                out.write(("<html><head><title>" + title + "</title></head><body><h3>" + title + "</h3><p>\n")
                        .getBytes());

                for (int i = 0; i < statuses.size(); i++) {
                    Status status = statuses.get(i);
                    User user = status.getUser();
                    String blockquote = "<blockquote class=\"twitter-tweet\" lang=\"en\"><p>" + status.getText()
                            + "</p>&mdash; " + user.getName() + " (" + user.getScreenName()
                            + ") <a href=\"https://twitter.com/" + user.getScreenName() + "/status/"
                            + status.getId() + "\">DATE5</a></blockquote>";
                    out.write((blockquote + "<br>\n").getBytes());

                }
                out.write(("</p><hr><p>" + SimpleWebServer.VERSION
                        + "</p><script async src=\"//platform.twitter.com/widgets.js\" charset=\"utf-8\"></script></body><html>")
                                .getBytes());

            } catch (TwitterException e) {
                sendError(out, 500, "Invalid Method.");
            }

            out.flush();
            out.close();

            return;

        }

        File file = new File(_rootDir, URLDecoder.decode(path, "UTF-8")).getCanonicalFile();

        if (file.isDirectory()) {
            // Check to see if there is an index file in the directory.
            File indexFile = new File(file, "index.html");
            if (indexFile.exists() && !indexFile.isDirectory()) {
                file = indexFile;
            }
        }

        if (!file.toString().startsWith(_rootDir.toString())) {
            // Uh-oh, it looks like some lamer is trying to take a peek
            // outside of our web root directory.
            sendError(out, 403, "Permission Denied.");
        } else if (!file.exists()) {
            // The file was not found.
            sendError(out, 404, "File Not Found.");
        } else if (file.isDirectory()) {
            // print directory listing
            if (!path.endsWith("/")) {
                path = path + "/";
            }
            File[] files = file.listFiles();
            sendHeader(out, 200, "text/html", -1, System.currentTimeMillis());
            String title = "Index of " + path;
            out.write(
                    ("<html><head><title>" + title + "</title></head><body><h3>Index of " + path + "</h3><p>\n")
                            .getBytes());
            for (int i = 0; i < files.length; i++) {
                file = files[i];
                String filename = file.getName();
                String description = "";
                if (file.isDirectory()) {
                    description = "&lt;DIR&gt;";
                }
                out.write(("<a href=\"" + path + filename + "\">" + filename + "</a> " + description + "<br>\n")
                        .getBytes());
            }
            out.write(("</p><hr><p>" + SimpleWebServer.VERSION + "</p></body><html>").getBytes());
        } else {
            reader = new BufferedInputStream(new FileInputStream(file));

            String contentType = (String) SimpleWebServer.MIME_TYPES.get(Utils.getExtension(file));
            if (contentType == null) {
                contentType = "application/octet-stream";
            }

            sendHeader(out, 200, contentType, file.length(), file.lastModified());

            byte[] buffer = new byte[4096];
            int bytesRead;
            while ((bytesRead = reader.read(buffer)) != -1) {
                out.write(buffer, 0, bytesRead);
            }
            reader.close();
        }
        out.flush();
        out.close();
    } catch (IOException e) {
        if (reader != null) {
            try {
                reader.close();
            } catch (Exception anye) {
                // Do nothing.
            }
        }
    }
}

From source file:org.jwebsocket.plugins.twitter.TwitterPlugIn.java

License:Apache License

private void getUserData(WebSocketConnector aConnector, Token aToken) {
    TokenServer lServer = getServer();/*from   www .  j  ava2  s.c  o  m*/

    // instantiate response token
    Token lResponse = lServer.createResponse(aToken);
    String lUsername = aToken.getString("username");
    Integer lUserId = aToken.getInteger("userid");
    try {
        User lUser;
        // if user id is given use this to get user data
        if (lUserId != null && lUserId != 0) {
            lUser = mTwitter.showUser(lUserId);
            // if user name is given use this to get user data
        } else if (lUsername != null && lUsername.length() > 0) {
            lUser = mTwitter.showUser(lUsername);
            // otherwise return user data of provider (ourselves)
        } else {
            lUser = mTwitter.verifyCredentials();
        }
        if (lUser != null) {
            lResponse.setString("screenname", lUser.getScreenName());
            lResponse.setLong("id", lUser.getId());
            lResponse.setString("description", lUser.getDescription());
            lResponse.setString("location", lUser.getLocation());
            lResponse.setString("lang", lUser.getLang());
            lResponse.setString("name", lUser.getName());
        } else {
            lResponse.setInteger("code", -1);
            lResponse.setString("msg", "Neither UserId nor Username passed.");
        }
    } catch (Exception lEx) {
        String lMsg = lEx.getClass().getSimpleName() + ": " + lEx.getMessage();
        mLog.error(lMsg);
        lResponse.setInteger("code", -1);
        lResponse.setString("msg", lMsg);
    }

    // send response to requester
    lServer.sendToken(aConnector, lResponse);
}

From source file:org.kawalpemilukada.login.callbackTwit.java

/**
 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 * methods.//from www  . j  a  va  2 s  .co m
 *
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    Twitter twitter = (Twitter) request.getSession().getAttribute("twitter");
    RequestToken requestToken = (RequestToken) request.getSession().getAttribute("requestToken");
    String verifier = request.getParameter("oauth_verifier");
    String rurl = request.getParameter("rurl");
    try {
        twitter.getOAuthAccessToken(requestToken, verifier);
        request.getSession().removeAttribute("requestToken");
    } catch (TwitterException e) {
    }
    request.getSession().setAttribute("twitter", twitter);
    String errorMsg = "Data Anda belum terverifikasi.";
    Dashboard dashboard = CommonServices.getDashboard(CommonServices.setParentId("2015", "0"));
    Dashboard dashboard2014 = CommonServices.getDashboard(CommonServices.setParentId("2014", "0"));
    request.getSession().removeAttribute("tahun");
    UserData user = null;
    try {
        User u = twitter.showUser(twitter.getId());
        user = ofy().load().type(UserData.class).id("twit" + CommonServices.getVal(twitter.getId())).now();
        if (user == null) {
            user = new UserData("twit" + CommonServices.getVal(twitter.getId()));
            user.imgurl = u.getBiggerProfileImageURLHttps().replace("http://", "https://");
            user.nama = CommonServices.getVal(u.getName());
            user.link = "https://twitter.com/" + CommonServices.getVal(twitter.getScreenName());
            user.email = "";
            user.type = "twit";
            user.userlevel = 100;
            user.terverifikasi = "Y";
            ofy().save().entity(user).now();
            dashboard.users = CommonServices.getuserSize() + "";
            ofy().save().entity(dashboard).now();
            dashboard2014.users = dashboard.users + "";
            ofy().save().entity(dashboard2014).now();
        } else {
            user.lastlogin = CommonServices.JakartaTime();
            user.type = "twit";
            user.imgurl = u.getBiggerProfileImageURL().replace("http://", "https://");
            if (user.type.equalsIgnoreCase("twit")
                    && user.nama.equalsIgnoreCase(CommonServices.getVal(u.getName()))) {
                if (user.terverifikasi.equalsIgnoreCase("Y")) {
                    errorMsg = "";
                }
            } else {
                user.nama = CommonServices.getVal(u.getName());
                user.terverifikasi = "N";
            }
            ofy().save().entity(user).now();
        }
        Gson gson = new Gson();
        request.getSession().setAttribute("UserData", JSONValue.parse(gson.toJson(user)));
    } catch (Exception e) {
        errorMsg = "callbackTwit [processRequest] ==> " + e.toString();
    }
    response.setContentType("text/html;charset=UTF-8");
    Gson gson = new Gson();
    try (PrintWriter out = response.getWriter()) {
        /* TODO output your page here. You may use following sample code. */
        out.println("<!DOCTYPE html>");
        out.println("<html>");
        out.println("<head>");
        out.println("<title>Kawal Pemilu Kepala Daerah</title>");
        out.println("<script src=\"/bower_components/jquery/dist/jquery.min.js\"></script>");
        out.println("<script src=\"/dist/js/vendor.js\"></script>");
        out.println("</head>");
        out.println("<body>Sedang Login...");
        out.println("<script>");
        out.println("if (!jQuery.browser.mobile) {");
        out.println("try{window.opener.inviteCallback(" + gson.toJson(user) + "," + gson.toJson(dashboard)
                + ",'" + errorMsg + "');}catch(e){window.location='/'}");
        out.println("self.close();");
        out.println("}else{window.location='/#" + rurl + "'}");
        out.println("</script>");
        out.println("</body>");
        out.println("</html>");
    }

}