Content Management and Capture

Content Management and Capture

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
Expand all | Collapse all

request.getSession.getAttribute("arik") is null

  • 1.  request.getSession.getAttribute("arik") is null

    Posted Mon November 30, 2020 03:32 PM

    Dear all,

    i am using Navigator ver 3.0.8, websphere ver 9.0.5.2.

    till now, on all versions, i use

    request.getSession.setAttribute("x","1") or

    request.getSession.getServletContext().getContext(EDScontextPath).setAttribute("x","2").

    but in my new server, with navigator 3.0.8 and WAS 9.0.5.2,

    the request.getSession.getAttribute("x") is null.

    there is some new settings that i should to use?



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 2.  RE: request.getSession.getAttribute("arik") is null
    Best Answer

    Posted Tue December 01, 2020 03:26 AM

    Hi,

    You may try

    request.getSession(true).setAttribute("X", "1") request.getSession(false).getAttribute("X")

    where request is an instance of HttpServletRequest.

    Regards,

    Angie



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 3.  RE: request.getSession.getAttribute("arik") is null
    Best Answer

    Posted Tue December 01, 2020 07:29 AM

    Thank you Angie,

    but it still doesn't work.(on other versions(2.0.3 , 3.0.3) it works well)

    any ideas?

    some WebSphere setting that can effect?



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 4.  RE: request.getSession.getAttribute("arik") is null
    Best Answer

    Posted Tue December 01, 2020 07:39 AM

    Hi,

    Actually I would think it is not ICN related. The request and session are managed by web container. I recommend to use request.getSession(false) in everywhere, or it may effect the authentication and generate a new session, then attributes in old session will be gone.

    And you may try to print out the session id before set and get to monitor if they are the same sessions.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 5.  RE: request.getSession.getAttribute("arik") is null
    Best Answer

    Posted Tue December 01, 2020 08:34 AM

    I check with SessionId, and they are the same session id.

    i try to set it to "false", same.

    i open version 3.0.3 in the same browser, and it work.

    so i think it can be something related to navigator 3.0.8 websphere setting



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 6.  RE: request.getSession.getAttribute("arik") is null
    Best Answer

    Posted Fri December 04, 2020 06:32 AM

    Oh...I tested this with 308 and 309 ​development environment, they both works.

    I created an ICN plugin with a request filter for /p8/openFolder with :

    HttpSession session = request.getSession(false);

    if( session != null ) {

    System.out.println( "--------------------------------------Set attribute by session: " + session.getId() );

    session.setAttribute( "TestSessionPlugin"  , "This value is set by Test Session Plugin:" + session.getId());

    }


    Then I create a response filter for /p8/openFolder with:

    HttpSession session = request.getSession(false);

    if( session != null ) {

    System.out.println( "--------------------------------------Get value from sessin: " + session.getId() );

    String sessionString = (String) session.getAttribute( "TestSessionPlugin" );

    System.out.println( "--------------------------------------" + sessionString );

    }


    It works well with 308 deployed on WAS. The sessionString has the value set before. I'd think you may contact WAS team to know what happens for your session.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 7.  RE: request.getSession.getAttribute("arik") is null
    Best Answer

    Posted Sun December 06, 2020 07:28 AM

    Dear Calvin,

    Thank you,

    i will contact WAS Team




    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration