cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prakesh kt <prakes...@gowebtop.com>
Subject maintain'g session problem
Date Wed, 27 Feb 2008 12:12:27 GMT
Hi ,

  I am new  to cxf . My services are  successfully exposed  and i wrote 
the client stubs to communicate with my services .currently i am   stuck 
up with  one problem and i am looking for some pointers on this.

  I would like check the  authentication of the user before using my 
services. I  have list of valid user details in my db.

whenever  User trying to  use  my services , I want to check the 
authentication. for this purpuse i am calling a method internally when 
ever the user invoke my service and binding the  username &password  and 
setting it in to the httpSession (please refer the below code). i hope 
that now u understand  the problem, when ever i am trying to get the 
values from the session it is giving null values.because it is creating 
the new session for every request. please help me to avoid this. I know 
in axis we can give maintainsession(true) to avoid this.

////////////////////////////(IN my Serviceimpl class)

  @Resource
   WebServiceContext wsc;

     @WebMethod
     public void isValidUser(String username, String password) {
     MessageContext context=wsc.getMessageContext();
     HttpServletRequest 
request=(HttpServletRequest)context.get(MessageContext.SERVLET_REQUEST);
     /*
      here i am calling some method to check the authentication and 
after puting some flag value in session.
   */
}

  @WebMethod
  public void getMySerivce(String str){
     HttpServletRequest 
request=(HttpServletRequest)wsc.getMessageContext().get(MessageContext.SERVLET_REQUEST);
     boolean  value=request.getSession().getAttribute("MYFLAG");// 
getting  null. because here i am getting new session instance.

}


thanks,
prakeshkt

Mime
View raw message