on 04-19-2006 2:54 PM
Hello,
I am developing a WebDynpro application (several actually) that has to reuse attributes set in the HTTP session by another Portal application (HTMLB). Both applications are integrated in the same EP with iViews.
I can get the HTTP session using the WDWebContextAdapter class, but my attributes are not there. Seems there is only one attribute named "sap.webdynpro.clientsession".
Do you have an idea on what I am missing ?
Thanks a lot for your help.
Regards,
Nicolas
Have you considered using portal eventing between the iViews instead. Portal eventing is the approved way you can pass data between iViews. What happens if in the future your web dynpro application runs in the Smart Client in the iView instead of as an HTML page? Even if you could get access to the HTTP session to work - would it continue to work in this situation?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nicolas,
Try the following (I've suggested this several times, but no one reply with a follow-up, so I'm not sure whether or not it works):
In both applications get currently logged-in user. Then use transient attributes to share data: IUser.setTransientAttribute / IUser.getTransientAttribute.
VS
Valery,
Tried this yesterday too, but doesn't seem to work...
Here is my code :
1/ Set the attribute in the Portal app
IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
IUserContext user = request.getUser();
user.setTransientAttribute("my_ns", "test", "value_test");
log.errorT("--> transient attribute set for user " + user.getName());
2/ Read the attribute in the WDP app
IUser user = null;
try {
user = WDClientUser.getCurrentUser().getSAPUser();
} catch (WDUMException e) {
e.printStackTrace();
}
String val = (String) user.getTransientAttribute("my_ns", "test");
msgmgr.reportSuccess("getTransientAttribute = [" + val + "] for user " + user.getName());
But I always read a null value.
My 2 applications are integrated in the same portal with iViews.
Nicolas
Nicolas,
according to your words:
<i>The problem is that the user navigates between the applications with the menu of the portal. </i>
So, if I understand correctly, passing data via URL parameters is not an option either (you cannot alter URL in question dynamically).
The only thing left is non-public API in WebDynpro for accessing underlying HttpRequest / HttpSession, but we will not discuss it due to reasons described here: /people/bertram.ganz/blog/2005/02/02/never-ever-hijack-internal-web-dynpro-classes-and-interfaces
VS
Valery,
Thanks a lot for your help.
So the only option left is to use non public APIs, and isolate them in one single place so that they can easily be updated if needed. I don't have the choice now.
Do you have samples of code ? Here is my email address : nicolas.boussuge AT gmail DOT com, if you don't want to discuss it there.
Regards,
Nicolas
Valery,
I tried using the set and get for the TransientAttribute
and it worked within the same WebDynpro Application.
I then tried to retrieve it from a second Webdynpro Application on another portal page and the attribute
was null.
Is there a final step that needs to happen to commit the
attribute to the User?
JC
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.