Checking for session expiration
We're using JSPs and Servlets in our application. Looking for a way in code to check if the session has expired. We will need to do this from a jsp as well as a servlet (sometimes a jsp is pointed to by a link and sometimes a servlet). Can someone point me in the right direction?
Thanks all.
jl
I like the idea of a session verifier. We have about 25 jsps, 15 servlets, and at least 80 components (beans) in the app. How would the verifier component work? How could we intagrate it with all the other existing components? Ideally it would be integrated with minimal modifications...
Is the following what you had in mind with your suggestion to check for session data:
HttpSession session = request.getSession();
//or could this be used too: HttpSession session = pageContext.getSession();
String valid = session.getAttribute( KEY );
if ( null != valid ) {
//then the session is still active
jl
>
If the session has expired and you current have a new
session, then use the isNew() method to check the
session object. Or, you could check the session
object for the data you are looking for. If it is
missing, then the session expired and has been newly
created. You should build into your design a session
verifier so that you don't expierence NullPointers or
missing data.
Similar Messages
-
Hello guys,
Is there any filter provided by JSF library that can detect if user session has expire, user will be forwarded to a page.
cheers,
MarkThere is an interface HttpSessionListener. There is method sessionDestroyed() that listens for session expiration. To forward the user to a page you just put something in the session i.e. string with username or something and write PhaseListener or ServletFilter that will check on every request if this string is in the session and if not will redirects to a given page.
-
BAPI_GOODSMVT_CREATE for all expired Materials changed to blocked from rest
here are my requirements
The current functionality in SAP takes a Material and changes it from Unrestricted to Restricted at the time of Material Expiry.
The Following Functionality is required:
Upon automatically running a batch job the system will check for all expired Materials with a stock status of Restricted and change that status to Blocked
i have to call Call 'BAPI_GOODSMVT_CREATE' function module for creating the material document
Upon running Batch job, the program will look in table MCH1 for all Batch/Material combinations that have an expired SLED (field: VFDAT).
After finding all expired Batch/Material combinations in step one the program will then use that data to locate the associated Plants (field: WERKS) and Storage Locations (field: LGORT) in table MCHB
where BAPI2017_GM_CODE-GM_CODE = 04(Transfer Posting).
my question is after passing the selcted data into GOODSMVT_ITEM will the materials that i have selcted will automatically be changed from Restricted and change that status to Blocked
id so what would be the correct GOODSMVT_ITEM-MOVE_TYPE
please helphere are my requirements
The current functionality in SAP takes a Material and changes it from Unrestricted to Restricted at the time of Material Expiry.
The Following Functionality is required:
Upon automatically running a batch job the system will check for all expired Materials with a stock status of Restricted and change that status to Blocked
i have to call Call 'BAPI_GOODSMVT_CREATE' function module for creating the material document
Upon running Batch job, the program will look in table MCH1 for all Batch/Material combinations that have an expired SLED (field: VFDAT).
After finding all expired Batch/Material combinations in step one the program will then use that data to locate the associated Plants (field: WERKS) and Storage Locations (field: LGORT) in table MCHB
where BAPI2017_GM_CODE-GM_CODE = 04(Transfer Posting).
my question is after passing the selcted data into GOODSMVT_ITEM will the materials that i have selcted will automatically be changed from Restricted and change that status to Blocked
id so what would be the correct GOODSMVT_ITEM-MOVE_TYPE
please help -
Check for empty session variable
Hey there we're making a login for our jsp web application.
The login allready works and so does the log out but now we want to make a check to make it impossible to login with names that are not in the database.
So what basicly happens is as follows...
Login reads the database info:
while (rs.next()) {
if (request.getParameter("username").equals(rs.getString("username")) && request.getParameter("password").equals(rs.getString("password"))){
session.setAttribute("username", rs.getString("username"));
session.setAttribute("firstname", rs.getString("first_name"));
session.setAttribute("lastname", rs.getString("last_name"));
}but when you enter invalid information teh session variabe "lastname" for example should read null. Now we want to make a check for this null value, which should look something like this:
if(session.getAttribute("username").equals(null)){
response.setStatus(301);
response.setHeader("Location", "/index.jsp");
} else {
response.setStatus(301);
response.setHeader("Location", "/mainmenu.jsp");
}But this doesnt work, it just logs in with the null values... any1 got a clue??
edit: im actually looking for something like the isSet command in PHP to give an idea...
Message was edited by:
whappitYour test for null will always fail, because request.getParameter("username") is NEVER null, in that it exists, even though it contains no data.
Try .equals(""); instead. -
I was bought iPhone4 16 GB on Jan 07, 2013 from online shop from Laos they told me that this iPhone from Apple in Hongkong (first hand) but I check for the warranty is already expire date. What should we do? I want to know about my iPhone4 first hand or second hand. How can i check?
This will show you warranty status and give you an idea
of when originally sold:
https://selfsolve.apple.com/agreementWarrantyDynamic.do -
Before my warranty expires next month, I'd like to send in my laptop to check for any problems that I haven't detected so far. I've had it for almost three years and I'm worried that there are problems I haven't yet discovered?
Is bringing in my laptop for repair on account of wanting to ensure that there's nothing wrong with it allowed?
Also, is changing my laptop's battery for a new one covered under the warranty?AppleCare is for repairs, not for detecting any problems that havnen't surfaced as yet.
The might replace the battery if there's a problem.
Best thing to do would be to contact AppleCare > Apple - Support - AppleCare - FAQ -
How do I have Firefox check for expired/revoked certificates?
The Heartbeat vulnerability fix requires servers update openssl, get a new certificate, and revoke the old certificate. To be sure a spoofed site isn't using the revoked certificate, I need Firefox to check for revoked certificates. How do I turn this revoked certificate checking on in Firefox?
hello eghuff, firefox should be set to check for revoked certificates by default, you can check that under ''firefox > options > advanced > certificates > validation''.
-
How to handle session expiration in ATG
Hi,
We have a requirement wherein we have to redirect the user to a specific jsp when his session is expired. For example if a guest user is in cart page and is idle for more than 30 min he should be redirected to session expired page. We are using Apache web server and Jboss app server. Following are the ways i tried
1. In Apache/conf/extra/httpd-vhosts.conf, I have set ErrorDocument 409 to session expired jsp - This is failed because jsp is not a static content and only static contents will be present in webserver. If it would have been a simple html (static) then this method would have worked fine I believe.
2. In cart page I have set the sessionExpirationURL of cartformhandler to appropriate jsp, checkForValidSession to true, CheckSessionExpiration.expirationURL to same session expired jsp. I am not sure why this is not working.
Please let me know the best way to handle this situation. Any suggestions would be appreciated.
Regards,
AvinashWhen user clicks any link on your page after session expired then you can redirect him to login page through your formhandler if a handleX() method was invoked by the request or you can use a filter which can check for something like profile.isTransient(). You can then redirect to the login page from your filter keeping a parameter of the original url to be used as login success url so that after login you can again redirect to the page that user originally intended to see.
For detecting user idleness in browser, here is one of the possible approach using javascript by implementing a document level keyboard/mouse listener to detect user interaction in your page:
<script type="text/javascript">
var t;
window.onload = resetTimer;
document.onmousemove = resetTimer;
document.onkeypress = resetTimer;
function handleIdleTimedOut() {
//alert("You are now logged out.");
window.location.href = 'logout.jsp';
function resetTimer() {
clearTimeout(t);
var timeoutPeriod = 1000 * 60 * 5; //5 minutes
t = setTimeout(handleIdleTimedOut, timeoutPeriod);
</script>Apart from this, you may also want to take a look at reverse ajax to send the timed out kind of notification to the browser with the help of a HttpSessionListener:
http://directwebremoting.org/dwr/documentation/reverse-ajax/index.html
Hope this helps.
Edited by: Nitin Khare on Aug 23, 2012 12:15 AM -
Portal Session Expiration after 10 minutes.
Hello Experts,
We are running on EP 7.0 ABAP+JAVA stack.The UME has been configured on ABAP stack.
We have a requirement to auto logoff the portal if no activity is done for 10 minutes.
I have gone through SAP Notes and came to know this is not possible in current portal framework. In some threads I got clue to set some parameters for SSO expiration and Security session expiration but that did not gave desired result.
I have set the security session to 10minutes in Visual administrator.(default 27h) [Security Provider -> SessionExpirationPeriod ]but nothing happened I am still in portal session after 10 minutes.
I made the change in -> /usr/sap/<SID>/<inst>/j2ee/cluster/server0/apps/sap.com/irj/servlet_jsp/irj/root/web-inf/web.xml
And change the session time out to 10 minutes. But same result nothing happened.
Please guide what settings I am missing. What else I have to do to get the session expire.
thanks & regards
shankarHi,
Check this:
Redirect user to a custom "logoff" page after 10 minutes of user inactivity
To set Logon Tickets Validity Period:
http://help.sap.com/saphelp_nw70/helpdata/EN/45/18b6cfe1235d79e10000000a11466f/frameset.htm
Regards,
Praveen Gudapati -
Frank session expiration sample - Does it work with a Custom JAAS Module ?
I configured the sample as described in "Detecting and handling user session expiry" - http://thepeninsulasedge.com/frank_nimphius/2007/08/22/adf-faces-detecting-and-handling-user-session-expiry/
I also have a custom database JAAS login module as described in http://www.oracle.com/technology/products/jdev/howtos/1013/oc4jjaas/oc4j_jaas_login_module.htm
Thing is that when the session expires (timeout) I am redirected to the Login.jsp page of the JAAS Login Module instead of the SessionHasExpired.jspx page.
Is there any way to say that the filter should go before the JAAS module ?
Am I missing something ?
Thanks,
Claudio.Claudio,
no, unfortunately not. The servlet filter is executed after the container checked for user authentication. This is less a problem for BASIC and cerificate based authentication because in both cases users are authenticated automatically (even if using custom LoginModules) by the brower or cerificate.
Form based authentication is different because the browser doesn't re-establish the authentication and the container checks for security before the servlet is called.
Frank -
SESSION EXPIRED and CPU Utilisation is 100% when called from Pro*C
Dear Colleague
We are having a production system developed using Pro*c and PL/SOL packages in HP Unix.
The system is doing the following,
A file will be decoded using Proc and data will be load into 3 temporary tables (permanent table used for temporary) using SQLLoader. Then it calls a PL/SQL package which will process the data in the temporary tables and will store the summary information in Transaction table and will returns a unique id to the calling Pro*c module. The whole process is completed in a single process/oracle session.
The PL/SQL package, join the 3 Temporary tables and retrieve the data into an Oracle object(Collection) and process it. Then the processing summary will be loaded into Transaction table and return the Primary key.
Now the problem is, when the temporary tables are loaded with more than 200,000 rows, in some cases the system is running for hours before it finish. And during the process the session shows as EXPIRED in the database and CPU utilization for the respective ProcessId in Unix is almost 100%. Then after a while the session comes alive and finishes the process.
And for some other cases, with same row count, the entire process finished in seconds.
If the same process (PL/SQL package) when run directly using a separate session inside the database(and the temporary tables are still available), rather than calling from Pro*c, it finishes in seconds, where it took hours when called from Pro*c.
It will be highly appreciated, if anyone let me know, what actually is wrong. whether it is the resource allocation or should there any known problem in calling huge PL/SQL packages from Pro*C.
we are using Oracle 10g and HP-UX ed42 B.11.31 U System.
regards
SajidDear Colleague
I just want to rephrase the problem again.
We have a Pro*C application. This will read the binary file and dump the data in ascii format to a data file. Then, within from the pro*C, 14 Dynamic tables will be created using EXEC SQL EXECUTE IMMEDIATE statement, each having almost a maximum of 45 columns. Also, created INDEXES to the tables in the same way from Pro*C.
And Control file will be created as follows
OPTIONS (SILENT=(FEEDBACK)) UNRECOVERABLE
LOAD DATA
INTO TABLE FILENAME_BCI_USED
FIELDS TERMINATED BY '|'
TRAILING NULLCOLSColumns Listed
Then Sql loader will be called using system commands (from pro*C itself) to loead the data into the table, as follows.
sprintf(syscommand,"sqlldr %s CONTROL=%s DATA=%s log=%s rows=5000 direct=true", glb_connect_string,ctl_file,data_file, log_file );
ret_value = system(syscommand);data loaded successfully.
Then the Pro*C will call a PL/SQL package for processing the data.
The PL/SQL package, to process the data, dynamically construct the below query and use it for the reference cursor to retrieve data and load into a collection.
v_sql_query := 'SELECT '|| '/*+ index(b '||p_File_Name ||'_1) index(b '||p_File_Name ||'_2) index(s '||p_File_Name ||'_3) index(s '||p_File_Name ||'_4) index(s '||p_File_Name ||'_5) index(s '||p_File_Name ||'_6) index(e '||p_File_Name ||'_7)*/' || '
iot_call_record(b.rec_no ,
b.rec_type ,
substr(b.field1,1,15) ,
nvl(substr((select s0.field1 from ' || SU_Table ||
' s0 where s0.rec_no = s.rec_no and s0.sub_rec_type = 203) ,1, 25),
substr(b.field2, 1, 25)),
substr(b.field3,1,25) ,
b.field4 ,
b.field5 ,
s.field1 ,
s.field2 ,
(select sum(s1.field1) from ' || SU_Table ||
' s1 where s1.field2 = s.rec_no and trim(s1.field2) = ''00'' ) ,
s.field3 ,
e.field2/power(10,e.field3) ,
s.field4 ,
s.field5 ,
s.field6 ,
s.field7 ,
s.field8 ,
s.field9 ,
s.field10 ,
nvl(b.field6,''F'') ,
NULL ,
s.field11 ,
(select sum(s2.field11) from ' || SU_Table || ' s2 where s2.rec_no = s.rec_no) ,
NULL)
FROM ' || BCI_Table || ' b , ' || SU_Table || ' s, ' || EXCH_Table ||
' e WHERE b.filename = s.filename
AND b.rec_no = s.rec_no
AND (b.field7 = 0 OR b.field7 = 1)
AND TRIM(s.chg_type) = ''00''
AND (s.field1 = e.field2_Code )
AND not(s.field4 = ''V'' and s.field12 > 1)
AND not(s.field4 = ''W'' and s.field12 > 1)
AND not(b.rec_type = 75 and s.field12 > 1)
AND not(b.rec_type = 75 and s.field4 =''D'')
AND s.sub_rec_type <> 203
and (s.field12 = 1 or b.rec_type not in (20,30))';
OPEN cur_call_events FOR v_sql_query;
LOOP
g_tab_call_events.DELETE;
-- Execute immediate v_sql_query bulk collect into g_tab_call_events;
FETCH cur_call_events BULK COLLECT
INTO g_tab_call_events limit 5000;
EXIT WHEN g_tab_call_events.COUNT = 0;
BEGIN
SAVEPOINT Block_Begin;
process_records(p_file_name,
g_tab_call_events);
EXCEPTION
WHEN Severe_Error THEN
Write_error('S');
ROLLBACK TO Block_Begin;
WHEN Warning THEN
Write_error('W');
WHEN NO_DATA_FOUND THEN
Write_error('S');
ROLLBACK TO Block_Begin;
END;
END LOOP;And the above module is behaving strangely.
With almost 150K or more rows in BCI_Table & SU_Table each and less than 10 rows in EXCH_Table, the application takes more than 100 minutes to complete the process.
When we checked the session activity, it is showing the same query for a very long time.
Where as files with 100K or less rows are getting processed in a minute.
And the performance for 150K+ rows is inconsistent, that when we isolate the package and run it directly calling from oracle, it is getting executed in less than 4 minutes. Whereas it takes 100+ minutes from Pro*C.
The execution plan for the above query is given below
Object Owner Object Name Cost Cardinality Bytes CPU cost IO cost
SELECT STATEMENT, GOAL = HINT: FIRST_ROWS 494 2497 494406 143334576 483
TABLE ACCESS BY INDEX ROWID SCHEMA1 FILENAME_SU_USED 4 1 21 30610 4
INDEX RANGE SCAN SCHEMA1 FILENAME_3 3 1 21764 3
SORT AGGREGATE 1 13
INDEX RANGE SCAN SCHEMA1 FILENAME_5 3 1 13 22064 3
SORT AGGREGATE 1 7
TABLE ACCESS BY INDEX ROWID SCHEMA1 FILENAME_SU_USED 4 1 7 30706 4
INDEX RANGE SCAN SCHEMA1 FILENAME_3 3 1 21764 3
CONCATENATION
HASH JOIN 355 2496 1307904 103068617 347
TABLE ACCESS FULL SCHEMA1 FILENAME_EXCH_USED 3 2 26 35987 3
HASH JOIN 352 2496 813696 96532618 344
VIEW SYS VW_NSO_1 4 20 880 12549326 3
HASH UNIQUE 4 20 220 12549326 3
TABLE ACCESS FULL SCHEMA2 IOT_SERVICE_MATRIX 3 20 220 45207 3
HASH JOIN 347 15850 2234850 76145180 341
TABLE ACCESS FULL SCHEMA1 FILENAME_SU_USED 130 16584 1111128 33625872 127
TABLE ACCESS FULL SCHEMA1 FILENAME_BCI_USED 217 23757 1758018 31405896 214
NESTED LOOPS 139 1 198 40265959 136
NESTED LOOPS 135 1 154 27716633 133
NESTED LOOPS 132 1 141 27680646 130
TABLE ACCESS FULL SCHEMA1 FILENAME_SU_USED 129 1 67 27655992 127
TABLE ACCESS BY INDEX ROWID SCHEMA1 FILENAME_BCI_USED 3 1 74 24654 3
INDEX RANGE SCAN SCHEMA1 FILENAME_1 2 1 15493 2
TABLE ACCESS FULL SCHEMA1 FILENAME_EXCH_USED 3 1 13 35987 3
VIEW SYS VW_NSO_1 4 1 44 12549326 3
SORT UNIQUE 4 20 220 12549326 3
TABLE ACCESS FULL SCHEMA2 IOT_SERVICE_MATRIX 3 20 220 45207 3Regards
Sajid
Edited by: user12039545 on Jul 11, 2010 12:05 AM
Edited by: user12039545 on Jul 11, 2010 12:15 AM
Edited by: user12039545 on Jul 11, 2010 12:32 AM
Edited by: user12039545 on Jul 11, 2010 12:34 AM
Edited by: user12039545 on Jul 11, 2010 12:37 AM -
Session expired, no logout page displayed
Hi, everyone:
I have been stuck here for a long time. I try to detect session expires and display a logout page.
I tried in the servlet if session.get("username") == null) then forward to logout.jsp, it never reach that page
I also tried using javascript:
<SCRIPT LANGUAGE="JavaScript">
var username = <%=session.getAttribute("username")%>
if (nickname == null)
location.href = 'logout.jsp';
if (parent.frames.length != 0) {
top.location.href = 'logout.jsp';
</SCRIPT>
I never reach the logout page, it display a login page by default. I think the session.getAttribute or value is not working because the session is already expired.
It's such a headache, does anyone has the same problem and find the solution.
I guess it may talke more code either in javascript to detect the session or in a servlet, but how to do it especially if the current pages are in a framesets.
Appreciated any code!!
ann1)Are the managed servers part of a Cluster? If they are not part of a cluster, then the session replication will not work.
2)Deploy the application to cluster NOT to two managed servers
3)Check the cookie settings - name and domain -
Folks,
I am facing one intersting problem . I described it below .
In our production system we have set the user session expiriration time as 1 hour . But from this moring one session expired unexpectedly and other one is working fine ,if some users opened two sessions .. i don't know why . I checked their network . But it's fine.
Please help me .Thanks for your reply Gagan...
Error message is "User sesision closed by system"
SM21 Logs :
Delete session 001 after error 024
Delete session 001 after error 024
Delete session 001 after error 024
Delete session 001 after error 061
Delete session 001 after error 024
Delete session 003 after error 024
Delete session 002 after error 024
Delete session 001 after error 024
Delete session 001 after error 024
Delete session 001 after error 024
Delete session 002 after error 024
Delete session 002 after error 024
Delete session 001 after error 061
Delete session 002 after error 061
Delete session 003 after error 061
Delete session 001 after error 061
Delete session 002 after error 061
Connection to user NNNNNNN (XXXXXX ), terminal 496 (YYYYYYYY) lost
Edited by: rdhaprakasam2003 on Apr 26, 2010 8:26 PM -
Session Expired Error in Oracle Vision Demo due to absence of a cookie !!
Hi Folks,
I kept getting the session expired error in Vision Demo even after I had supplied the right user id/password combos. So I set up a on-logon trigger in the APPS schema and it turns out that the Front End JSP page calls the ICX_SEC package.
Herein it refers to the function valiadateSession inside this package. I did some digging around and it turns out that inside this function using the OWA_COOKIE utility the function tries to get the details of a cookie called 'WF_SESSION' and passes this to the Front End.
And this is where it is failing. I checked to see and the return from the OWA_COOKIE.GET('WF_SESSION') does return a value of NUM_VALS=0. So the problem remains that the intial JSP page is unable to either set the cookie or I am reading this all wrong.
Plan to dig deep into this. Meanwhile if anyone has faced this error any helpful tips would be deeply appreciated.
PS: I am new to Oracle Apps and have to learn it in a hurry :(( Sad part is am unable to even get into the Application as of now :P I have installed and am using 11i.8 (11.5.8).
cheers
~
kaushikCheck your browser settings for accepting cookies from this domain, you must have tried this by now clearing all your browser cache and cookies.
try solutions beacon site where they have Oracle Apps Demo Instances for Public
http://www.solutionbeacon.com/tools_vision.htm -
How do i change Session Expire Time in APEX?
Greetings,
I am developing in APEX 3.2.
Every few minutes while i am developing i have to log in again, it gets tiresome every day having to login 100 times.
So i would like to know where i can change the time it takes for the session to expire so i can change it tom some big value, let's say like 8 or 12 hours.
I would also like to change the time a regular user can stay logged in cause it also has a small time for the session expire and since i have to test everything i develop it would also be great not having to logging every few minutes when i am testing something.
I check the places i remembered in administration and user preferences but apart from acount validity i didn t find anything.
Thanks everyone,
Best regards
My Homepage
Edited by: Igor Carrasco on Apr 24, 2009 1:18 PMHi
in Apex 3.2: go to > Application #### > Shared Component > Security > Session Time Out... and set max session lenght and Idle and out URL.
Regards
Rolando
Maybe you are looking for
-
Imac-external Display only possible?
Hi, is there any way to either use the Imac display or an external monitor/ beamer with a current Imac? I would like to use the internal display if I use the Imac for music etc but would like to play games via a beamer. I would like to have the graph
-
MBA glitches, esp menu bar
So I've had some glitches with my 10-day old top-end 11" MBA First, Flash and Java worked for 3 days, then didn't for another 3 days, then started magically working again--no updates, no nothing, just decided to work again. The sleep/power/down/wake
-
Sales - Quoting Functionality - XML Publisher and XSL.
Hi , We have changed output in Quoting to use XML Publisher instead of Reports Server. How can we view the XML tags to create the XSL file? Its possible to see XML output from PO's , SOA's etc when printed vis Concurrent Mgr and Oracle Forms but the
-
Initiate process link in ALUI Collaboration
We installed WE with ALBPM. So the ALUI is integrated with ALBPM. Every thing is working fine, but the 'Initiate Process' button in ALUI collaboration is not showing any processes to attach. Are there any requirements while designing process in order
-
Mail via the reports server through the portal
we have a portal install on nt(in a few month it will be transport to unix (sun)). as i run report on reports with desttype=mail it works. but as it run from the portal it returns with rep-4202,4224. please guide me the procedure to make it work. tha