You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Cassandra Bonner <cb...@yahoo.com> on 2003/03/11 07:32:55 UTC

No Cookies using 'Action'

Hi,

I've read through all the postings, and I don't see this issue
covered (except for one that's potentially related which i noted
later).  Hopefully that means this is a silly user-error on my part
and someone can quickly sort me out. :-)

We recently moved

FROM:

Solaris 2.6 server running apache 1.3.26, jdk1.3.1-b24, cocoon 2.0.3,
Tomcat 3.2.1

TO:

Solaris 2.7 (don't ask why - 9 is in the pipeline (-:), jdk1.3.1_07,
cocoon 2.0.3 (ie same version), and Catalina 4.1.18


Everything has gone smoothly for the most part, except one issue.

We have written an action which dynamically determines the name of
the stylesheet to apply.  This action looks at the cookies within the
request to determine if the cookie exists to display this tylesheet.
 
This was (and still is) working fine on our old server; but does not
work in the new environment because there are no cookies returned. 
Example snippet of relevant code from our action class :

 public Map act (Redirector redirector,
                  SourceResolver resolver,
                  Map objectModel,
                  String source,
                  Parameters params) {

    //Get the request component from sitemap components
    // NOTE: Tried ObjectModelHelper and objectModel.get

    /* Request request = (Request)
       objectModel.get(Constants.REQUEST_OBJECT);
       Request request = (Request) objectModel.get("request");*/
       
    Request request = ObjectModelHelper.getRequest(objectModel);

    //Get an array of the client cookies 
    Cookie[] cArr = request.getCookies();

    Cookie c = null;
    String VAL_RID = "";
   
    if (cArr != null) {
      for (int q=0;q<cArr.length;q ++) {
        c = (Cookie) cArr[q];
         //cookie found so set contain user to true
         //check is it user cookie or not
         if (c.getName().equals(RESELLER_COOKIE)) {
           VAL_RID = c.getValue();
         }
       }
     }


For some reason, the array of cookies (cArr in this example) is
coming back null.  We do not see the cookies even though they are
there.

We use this exact same code from within our xsp page, except as you
are aware, the request is available from within the xsp page so we
don't have to "retrieve" the request.

The cookies are available from within the xsp (on both the old and
the new server) but not from within the
action code.  For a given request, both code sets are called, and the
cookies are seen in the xsp page but not in the action.

The only post I saw remotely related to this was around catalina
sessions. We are not using sessions, but the post said that if the
session is picked up by catalina before the cookies, the cookies are
dropped.  This wouldn't explain why the cookies are available from
within the xsp but not the action, but just thought I'd make a
mention.

Any ideas you might have will be greatly appreciated.

tia,
cass

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org