Package com.google.appengine.api.users

Examples of com.google.appengine.api.users.UserService


public class SignGuestbookServlet extends HttpServlet {
    @Override
    public void doPost(HttpServletRequest req, HttpServletResponse resp)
                throws IOException {
        UserService userService = UserServiceFactory.getUserService();
        User user = userService.getCurrentUser();

        String guestbookName = req.getParameter("guestbookName");
        Key guestbookKey = KeyFactory.createKey("Guestbook", guestbookName);
        String content = req.getParameter("content");
        Date date = new Date();
View Full Code Here


                      HttpServletResponse resp)
        throws IOException, ServletException {
        SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSSSSS");
        fmt.setTimeZone(new SimpleTimeZone(0, ""));

        UserService userService = UserServiceFactory.getUserService();
        User user = userService.getCurrentUser();
        String loginUrl = userService.createLoginURL("/");
        String logoutUrl = userService.createLogoutURL("/");

        req.setAttribute("user", user);
        req.setAttribute("loginUrl", loginUrl);
        req.setAttribute("logoutUrl", logoutUrl);
        req.setAttribute("currentTime", fmt.format(new Date()));
View Full Code Here

  //@RequestMapping(value="/hra.do")
  public String test(Model model){
 
    String userId = new String("aaa");
    String token = new String("token");
    final UserService userService = UserServiceFactory.getUserService();
    final ChannelService channelService = ChannelServiceFactory.getChannelService();

    //vytvoreni ID pro uzivatele

    if(!userService.isUserLoggedIn()){
      model.addAttribute("link", userService.createLoginURL("/hra.do"));
      return "login";
    }
    else {
      if(userService != null) {
         userId = userService.getCurrentUser().getUserId();
      }
     
      //asi vytvoreni kanalu a prirazeni tokenu
      if (channelService != null){
         token = channelService.createChannel(userId);
      }
     
      String login = userService.getCurrentUser().getNickname();
      String email = userService.getCurrentUser().getEmail();
     
      //ted musime predat token do stranky uzivatele (asi :-) )
      //v googlu vemou obsah indexu a tam si daji nejaky tag ktery pak nahradi tim tokenem
      //viz index=index.replaceAll("\\{\\{ token \\}\\}",token);
      //pak nasleduje odeslani predelane stranky s tokenemn
View Full Code Here

   
    System.out.println("prijata zprava:" + text + ";");
    // login bz slo posilat abz se nemusel tahat z google
    // Bych to takhle nechal z "bezpecnostnich duvodu" treba
    final ChannelService channel = ChannelServiceFactory.getChannelService();
    final UserService userService = UserServiceFactory.getUserService();
    String login = userService.getCurrentUser().getNickname();
    // return null;
   
    HashMap<String, String> zprava=new HashMap<String, String>();
   
   
View Full Code Here

@Controller
@SessionAttributes({"userId", "login","usrKey","hraId"})
public class HracController {
  @RequestMapping("/profil.muj")
  public String vychozi(Model model){
    UserService userService = UserServiceFactory.getUserService();
    String userId;
    String login;
   
    if(!userService.isUserLoggedIn()){
      model.addAttribute("link", userService.createLoginURL("/profil.muj"));
      return "login";
    }
    else {
      //uzivatel je prihlasen
      if(userService != null) {
         userId = userService.getCurrentUser().getUserId();
         login = userService.getCurrentUser().getNickname();
         model.addAttribute("userId", Zpravy.upravText(userId));
         model.addAttribute("login", Zpravy.upravText(login));
      }
    }
    return "profil";
View Full Code Here

 
  @RequestMapping("/pripoj.se")
  public String vychozi(Model model, @RequestParam("hra") String hraId){
    //prihlaseni hrace
    final ChannelService channelService = ChannelServiceFactory.getChannelService();
    final UserService userService = UserServiceFactory.getUserService();
    String userId;
    String login;
    String token;
   
    if(!userService.isUserLoggedIn()){
      model.addAttribute("link", userService.createLoginURL("/pripoj.se?hra="+hraId));
      return "login";
    }
   
    else {
      //uzivatel je prihlasen
      if(userService != null) {
         userId = userService.getCurrentUser().getUserId();
         login = userService.getCurrentUser().getNickname();
         model.addAttribute("userId", Zpravy.upravText(userId));
         model.addAttribute("login", Zpravy.upravText(login));
        
         Hrac pripojeny=new Hrac(userId,login);
        
View Full Code Here

 
  /**Hrac je pripraven ke hre. (Aktivuje se tlacitkem v lobby.)*/
  @RequestMapping("/ready.do")
  public String ready(Model model, @RequestParam("hra") String hraId){
    //prihlaseni hrace
    final UserService userService = UserServiceFactory.getUserService();
    String userId;

   
    //TODO Overeni prihlaseni uzivatele - nema vyznam pro ajax
    if (!userService.isUserLoggedIn()) {
      model.addAttribute("link", userService.createLoginURL("/pripoj.se?hra=" + hraId));
      return "login";
    } else {
      if (userService != null) {
        userId = userService.getCurrentUser().getUserId();
        Hra hra = SpravceHer.getInstance().getHra(hraId);
        Hrac hrac = hra.getHrac(userId);
        System.out.println("Hrac "+hrac.getNick()+" is ready");
        hrac.setReady(true);
        model.addAttribute("JSON", "{\"pripraven\":true}");
View Full Code Here

  /**Hrac byl presmerovan na stranku hry. Automaticky volano klientem po nacteni.*/
  @RequestMapping("/hraNactena.do")
  public String hraNactena(Model model, @ModelAttribute("hraId") String hraId){

    //prihlaseni hrace
    final UserService userService = UserServiceFactory.getUserService();
    String userId;
   
    if (!userService.isUserLoggedIn()) {
      model.addAttribute("link", userService.createLoginURL("/pripoj.se?hra=" + hraId));
      return "login";
    } else {
      if (userService != null) {
        userId = userService.getCurrentUser().getUserId();
        Hra hra = SpravceHer.getInstance().getHra(hraId);
        Hrac hrac = hra.getHrac(userId);
        hrac.setGameLoaded(true);
        model.addAttribute("JSON", "{\"hraNactena\":true}");
      }
View Full Code Here

        throws IOException, ServletException {

        SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSSSSS");
        fmt.setTimeZone(new SimpleTimeZone(0, ""));

        UserService userService = UserServiceFactory.getUserService();
        User user = userService.getCurrentUser();
        String loginUrl = userService.createLoginURL("/");
        String logoutUrl = userService.createLogoutURL("/");

        Entity userPrefs = null;
        if (user != null) {
            DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
            MemcacheService memcache = MemcacheServiceFactory.getMemcacheService();
View Full Code Here

    public void doGet(HttpServletRequest req,
                      HttpServletResponse resp)
        throws IOException, ServletException {

        UserService userService = UserServiceFactory.getUserService();
        User user = userService.getCurrentUser();
        String recipientAddress = user.getEmail();

        String appId = ApiProxy.getCurrentEnvironment().getAppId();
        if (appId.startsWith("s~")) {
            appId = appId.substring(2);
View Full Code Here

TOP

Related Classes of com.google.appengine.api.users.UserService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.