Skip to main content



      Home
Home » Modeling » EMF » Session ID from ResourceSet.getResource(URI)
Session ID from ResourceSet.getResource(URI) [message #376723] Wed, 29 January 2003 12:10 Go to next message
Eclipse UserFriend
I was wondering if anyone could tell me if it is possible to retrieve a
session ID after downloading an EMF generated XMI file from a web server.

My code looks like this:

ResourceSet set = new ResourceSetImpl();
URI uri = URI.createURI(http://www.myserver.com/MyXMIFile.suffix);
Resource res = set.getResource(uri, true);
MyModelElement el = (MyModelElement) resource.getContents().get(0);

This code retrieves the xmi file for me even if the file is stored on a
remote server. The problem is that the xmi file might be protected and the
user will be asked to log-in first. So far so good, but now the client side
needs to know the session id (jsessionid) that was created on the server
(for future requests). How can I retrieve this ID? Is it stored with the
Resource or the ResourceSet object. I can usually retrieve it from an
HttpURLConnection (which is probably used internally by EMF). Can I access
this object anywhere?

Any help appreciated,

--Dirk
Re: Session ID from ResourceSet.getResource(URI) [message #376726 is a reply to message #376723] Wed, 29 January 2003 13:05 Go to previous message
Eclipse UserFriend
Dirk,

All of the interaction with streams is funneled through the URIConverter. For
the case of a URI with http protocol, this method in URIConverterImpl is
eventually called to open a stream:

protected InputStream createURLInputStream(URI uri) throws IOException
{
URL url = new URL(uri.toString());
URLConnection urlConnection = url.openConnection();
return urlConnection.getInputStream();
}

It sounds like you may need a special resource set with a special URI converter
that takes your session ID into account.


Dirk Lemmermann wrote:

> I was wondering if anyone could tell me if it is possible to retrieve a
> session ID after downloading an EMF generated XMI file from a web server.
>
> My code looks like this:
>
> ResourceSet set = new ResourceSetImpl();
> URI uri = URI.createURI(http://www.myserver.com/MyXMIFile.suffix);
> Resource res = set.getResource(uri, true);
> MyModelElement el = (MyModelElement) resource.getContents().get(0);
>
> This code retrieves the xmi file for me even if the file is stored on a
> remote server. The problem is that the xmi file might be protected and the
> user will be asked to log-in first. So far so good, but now the client side
> needs to know the session id (jsessionid) that was created on the server
> (for future requests). How can I retrieve this ID? Is it stored with the
> Resource or the ResourceSet object. I can usually retrieve it from an
> HttpURLConnection (which is probably used internally by EMF). Can I access
> this object anywhere?
>
> Any help appreciated,
>
> --Dirk
Previous Topic:Creating adapters when starting the workspace
Next Topic:How to: dynamically loading xmi files from a web server?
Goto Forum:
  


Current Time: Wed Nov 05 11:33:13 EST 2025

Powered by FUDForum. Page generated in 0.05395 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top