• 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: Problem with pages saved in a variable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with pages saved in a variable


  • Subject: Re: Problem with pages saved in a variable
  • From: Miguel Arroz <email@hidden>
  • Date: Tue, 13 Oct 2009 21:13:15 +0100

Hi!

Chuck is right, your completely screwing WebObjects up. pageWithName returns you a component initialized for a given context (WOContext, not EOEditingContext). If you are using the same pages for different situations and mixing up sessions and stuff, NOTHING will work. Nothing. Even if it APPEARS to work on your computer, it won't on production with many users using the app simultaneously. I can't even think about how many problems will it create, WO is simply not supposed to work like that.

Also, WebObjects already caches a lot of stuff internally (if you compare the time it takes to load a page generated by a given component the first and subsequent times, you'll see this clearly), so you don't need to hack in any more caches, you're probably making the performance worse instead of improving it (and killing correctness, of course).

  Delete all that, and simply use pageWithName normally.

  Yours

Miguel Arroz

On 2009/10/13, at 20:24, Chuck Hill wrote:

You are messing up WO's maintenance of page state. I am surprised this does not cause more issues for you.

Why are you doing this?  It seems like a rather bad idea.


Chuck



On Oct 13, 2009, at 1:29 AM, Andri vonAllmen wrote:

Dear List,

in an Applications Session, a NSMutableDictionary object is used for
"caching" pages. Everytime the "pageWithName" method is called, the
dictionary is queried in order to determine if the requested page does
already exist, if true the existing page is returned, else a new one is
generated and stored in the dictionary. This is made in Application.java
by overriding the "pageWithName" method:


public WOComponent pageWithName(String aName, WOContext aContext) {
Object result = null;
if ( aContext.hasSession() ) result =
((NSMutableDictionary) ((Session)aContext.session()).cachedPages()).objectForKey(aName);
if ( result == null ) {
result = super.pageWithName(aName, aContext);
if ( aContext.hasSession() ) if ( aName != null )
((NSMutableDictionary) ((Session)aContext.session()).cachedPages()).setObjectForKey(result,
aName);
}
return (WOComponent)result;
}


This works with one exception. Making changes on Enterprise Objects is
not possible in every case. Saving changes works, if always the same
object is changed but not if two different objects are changed (changing
the first, saving the changes, then changing the second and saving the
changes). But if making changes on a object, saving it, and then revert
the changes (to the same state as before changing it the first time),
making changes on other objects is possible.


As mentioned in the WO API Reference, for pages being stored in a
variable the "ensureAwakeInContext" method has to be called, but this
has no effect. Same if refreshing the objects in the default editing
context ("refreshAllObjects", "refaultAllObjects") which is used on all
pages.


Any suggestions or other hints would be appreciated.

Regards
Andri


--- Disclaimer:
--------------------------------------------------------- This email and
contents is for use only by the intended recipient. If you are not the
individual or entity to whom it is addressed, you are hereby formally
notified that any use, copying or distribution of this email and
attachments, in whole or in part, is strictly prohibited. If you have
received this email in error, please notify the sender and delete the
message and attachment(s) from your system. Any views, opinions or
information, expressed or contained in this email, are those of the
sender and not necessarily reflect those of CEDES. To help protect our
environment, please avoid printing out this information unnecessarily.
_______________________________________________
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

-- Chuck Hill Senior Consultant / VP Development

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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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:
    • Antw: Re: Problem with pages saved in a variable
      • From: "Andri vonAllmen" <email@hidden>
References: 
 >Problem with pages saved in a variable (From: "Andri vonAllmen" <email@hidden>)
 >Re: Problem with pages saved in a variable (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Snow Leopard and TimeZones
  • Next by Date: [MEETING] WO-Nova October 27, 2009
  • Previous by thread: Re: Problem with pages saved in a variable
  • Next by thread: Antw: Re: Problem with pages saved in a variable
  • Index(es):
    • Date
    • Thread