Subversion Repositories SmartDukaan

Rev

Rev 2147 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
419 rajveer 1
package in.shop2020.serving.controllers;
2
 
3
import javax.servlet.http.Cookie;
4
 
507 rajveer 5
import org.apache.struts2.convention.annotation.Action;
419 rajveer 6
import org.apache.struts2.convention.annotation.Result;
7
import org.apache.struts2.convention.annotation.Results;
8
import org.apache.struts2.rest.DefaultHttpHeaders;
9
import org.apache.struts2.rest.HttpHeaders;
10
 
11
@Results({
12
    @Result(name="success", type="redirectAction", 
13
    		params = {"actionName" , "test"})
14
})
15
 
16
public class TestController extends BaseController {
17
	private static final long serialVersionUID = 1L;
18
 
2147 chandransh 19
	//private static Logger log = Logger.getLogger(Class.class);
419 rajveer 20
 
21
	public TestController(){
22
 
23
	}
24
 
25
 
555 chandransh 26
	 // GET /this
507 rajveer 27
	@Action("this")
5332 rajveer 28
    public String index() {
555 chandransh 29
		this.session.invalidate();
419 rajveer 30
        Cookie[] cookies = request.getCookies();
2147 chandransh 31
        //boolean foundCookie = false;
419 rajveer 32
        long sessionId = 0;
33
 
34
        if(cookies != null){
35
	        for(int loopIndex = 0; loopIndex < cookies.length; loopIndex++) { 
36
	            Cookie cookie1 = cookies[loopIndex];
37
	            if (cookie1.getName().equals("sessionId")) {
38
	                sessionId = Long.parseLong(cookie1.getValue());
2145 chandransh 39
	            	System.out.println("Session Id is = " + sessionId);
2147 chandransh 40
	                //foundCookie = true;
419 rajveer 41
	            }
42
	        }
43
	       }
44
 
5332 rajveer 45
    	return "index";
419 rajveer 46
    }
47
 
48
}