1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.web; |
21 |
|
|
22 |
|
import javax.servlet.http.HttpSession; |
23 |
|
|
24 |
|
import org.apache.commons.lang3.StringUtils; |
25 |
|
import org.xwiki.model.EntityType; |
26 |
|
import org.xwiki.model.reference.DocumentReference; |
27 |
|
import org.xwiki.model.reference.DocumentReferenceResolver; |
28 |
|
import org.xwiki.model.reference.EntityReference; |
29 |
|
import org.xwiki.model.reference.WikiReference; |
30 |
|
|
31 |
|
import com.xpn.xwiki.XWikiContext; |
32 |
|
import com.xpn.xwiki.XWikiException; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
@version |
40 |
|
|
|
|
| 71.4% |
Uncovered Elements: 6 (21) |
Complexity: 3 |
Complexity Density: 0.19 |
|
41 |
|
public class LogoutAction extends XWikiAction |
42 |
|
{ |
|
|
| 70% |
Uncovered Elements: 6 (20) |
Complexity: 3 |
Complexity Density: 0.19 |
|
43 |
1 |
@Override... |
44 |
|
public boolean action(XWikiContext context) throws XWikiException |
45 |
|
{ |
46 |
1 |
XWikiRequest request = context.getRequest(); |
47 |
1 |
XWikiResponse response = context.getResponse(); |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
1 |
HttpSession currentSession = request.getSession(false); |
52 |
1 |
if (currentSession != null) { |
53 |
1 |
synchronized (currentSession) { |
54 |
1 |
currentSession.invalidate(); |
55 |
|
|
56 |
|
|
57 |
1 |
request.getSession(true); |
58 |
|
} |
59 |
|
} |
60 |
|
|
61 |
|
|
62 |
1 |
String redirect; |
63 |
1 |
redirect = context.getRequest().getParameter("xredirect"); |
64 |
1 |
if (StringUtils.isEmpty(redirect)) { |
65 |
0 |
DocumentReferenceResolver<EntityReference> resolver = |
66 |
|
Utils.getComponent(DocumentReferenceResolver.TYPE_REFERENCE); |
67 |
|
|
68 |
|
|
69 |
0 |
DocumentReference reference = resolver.resolve(null, EntityType.DOCUMENT); |
70 |
|
|
71 |
|
|
72 |
0 |
reference = reference.setWikiReference(new WikiReference(context.getWikiId())); |
73 |
|
|
74 |
|
|
75 |
0 |
redirect = context.getWiki().getURL(reference, "view", context); |
76 |
|
} |
77 |
1 |
sendRedirect(response, redirect); |
78 |
1 |
return false; |
79 |
|
} |
80 |
|
} |