bacoAlunos
ENGSOFT2019
BlueGrey
calm
Elegant
Català-Valencià - Catalan
中文 - Chinese (Simplified)
中文 - Chinese (Traditional)
Česky - Czech
Dansk - Danish
Nederlands - Dutch
English - English
Suomi - Finnish
Français - French
Deutsch - German
עברית - Hebrew
हिंदी - Hindi
Magyar - Hungarian
Bahasa Indonesia - Indonesian
Italiano - Italian
日本語 - Japanese
한국어 - Korean
मराठी - Marathi
Norsk - Norwegian
Polski - Polish
Português - Portuguese
Português - Portuguese (Brazil)
Русский - Russian
Slovenčina - Slovak
Slovenščina - Slovenian
Español - Spanish
Svenska - Swedish
Türkçe - Turkish
Oëzbekcha - Uzbek
Subversion Repositories
bacoAlunos
(root)
/
impl
/
src
/
java
/
jomm
/
web
/
utils
/
TestHttpSession.java
@ 18
- Rev
Rev
Blame
|
Compare with Previous
|
Last modification
|
View Log
|
RSS feed
package
jomm.web.utils
;
import
jomm.utils.BytesUtils
;
import
javax.servlet.ServletContext
;
import
javax.servlet.http.HttpSession
;
import
javax.servlet.http.HttpSessionContext
;
import
java.util.Date
;
import
java.util.Enumeration
;
import
java.util.HashMap
;
import
java.util.Iterator
;
/**
* @author Jorge Machado
* @date 15/Mar/2008
* @time 11:23:45
* @see jomm.web.utils
*/
public
class
TestHttpSession
implements
HttpSession
{
private
5+
0
%
2Fdocs
%
2Fapi+Date">
Date
start =
new
5+
0
%
2Fdocs
%
2Fapi+Date">
Date
(
)
;
private
1.
5
.0/docs/api/java/lang/String.html">
String
id = BytesUtils.
generateHexKey
(
)
;
private
5+
0
%
2Fdocs
%
2Fapi+Date">
Date
lastAccess =
new
5+
0
%
2Fdocs
%
2Fapi+Date">
Date
(
)
;
private
1.
5
.0/docs/api/java/util/HashMap.html">
HashMap
attributes =
new
1.
5
.0/docs/api/java/util/HashMap.html">
HashMap
(
)
;
private
void
updateAccess
(
)
{
lastAccess =
new
5+
0
%
2Fdocs
%
2Fapi+Date">
Date
(
)
;
}
public
long
getCreationTime
(
)
{
updateAccess
(
)
;
return
start.
getTime
(
)
;
}
public
1.
5
.0/docs/api/java/lang/String.html">
String
getId
(
)
{
updateAccess
(
)
;
return
id
;
}
public
long
getLastAccessedTime
(
)
{
updateAccess
(
)
;
return
lastAccess.
getTime
(
)
;
}
public
ServletContext getServletContext
(
)
{
updateAccess
(
)
;
return
null
;
}
public
void
setMaxInactiveInterval
(
int
i
)
{
updateAccess
(
)
;
}
public
int
getMaxInactiveInterval
(
)
{
updateAccess
(
)
;
return
0
;
}
public
HttpSessionContext getSessionContext
(
)
{
updateAccess
(
)
;
return
null
;
}
public
5+
0
%
2Fdocs
%
2Fapi+Object">
Object
getAttribute
(
1.
5
.0/docs/api/java/lang/String.html">
String
s
)
{
updateAccess
(
)
;
return
attributes.
get
(
s
)
;
}
public
5+
0
%
2Fdocs
%
2Fapi+Object">
Object
getValue
(
1.
5
.0/docs/api/java/lang/String.html">
String
s
)
{
updateAccess
(
)
;
return
getAttribute
(
s
)
;
}
public
1.
5
.0/docs/api/java/util/Enumeration.html">
Enumeration
getAttributeNames
(
)
{
updateAccess
(
)
;
return
new
TestEnumeration
(
attributes.
keySet
(
)
)
;
}
public
1.
5
.0/docs/api/java/lang/String.html">
String
[
]
getValueNames
(
)
{
updateAccess
(
)
;
1.
5
.0/docs/api/java/lang/String.html">
String
[
]
values =
new
1.
5
.0/docs/api/java/lang/String.html">
String
[
attributes.
size
(
)
]
;
1.
5
.0/docs/api/java/util/Iterator.html">
Iterator
iter = attributes.
entrySet
(
)
.
iterator
(
)
;
int
i =
0
;
while
(
iter.
hasNext
(
)
)
{
5+
0
%
2Fdocs
%
2Fapi+Object">
Object
o = iter.
next
(
)
;
values
[
i
]
= o.
toString
(
)
;
i++
;
}
return
values
;
}
public
void
setAttribute
(
1.
5
.0/docs/api/java/lang/String.html">
String
s,
5+
0
%
2Fdocs
%
2Fapi+Object">
Object
o
)
{
updateAccess
(
)
;
attributes.
put
(
s,o
)
;
}
public
void
putValue
(
1.
5
.0/docs/api/java/lang/String.html">
String
s,
5+
0
%
2Fdocs
%
2Fapi+Object">
Object
o
)
{
updateAccess
(
)
;
attributes.
put
(
s,o
)
;
}
public
void
removeAttribute
(
1.
5
.0/docs/api/java/lang/String.html">
String
s
)
{
attributes.
remove
(
s
)
;
}
public
void
removeValue
(
1.
5
.0/docs/api/java/lang/String.html">
String
s
)
{
updateAccess
(
)
;
attributes.
remove
(
s
)
;
}
public
void
invalidate
(
)
{
updateAccess
(
)
;
attributes =
new
1.
5
.0/docs/api/java/util/HashMap.html">
HashMap
(
)
;
}
public
boolean
isNew
(
)
{
updateAccess
(
)
;
return
false
;
}
}