Package org.butor.sso.dwr

Source Code of org.butor.sso.dwr.AjaxStub

package org.butor.sso.dwr;

import java.util.Locale;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.butor.ajax.BasicAjaxStub;
import org.directwebremoting.WebContext;
import org.directwebremoting.WebContextFactory;

public class AjaxStub extends BasicAjaxStub {
    public AjaxStub() {
    //OK
  }

  public String getUsername() {
    String username = null;
    WebContext webContext = WebContextFactory.get();
    if (webContext != null) {
      HttpServletRequest  req = webContext.getHttpServletRequest();
      if (req != null) {
        //TODO username = req.getRemoteUser();
        HttpSession ss = req.getSession();
        if (ss != null) {
          username = (String)ss.getAttribute("id");
        }
      }
    }
    return username != null ? username : "*"//*=anonymous
  }
 
  public Locale getLocale() {
    //TODO detect user Locale
    return Locale.ENGLISH;
  }

}
TOP

Related Classes of org.butor.sso.dwr.AjaxStub

TOP
Copyright © 2018 www.massapi.com. 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.