0 Replies Latest reply on May 3, 2018 3:13 AM by n_nagraj321

    issue with cookies in the Wildfly 8.2.1

    n_nagraj321

      Hi All,

       

      We are trying to migrate from Jboss 4.2.3 GA to wildlfy 8.2.1 and we have the following piece of code where we will be storing the cookies and will be accessed later.

       

      Filter.java

      after user authenticated we will be creating the cookie and storing it.

       

      StringBuffer cookieMessage = new StringBuffer();
      cookieMessage.append("cookieName").append("=").append(sessionID).append(";");
      cookieMessage.append(expired).append(";");
      cookieMessage.append("path=/").append(";");
      cookieMessage.append("httponly").append(";");
      
      if (secured){
      cookieMessage.append("secure");
      }
      
      
      ((HttpServletResponse)response).setHeader("SET-COOKIE", cookieMessage.toString());

       

      SomeOther.java

      We will try to get the cookie created previously and use it.

       

      String result = null;
      Cookie[] cookies = request.getCookies();
      if (cookies != null){
           for (Cookie cookie: cookies){
                if ("cookieName".equalsIgnoreCase(cookie.getName())){
                     result = cookie.getValue();
                }
           }
      }

       

      The problem here is when we trying to fetch the cookie value it is not giving the latest cookie value and the same code is working in the Jboss 4.2.3 GA. Do i need to make any changes w.r.t wildfly to make it working?