Skip to content

Commit

Permalink
Use dedicated methods to remove value from SessionStore
Browse files Browse the repository at this point in the history
Some containers session manager expects non-null values when
setting attributes.

Closes #22
  • Loading branch information
victornoel committed Jun 17, 2017
1 parent bec8ddc commit 4e0c6d9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ public Object get(JaxRsContext context, String key) {

@Override
public void set(JaxRsContext context, String key, Object value) {
getSession(context).setAttribute(key, value);
if (value == null) {
getSession(context).removeAttribute(key);
} else {
getSession(context).setAttribute(key, value);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ public Object get(JaxRsContext context, String key) {

@Override
public void set(JaxRsContext context, String key, Object value) {
getHttpSession(context).setAttribute(key, value);
if (value == null) {
getHttpSession(context).removeAttribute(key);
} else {
getHttpSession(context).setAttribute(key, value);
}
}

@Override
Expand Down

0 comments on commit 4e0c6d9

Please sign in to comment.