• 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: AJAX WebObjects Integration
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AJAX WebObjects Integration


  • Subject: Re: AJAX WebObjects Integration
  • From: "Pierce T. Wetter III" <email@hidden>
  • Date: Fri, 19 May 2006 12:18:21 -0700


On May 19, 2006, at 11:53 AM, Chuck Hill wrote:

Pierce, thank  you.  That was superb!  One small edit and a note:

On May 19, 2006, at 10:48 AM, Pierce T. Wetter III wrote:

Reality: WebObjects is actually a better framework for use with WebObjects then Rails because it has a better component system then Rails.

Think this should read Reality: WebObjects is actually a better framework for use with AJAX than Rails because it has a better component system then Rails.

Doh. Yep.




[[[However, there's a gotcha there, because component actions called from javascript count towards your backtracking count. Since someone might be going down through the page clicking rating after rating, that could be a problem. If your max backtracking count was 10, and you had 20 postings on a page, they wouldn't be able to rate the 11th page. ]]]

To avoid problems like this, I have added methods like this to Session:

    public void savePage(WOComponent aPage)
    {
        if (shouldCachePage(aPage))
        {
            super.savePage(aPage);
        }
    }




/**
* Returns <code>true</code> if the passed WOComponent is eligible to be added to the page cache. This is used to keep pages that do not need to be cached from the page cache. For example, pages that are generated only from Direct Actions and which do not contain Component Action URLs do not need to be cached.
*
* @param aPage the WOComponent to check for eligibility
* @return <code>true</code> if the passed WOComponent is eligible to be added to the page cache
*/
public boolean shouldCachePage(WOComponent aPage)
{
return ! (aPage instanceof PartialPage);
}



Where PartialPage is an interface that components can implement to indicate that they don't belong in the page cache.

Hey, great tip. That makes component actions easier to use with Ajax.

  Hmmm... So I'll have to go adjust my component class hierarchy:

  WOComponent
    EZComponent
      EZPagelet
         EZPage

So both EZPagelet and EZPage can pull stuff out of a direct action URL via key value coding, but EZPagelet's default to not being cacheable. I can avoid the "instance of" call by doing:

public void savePage(WOComponent aPage)
    {
        if (((EZPagelet) aPage).shouldCache())
        {
            super.savePage(aPage);
        }
    }

and making sure that EZPagelet and EZPage both implement shouldCache () (pagelet returns false, page returns true).

That's going to enforce that all direct actions are subclasses of EZPage or EZPagelet, but that's a good thing for security anyways.

 Pierce


_______________________________________________
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
References: 
 >RE: AJAX WebObjects Integration (From: "Tokalak, Ahmet. D-IT2" <email@hidden>)
 >Re: AJAX WebObjects Integration (From: "Pierce T. Wetter III" <email@hidden>)
 >Re: AJAX WebObjects Integration (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: AJAX WebObjects Integration
  • Next by Date: method failed to update row
  • Previous by thread: Re: AJAX WebObjects Integration
  • Next by thread: Re: AJAX WebObjects Integration
  • Index(es):
    • Date
    • Thread