Ok. I assumed session ids could be re-used because the SessionClient 
constructor allows you to pass one in. That explains why my approach isn't 
working.

I have tried adding a new servlet to the existing BASE web.xml file but I got a 
strange error that seemed to imply that BASE defines its own ClassLoader. Have 
you ever seen a problem like this? I'm not clear on the best way to invoke code 
that uses the native API. Using the webservices API is easy because you just 
need the relevant jars.

Disregarding that, do you have any ideas about how to link directly to an 
Experiment without getting the 'permission denied' error caused by the wrong 
project being selected? I'm assuming it would actually be possible to write a 
servlet that automatically authenticates the user, sets the active project, 
then redirects to the experiment? I'm not sure of the best approach...

Mark.

-----Original Message-----
From: basedb-devel-boun...@lists.sourceforge.net 
[mailto:basedb-devel-boun...@lists.sourceforge.net] On Behalf Of Nicklas 
Nordborg
Sent: 07 January 2010 16:37
To: BASE dev
Subject: Re: [basedb-devel] Setting active project via API

Woodbridge, Mark R wrote:
> Thanks Nicklas.
> 
> I know this issue has come up on the mailing list a couple of times,
> but I'm not sure what the solution is. As I said, I'm linking
> directly to Experiments in BASE from my Flex application. I'm doing
> this by doing an HTTP POST to /login.jsp with a redirect to
> views/experiments/index.jsp?cmd=ViewItem&item_id=...&ID=...
> 
> This works fine but there are a couple of problems. The first is that
> I call /login.jsp every time I link to an experiment. I'm using the
> same ID every time to avoid creating a new session. Is this the
> correct thing to do?

No you can't reuse the same ID. It has to be unique for per user 
session. Strange things will happen if there are multiple sessions using 
the same ID.

> The second problem is this issue with the active project. What is the
> correct way to ensure that the link works i.e. avoiding linking to an
> Experiment that isn't shared with the 'active' project? I have tried
> the following:
> 
> 1. Generate a session ID 2. Use the webservices API to set the active
> project for this sessionID 3. Post to /login.jsp using this sessionID
> 
> 
> But this doesn't seem to work. Is there a way to link directly to an
> Experiment, ignoring whatever Project is currently active? Any help
> would be gratefully received.

No this will not work. From the BASE point of view your web service 
application is the client. The session ID it uses to set the active 
project can't be transfered to another client (eg. a web browser).

You'll need to add code to the BASE web server application. Eg. add your 
own servlets, JSP:s, web services, etc. that does the hard work for you 
using the BASE core API directly. I don't think it can be done by using 
the current web service API or by calling the JSP scripts.

/Nicklas

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel

Reply via email to