• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Assigning a Session to a Custom WORequestHandler
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Assigning a Session to a Custom WORequestHandler


  • Subject: Re: Assigning a Session to a Custom WORequestHandler
  • From: Jonathan Miller <email@hidden>
  • Date: Wed, 12 Sep 2007 10:31:09 -1000

Hi,

I seem to be stuck between a server stop responding and a session has timed out place :'(

I've circuitously landed with the following code:

    private WOResponse answer(WORequest r){

    

    WOContext ctx = new WOContext(r);
    NSLog.out.appendln("4: " + r.sessionID());
//        Application.application().restoreSessionWithID(r.sessionID(), ctx);
    Application.application().saveSessionForContext(ctx);
    NSLog.out.appendln("4a: " + ctx.session().sessionID());    
    return Application.application().pageWithName("ResponsePage", ctx).generateResponse();
    }

For some reason the first logging statement returns the correct session id while the second logging statement returns what appears to be a new session ID.

If I use the following code

    private WOResponse answer(WORequest r){

    

    WOContext ctx = new WOContext(r);
    NSLog.out.appendln("4: " + r.sessionID());
        Application.application().restoreSessionWithID(r.sessionID(), ctx);
//    Application.application().saveSessionForContext(ctx);
    NSLog.out.appendln("4a: " + ctx.session().sessionID());    
    return Application.application().pageWithName("ResponsePage", ctx).generateResponse();
    }

The application hangs before reaching the second logging statement.

Finally this version

    private WOResponse answer(WORequest r){

    

    WOContext ctx = new WOContext(r);
    NSLog.out.appendln("4: " + r.sessionID());
 //     Application.application().restoreSessionWithID(r.sessionID(), ctx);
//    Application.application().saveSessionForContext(ctx);
    NSLog.out.appendln("4a: " + ctx.session().sessionID());    
    return Application.application().pageWithName("ResponsePage", ctx).generateResponse();
    }

has the same result as the first.

Any concept what I might be doing wrong?

Thanks in advance

Jon


On Sep 11, 2007, at 5:04 PM, Chuck Hill wrote:


On Sep 11, 2007, at 5:09 PM, Jonathan Miller wrote:

Hi,

Does anyone have any help with the subject line?  Basically, I'm utilizing a customer request handler but I'm unclear how to assign the session to the response.

The current function I'm using to generate the response looks like the following:

    private WOResponse answer(WORequest r){
        WOContext ctx = new WOContext(r);

String sessionID;  // Your job to get this from the request.

Application.application().restoreSessionWithID(sessionID, ctx);

Now you are responsible for checking it back in at the end of RR cycle.


    Application.application().sleep();

sleep?  Huh?


        return Application.application().pageWithName("ResponsePage", ctx).generateResponse();
    }

Thanks in advance!!

There are several request handlers in Wonder.  It might be very instructive to have a look at them.


Chuck

-- 

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Assigning a Session to a Custom WORequestHandler
      • From: Mike Schrag <email@hidden>
References: 
 >Assigning a Session to a Custom WORequestHandler (From: Jonathan Miller <email@hidden>)
 >Re: Assigning a Session to a Custom WORequestHandler (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: java.lang.OutOfMemoryError: Java heap space
  • Next by Date: Re: Assigning a Session to a Custom WORequestHandler
  • Previous by thread: Re: Assigning a Session to a Custom WORequestHandler
  • Next by thread: Re: Assigning a Session to a Custom WORequestHandler
  • Index(es):
    • Date
    • Thread