Re: Problem with pages saved in a variable
Re: Problem with pages saved in a variable
- Subject: Re: Problem with pages saved in a variable
- From: Chuck Hill <email@hidden>
- Date: Tue, 13 Oct 2009 12:24:54 -0700
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