Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Getting a Cookie Value from Path other than Context Root

Sameer.DarbhaOct 15 2019 — edited Oct 15 2019

Hi

JDeveloper/ADF 11.1.1.9

Upon login we are creating 2 cookies as follows in javascript (login page)

     document.cookie = "cookie1=value1;path=/;secure";
     document.cookie = "cookie2=value2;path=/subpath;secure";

Following code can be used to read a cookie value in Managed Bean

     FacesContext    vFacesContext     = FacesContext.getCurrentInstance();
     ExternalContext vExternalContext  = vFacesContext.getExternalContext();
     Map             vRequestCookieMap = vExternalContext.getRequestCookieMap();
     Cookie          authCookie        = (Cookie) vRequestCookieMap.get(COOKIE_NAME);
 
We are getting the value of the cookie 'cookie1' which is in the context root path
But we are not getting the value of the cookie 'cookie2' in the /subpath

Is there a way to read a cookie value that is in '/subpath' in ADF code (Managed Bean)

When we use Developer Tools in the Chrome to see if the cookies are getting created properly, we see both the cookies and their values.

Thanks for any help
Sameer

Comments
Post Details
Added on Oct 15 2019
1 comment
629 views