Re: Best way to transfert objects to another session
Re: Best way to transfert objects to another session
- Subject: Re: Best way to transfert objects to another session
- From: Chuck Hill <email@hidden>
- Date: Thu, 24 Nov 2005 17:51:04 -0800
On Nov 23, 2005, at 12:24 PM, Jacky Gagnon wrote:
On 05-11-23, at 14:54, Joseph Leo Moreno wrote:
Jacky,
Can you give me an example of what exactly you want to
destroy? If you're talking about Java objects in memory, couldn't
you simply point that instance variable to null (i.e. lastPage =
null) and let them get garbage collected.
I want to destroy WOComponent used for the transaction after the
transaction is completed.
ex: component where your enter your card number, component
where you confirm the transaction etc...
Is it the case that you don't want someone to backtrack and see
the data on a previous page?
Not exactly, he can backtrack, but no action can happen because the
component or the session was destroyed after the transaction was
completed.
I think you are going about this the wrong way. You are using a
shotgun to kill a mosquito. What you want to do is to configure that
page so that the action won't happen again. Leave the poor session
alone, it is not its fault. :-)
Try adding this to your page:
protected boolean hasBeenUsed;
public void markUsed() {
hasBeenUsed = true;
}
public boolean hasBeenUsed() {
return hasBeenUsed;
}
When the transaction has been completed,
markUsed();
Handle this flag like this:
/**
* Calls appendToResponse on replacementPage() if hasBeenUsed()
otherwise
* allows to proceed normally.
*/
public void appendToResponse(WOResponse response, WOContext
context) {
if (hasBeenUsed()) {
replacementPage().appendToResponse(response, context);
}
else {
super.appendToResponse(response, context);
}
}
/**
* Skips invokeAction if hasBeenUsed().
*
* @return result of invoking action or replacementPage() if
hasBeenUsed()
*/
public WOActionResults invokeAction(WORequest request, WOContext
context) {
if (hasBeenUsed()) {
return replacementPage();
}
return super.invokeAction(request, context);
}
/**
* Skips takeValuesFromRequest if hasBeenUsed() otherwise
* allows to proceed normally.
*/
public void takeValuesFromRequest(WORequest request, WOContext
context) {
if ( ! hasBeenUsed()) {
super.takeValuesFromRequest(request, context);
}
}
Then you need to implement:
public abstract WOComponent replacementPage() {
}
To return what to show if they try to backtrack (the confirmation
page or the home page or whatever you want.
Chuck
If so, then you could set WO's page cache to 1 (the default is 30),
No because I can only set this attribute at application level.
or set the clients browser to expire the page (there are several
things you could do).
Jacky
- Joe
On Nov 23, 2005, at 11:27, Jacky Gagnon wrote:
Hi Joe,
Can I transfert these informations to a new WOComponent and
associate this component to a new session?
Or I must use directAction?
You don't have to use a direct action. Obviously, the solution
to this problem is easier if you either keep the same session or
have the new user login, for the first time, using the new login
and password.
At first I wanted to keep the same session; but I must find a
way to destroy components associated with the transaction or
remove their association with the current session ; is there a
way to do this (the only way I found is terminate the session)?
If you have a solution for this I will keep the session.
I just want to avoid any security issue with these components.
Thanks!
Jacky
If you have some more specific questions, don't hesitate to ping
me.
- Joe
On Nov 23, 2005, at 09:04, Jacky Gagnon wrote:
Hi,
What's the best way for passing objects between sessions like
account informations after a transaction?
example:
1. A client open a session and subscribe to a service;
2. He choose his username and password and complete
the transaction;
3. The session is terminated and a receipt is diplayed
4. The user click on a link on the receipt and he's
redirected directly into his account into a new session (with
account information from the session terminated in 3);
Can I transfert these informations to a new WOComponent and
associate this component to a new session?
Or I must use directAction?
Thanks!
Jacky
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Coming in 2006 - an introduction to web applications using WebObjects
and Xcode http://www.global-village.net/wointro
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