GWT uygulamasında oturum özniteliği almak istiyorum. ben buHttpServletRequest request = this.getThreadLocalRequest() dönüş null?
HttpServletRequest request = this.getThreadLocalRequest();
System.out.println("Check HttpServletRequest");
HttpSession session = request.getSession();
gibi Oturumu olsun ama this.getThreadLocalRequest()
hep null
olduğunu.
KODU:
Müşteri:
@RemoteServiceRelativePath("service.s3gwt")
public interface getAttributeSession extends RemoteService
{
String getSessionAttribute(String name);
}
public interface getAttributeSessionAsync
{
void getSessionAttribute(String name, AsyncCallback<String> callback);
}
Sunucu:
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import daTotNghiep.client.service.getAttributeSession;
public class getAttributeSessionImpl extends RemoteServiceServlet implements getAttributeSession
{
private static final long serialVersionUID = 1L;
public String getSessionAttribute(String name)
{
// TODO Auto-generated method stub
HttpServletRequest request = this.getThreadLocalRequest();
System.out.println("Check HttpServletRequest");
if(request == null) System.out.println("SO BAD");
// HttpSession session = request.getSession();
// System.out.println("ID session "+session.getId());
return "";
}
}
çağrı yöntemi getSessionAttribute()
Ben this.getThreadLocalRequest()
hep null
döndürür görüyoruz
uğramadan sen
doPost()
üzerine yazılmadığı emin? – kozla13