summaryrefslogtreecommitdiff
path: root/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectAction.java
diff options
context:
space:
mode:
Diffstat (limited to 'projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectAction.java')
-rw-r--r--projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectAction.java30
1 files changed, 20 insertions, 10 deletions
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectAction.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectAction.java
index 002e2a3..db3bbc8 100644
--- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectAction.java
+++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectAction.java
@@ -89,13 +89,15 @@ public class WODirectAction {
* Returns the existing session, or null if no session exists.
*/
public WOSession existingSession() {
- // FIXME: this is incorrect
- // To do this correctly, probably want to use WOSessionStore
+ // TODO check this actually works
+ WOSessionStore store = WOSessionStore.serverSessionStore();
HttpSession session = request.servletRequest().getSession();
if (session == null)
return null;
- WOSession wosession = new WOSession();
- wosession.setServletSession(session);
+ WOSession wosession = store.restoreSessionWithID(session.getId(), request);
+
+ //WOSession wosession = new WOSession();
+ //wosession.setServletSession(session);
return wosession;
}
@@ -105,9 +107,17 @@ public class WODirectAction {
* ids/cookies, this will create a new session with each request.
*/
public WOSession session() {
- // FIXME: this is incorrect
- WOSession wosession = new WOSession();
- wosession.setServletSession(request.servletRequest().getSession(true));
+ // TODO check this actually works
+
+ WOSessionStore store = WOSessionStore.serverSessionStore();
+ HttpSession session = request.servletRequest().getSession();
+ if (session == null)
+ return null;
+ WOSession wosession = store.restoreSessionWithID(session.getId(), request);
+ if (wosession == null) {
+ wosession = new WOSession();
+ wosession.setServletSession(request.servletRequest().getSession(true));
+ }
return wosession;
}
@@ -150,7 +160,7 @@ public class WODirectAction {
* this object with matching names whose type is NSArray or is convertable from
* a Collection.
*/
- public void takeFormValueArraysForKeyArray(NSArray anArray) {
+ public void takeFormValueArraysForKeyArray(NSArray<Object> anArray) {
if (anArray == null)
return;
@@ -190,14 +200,14 @@ public class WODirectAction {
* Assigns the form values for the specified keys to properties on this object
* with matching names.
*/
- public void takeFormValuesForKeyArray(NSArray anArray) {
+ public void takeFormValuesForKeyArray(NSArray<? extends Object> anArray) {
if (anArray == null)
return;
Method m;
Object key;
Object value;
- java.util.Enumeration<Object> e = anArray.objectEnumerator();
+ java.util.Enumeration<? extends Object> e = anArray.objectEnumerator();
while (e.hasMoreElements()) {
key = e.nextElement();
value = request.formValueForKey(key.toString());