Maintaining a Session ID from XSL document( ) function

View: New views
18 Messages — Rating Filter:   Alert me  

Maintaining a Session ID from XSL document( ) function

by Andrew Trese :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Team,

Here is the scenario I am having problem with:

1) a logged in user calls an XQL page
2) that page loads an XML document from the db and runs an XSL against it
3) a parameter is passed into the XSL that is a URL pointing to another XQL page.  this XQL page fetches an XML document and gives it back to the original XSL using <xsl:variable name="filter" value="document($filter_url)"/> (the document function).  the document contains some filtering information.

The problem is this: I can not find a way to maintain the session between the two calls:
1) logged in users calls XQL, has session A
2) when the XSL calls the document(http://..../filter.xql) page, it uses guest user, session B.  Ouch.

Can anyone help?  I have tried using session:encode-url to create a URL for the document function that would remember the session.  Any clue how to do this?

I was also looking at ways to pass an XML node-set into the XSL as a parameter, but that seems to be a dead end as well.

Thanks in advance,
Andrew

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: Maintaining a Session ID from XSL document( ) function

by Robert Koberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Sep 8, 2008, at 11:08 AM, Andrew Trese wrote:

> Team,
>
> Here is the scenario I am having problem with:
>
> 1) a logged in user calls an XQL page
> 2) that page loads an XML document from the db and runs an XSL  
> against it
> 3) a parameter is passed into the XSL that is a URL pointing to  
> another XQL page.  this XQL page fetches an XML document and gives  
> it back to the original XSL using <xsl:variable name="filter"  
> value="document($filter_url)"/> (the document function).  the  
> document contains some filtering information.
>
> The problem is this: I can not find a way to maintain the session  
> between the two calls:
> 1) logged in users calls XQL, has session A
> 2) when the XSL calls the document(http://..../filter.xql) page, it  
> uses guest user, session B.  Ouch.
>
>
> Can anyone help?  I have tried using session:encode-url to create a  
> URL for the document function that would remember the session.  Any  
> clue how to do this?

I'm guessing, but it sounds like you are using the same Transformer  
for each transformation. You should create a new Transformer from a  
cached Templates object for each new transform.

hth,
-Rob


>
>
> I was also looking at ways to pass an XML node-set into the XSL as a  
> parameter, but that seems to be a dead end as well.
>
> Thanks in advance,
> Andrew
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's  
> challenge
> Build the coolest Linux based applications with Moblin SDK & win  
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in  
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
> Exist-open mailing list
> Exist-open@...
> https://lists.sourceforge.net/lists/listinfo/exist-open


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: Maintaining a Session ID from XSL document( ) function

by Adam Retter-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Two options -

A) As you are doing - session:encode-url() what does that give you? I
should imagine a url with jsessionid encoded in it which should work,
otherwise I think there is a function in the session module to get the
session id you can then encode this in the URL yourself.

B) I also struggled sending a node to the xsl as a param and so just
used the concept of a wrapper and put both documents in the wrapper
and had the xsl extract and operate on the documents in the wrapper as
appropriate.

<wrapper>
<docA>...</docA>
<docB>...</docB>
</wrapper>

Then run your XSLT over that adjusting your templates as nessecary...

I have sucessfully used both (A) and (B) methods in the past...


2008/9/8 Andrew Trese <atrese@...>:

> Team,
>
> Here is the scenario I am having problem with:
>
> 1) a logged in user calls an XQL page
> 2) that page loads an XML document from the db and runs an XSL against it
> 3) a parameter is passed into the XSL that is a URL pointing to another XQL
> page.  this XQL page fetches an XML document and gives it back to the
> original XSL using <xsl:variable name="filter"
> value="document($filter_url)"/> (the document function).  the document
> contains some filtering information.
>
> The problem is this: I can not find a way to maintain the session between
> the two calls:
> 1) logged in users calls XQL, has session A
> 2) when the XSL calls the document(http://..../filter.xql) page, it uses
> guest user, session B.  Ouch.
>
> Can anyone help?  I have tried using session:encode-url to create a URL for
> the document function that would remember the session.  Any clue how to do
> this?
>
> I was also looking at ways to pass an XML node-set into the XSL as a
> parameter, but that seems to be a dead end as well.
>
> Thanks in advance,
> Andrew
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Exist-open mailing list
> Exist-open@...
> https://lists.sourceforge.net/lists/listinfo/exist-open
>
>



--
Adam Retter

eXist Developer
{ England }
adam@...
irc://irc.freenode.net/existdb

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: Maintaining a Session ID from XSL document( ) function

by Andrew Trese :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Adam,

In response to your two options below:

A) When I use session:encode-url( ) I get back the same URL that I put in, no changes.  I find this very strange.  I have reverted to hand-adding the jsessionid parameter, but would really like to figure out the session:encode-url( ) bit.  I noticed that the function returns an xs:anyURI and I treat it a bit like a string later when passing it through the XSL parameters.  Could this be an issue?

B) Got this working immediately.  Wrapping the two documents together into a single XML instance seems like a healthy solution.  My only concern is performance.  I haven't learned about how all this works yet, but you are taking an 2 XML documents from the database, using them to create a larger, in-memory XML document.  Then you run that dynamic XML document against an XSL.  I guess I am wondering if that should cause some performance concerns.  The total process is taking ~ 300 ms right now. 

Are performance best-practices discussed some place on the exist site?  Can't find info on it, but I'd love to read through a do's and don't list.

Thanks,
Andrew


On Mon, Sep 8, 2008 at 12:51 PM, Adam Retter <adam@...> wrote:
Two options -

A) As you are doing - session:encode-url() what does that give you? I
should imagine a url with jsessionid encoded in it which should work,
otherwise I think there is a function in the session module to get the
session id you can then encode this in the URL yourself.

B) I also struggled sending a node to the xsl as a param and so just
used the concept of a wrapper and put both documents in the wrapper
and had the xsl extract and operate on the documents in the wrapper as
appropriate.

<wrapper>
<docA>...</docA>
<docB>...</docB>
</wrapper>

Then run your XSLT over that adjusting your templates as nessecary...

I have sucessfully used both (A) and (B) methods in the past...


2008/9/8 Andrew Trese <atrese@...>:
> Team,
>
> Here is the scenario I am having problem with:
>
> 1) a logged in user calls an XQL page
> 2) that page loads an XML document from the db and runs an XSL against it
> 3) a parameter is passed into the XSL that is a URL pointing to another XQL
> page.  this XQL page fetches an XML document and gives it back to the
> original XSL using <xsl:variable name="filter"
> value="document($filter_url)"/> (the document function).  the document
> contains some filtering information.
>
> The problem is this: I can not find a way to maintain the session between
> the two calls:
> 1) logged in users calls XQL, has session A
> 2) when the XSL calls the document(http://..../filter.xql) page, it uses
> guest user, session B.  Ouch.
>
> Can anyone help?  I have tried using session:encode-url to create a URL for
> the document function that would remember the session.  Any clue how to do
> this?
>
> I was also looking at ways to pass an XML node-set into the XSL as a
> parameter, but that seems to be a dead end as well.
>
> Thanks in advance,
> Andrew
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Exist-open mailing list
> Exist-open@...
> https://lists.sourceforge.net/lists/listinfo/exist-open
>
>



--
Adam Retter

eXist Developer
{ England }
adam@...
irc://irc.freenode.net/existdb


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: Maintaining a Session ID from XSL document( ) function

by Robert Koberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I just checked out eXist to look at the source for the transform function. (holy crap, the svn trunk is huge!)

Could it be that FullXmldbURI.parseURI is not adding the query?


//Eventually rewrite wrappedURI *without* user info
if (userInfo != null) {
  StringBuffer recomputed = new StringBuffer();//XMLDB_URI_PREFIX);               
  recomputed.append(wrappedURI.getScheme());
  recomputed.append("://");
  recomputed.append(wrappedURI.getHost());
  if (wrappedURI.getPort() != -1)
    recomputed.append(":").append(wrappedURI.getPort());               
  recomputed.append(wrappedURI.getRawPath());
  wrappedURI = new URI(recomputed.toString());              
}

Observation: I don't think this has anything to do with the problem. But, when the Templates object is created the URIResolver is instantiated with the XSL document retrieved in the context of the first user that hits the transform. Like I said, I don't think this is the cause because path strings are just being concatenated for the resolve, but since the original problem had to do with sessions not able to change, I thought it was worth pointing out.

In general for the transform function, it might be nice to allow custom URIResolvers to be set. They should/could be set at the Templates level (for xsl:import/include) and at the Transformer level (for the document function). For example, this could allow a Transformer to set a resolver to resolve off a base path for a specific group or user, while still sharing an initial Templates object.

best,
-Rob

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

FullXmldbURI not producing full URIs, was Re: Maintaining a Session ID from XSL document( ) function

by Robert Koberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I wanted to change the subject as I think this might be getting overlooked. 

When looking at the problem that this thread originally described, the code took me to FullXmldbURI and its parseURI method. Given the name of the class, I was wondering if it is considered a bug that the method does not append the query string (and the fragment). So, if someone passes a URI to the document function (and probably other places), the query string (and fragment) are lost. Is this expected behavior?

best,
-Rob


On Sep 9, 2008, at 11:45 AM, Robert Koberg wrote:

Hi,

I just checked out eXist to look at the source for the transform function. (holy crap, the svn trunk is huge!)

Could it be that FullXmldbURI.parseURI is not adding the query?


//Eventually rewrite wrappedURI *without* user info
if (userInfo != null) {
  StringBuffer recomputed = new StringBuffer();//XMLDB_URI_PREFIX);               
  recomputed.append(wrappedURI.getScheme());
  recomputed.append("://");
  recomputed.append(wrappedURI.getHost());
  if (wrappedURI.getPort() != -1)
    recomputed.append(":").append(wrappedURI.getPort());               
  recomputed.append(wrappedURI.getRawPath());
  wrappedURI = new URI(recomputed.toString());              
}

Observation: I don't think this has anything to do with the problem. But, when the Templates object is created the URIResolver is instantiated with the XSL document retrieved in the context of the first user that hits the transform. Like I said, I don't think this is the cause because path strings are just being concatenated for the resolve, but since the original problem had to do with sessions not able to change, I thought it was worth pointing out.

In general for the transform function, it might be nice to allow custom URIResolvers to be set. They should/could be set at the Templates level (for xsl:import/include) and at the Transformer level (for the document function). For example, this could allow a Transformer to set a resolver to resolve off a base path for a specific group or user, while still sharing an initial Templates object.

best,
-Rob


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: Maintaining a Session ID from XSL document( ) function

by Adam Retter-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> A) When I use session:encode-url( ) I get back the same URL that I put in,
> no changes.  I find this very strange.  I have reverted to hand-adding the
> jsessionid parameter, but would really like to figure out the
> session:encode-url( ) bit.

In this case session:encode-url() is just a wrapper around Java's
HttpResponse.encodeURL(string). From the Javadoc for that function it
says this - "For example, if the browser supports cookies, or session
tracking is turned off, URL encoding is unnecessary."
So I assume that your browser supports cookies and so the JSESSIONID
is already being sent as a cookie and so you shouldnt need to encode
the URL. You can check this using something like Firefox and
livehttpheaders plugin or Firebug.
Although in your case you do need to encode the url and the the
problem boils down to context - the cookies are between the server
(eXist) and the client (your browser) which is fine when you call a
.xql directly, however when you pass a url to be used in the
transformation the client is then the transformation engine
(Xalan/Saxon) and it doesnt have the cookie, so it cant send it to the
server (eXist) - so no session.

The solution is to manually encode the URL yourself with the session
id, a simple xquery function like this will do the trick -

declare function local:encode-url($url as xs:string) as xs:string
(
   concat($url, ";JSESSIONID=", session:get-id())
);


> I noticed that the function returns an xs:anyURI
> and I treat it a bit like a string later when passing it through the XSL
> parameters.  Could this be an issue?
Nope. See explanation above.

> B) Got this working immediately.  Wrapping the two documents together into a
> single XML instance seems like a healthy solution.  My only concern is
> performance.  I haven't learned about how all this works yet, but you are
> taking an 2 XML documents from the database, using them to create a larger,
> in-memory XML document.  Then you run that dynamic XML document against an
> XSL.  I guess I am wondering if that should cause some performance
> concerns.  The total process is taking ~ 300 ms right now.

Obviously as you have realised there is some performance overhead here
and you may run into problems with temporary document fragments in the
/db/system/temp collection if you have a heavily loaded system and are
using an older version of eXist. However, your processing time of
300ms seems very acceptable to me and so I probably would worry about
it too much.

> Are performance best-practices discussed some place on the exist site?
> Can't find info on it, but I'd love to read through a do's and don't list.

Not really, there are a few bits on tuning XQueries which are
scattered on the site documentation and in the Wiki.

> Thanks,
> Andrew
>
>
> On Mon, Sep 8, 2008 at 12:51 PM, Adam Retter <adam@...> wrote:
>>
>> Two options -
>>
>> A) As you are doing - session:encode-url() what does that give you? I
>> should imagine a url with jsessionid encoded in it which should work,
>> otherwise I think there is a function in the session module to get the
>> session id you can then encode this in the URL yourself.
>>
>> B) I also struggled sending a node to the xsl as a param and so just
>> used the concept of a wrapper and put both documents in the wrapper
>> and had the xsl extract and operate on the documents in the wrapper as
>> appropriate.
>>
>> <wrapper>
>> <docA>...</docA>
>> <docB>...</docB>
>> </wrapper>
>>
>> Then run your XSLT over that adjusting your templates as nessecary...
>>
>> I have sucessfully used both (A) and (B) methods in the past...
>>
>>
>> 2008/9/8 Andrew Trese <atrese@...>:
>> > Team,
>> >
>> > Here is the scenario I am having problem with:
>> >
>> > 1) a logged in user calls an XQL page
>> > 2) that page loads an XML document from the db and runs an XSL against
>> > it
>> > 3) a parameter is passed into the XSL that is a URL pointing to another
>> > XQL
>> > page.  this XQL page fetches an XML document and gives it back to the
>> > original XSL using <xsl:variable name="filter"
>> > value="document($filter_url)"/> (the document function).  the document
>> > contains some filtering information.
>> >
>> > The problem is this: I can not find a way to maintain the session
>> > between
>> > the two calls:
>> > 1) logged in users calls XQL, has session A
>> > 2) when the XSL calls the document(http://..../filter.xql) page, it uses
>> > guest user, session B.  Ouch.
>> >
>> > Can anyone help?  I have tried using session:encode-url to create a URL
>> > for
>> > the document function that would remember the session.  Any clue how to
>> > do
>> > this?
>> >
>> > I was also looking at ways to pass an XML node-set into the XSL as a
>> > parameter, but that seems to be a dead end as well.
>> >
>> > Thanks in advance,
>> > Andrew
>> >
>> >
>> > -------------------------------------------------------------------------
>> > This SF.Net email is sponsored by the Moblin Your Move Developer's
>> > challenge
>> > Build the coolest Linux based applications with Moblin SDK & win great
>> > prizes
>> > Grand prize is a trip for two to an Open Source event anywhere in the
>> > world
>> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> > _______________________________________________
>> > Exist-open mailing list
>> > Exist-open@...
>> > https://lists.sourceforge.net/lists/listinfo/exist-open
>> >
>> >
>>
>>
>>
>> --
>> Adam Retter
>>
>> eXist Developer
>> { England }
>> adam@...
>> irc://irc.freenode.net/existdb
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Exist-open mailing list
> Exist-open@...
> https://lists.sourceforge.net/lists/listinfo/exist-open
>
>



--
Adam Retter

eXist Developer
{ England }
adam@...
irc://irc.freenode.net/existdb

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: FullXmldbURI not producing full URIs, was Re: Maintaining a Session ID from XSL document( ) function

by Adam Retter-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have posted a response to the other thread now.

Why would you pass a Querystring to the document function?


2008/9/10 Robert Koberg <rob@...>:

> Hi,
> I wanted to change the subject as I think this might be getting overlooked.
> When looking at the problem that this thread originally described, the code
> took me to FullXmldbURI and its parseURI method. Given the name of the
> class, I was wondering if it is considered a bug that the method does not
> append the query string (and the fragment). So, if someone passes a URI to
> the document function (and probably other places), the query string (and
> fragment) are lost. Is this expected behavior?
> best,
> -Rob
>
> On Sep 9, 2008, at 11:45 AM, Robert Koberg wrote:
>
> Hi,
> I just checked out eXist to look at the source for the transform function.
> (holy crap, the svn trunk is huge!)
> Could it be that FullXmldbURI.parseURI is not adding the query?
>
> //Eventually rewrite wrappedURI *without* user info
> if (userInfo != null) {
>   StringBuffer recomputed = new StringBuffer();//XMLDB_URI_PREFIX);
>
>   recomputed.append(wrappedURI.getScheme());
>   recomputed.append("://");
>   recomputed.append(wrappedURI.getHost());
>   if (wrappedURI.getPort() != -1)
>     recomputed.append(":").append(wrappedURI.getPort());
>   recomputed.append(wrappedURI.getRawPath());
>   wrappedURI = new URI(recomputed.toString());
> }
> Observation: I don't think this has anything to do with the problem. But,
> when the Templates object is created the URIResolver is instantiated with
> the XSL document retrieved in the context of the first user that hits the
> transform. Like I said, I don't think this is the cause because path strings
> are just being concatenated for the resolve, but since the original problem
> had to do with sessions not able to change, I thought it was worth pointing
> out.
> In general for the transform function, it might be nice to allow custom
> URIResolvers to be set. They should/could be set at the Templates level (for
> xsl:import/include) and at the Transformer level (for the document
> function). For example, this could allow a Transformer to set a resolver to
> resolve off a base path for a specific group or user, while still sharing
> an initial Templates object.
> best,
> -Rob
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Exist-open mailing list
> Exist-open@...
> https://lists.sourceforge.net/lists/listinfo/exist-open
>
>



--
Adam Retter

eXist Developer
{ England }
adam@...
irc://irc.freenode.net/existdb

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: FullXmldbURI not producing full URIs, was Re: Maintaining a Session ID from XSL document( ) function

by Robert Koberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Sep 10, 2008, at 9:33 AM, Adam Retter wrote:

> I have posted a response to the other thread now.
>
> Why would you pass a Querystring to the document function?

Well, as in the case of the OP, the document function is calling a  
dynamic page. You could also use it in a custom URIResolver to affect  
resolution. As another example, I have used it in XSL for a custom  
URIResolver that handles a query against a Lucene index to return  
search results.

Why would you limit the ability to do so?

best,
-Rob

>
>
>
> 2008/9/10 Robert Koberg <rob@...>:
>> Hi,
>> I wanted to change the subject as I think this might be getting  
>> overlooked.
>> When looking at the problem that this thread originally described,  
>> the code
>> took me to FullXmldbURI and its parseURI method. Given the name of  
>> the
>> class, I was wondering if it is considered a bug that the method  
>> does not
>> append the query string (and the fragment). So, if someone passes a  
>> URI to
>> the document function (and probably other places), the query string  
>> (and
>> fragment) are lost. Is this expected behavior?
>> best,
>> -Rob
>>
>> On Sep 9, 2008, at 11:45 AM, Robert Koberg wrote:
>>
>> Hi,
>> I just checked out eXist to look at the source for the transform  
>> function.
>> (holy crap, the svn trunk is huge!)
>> Could it be that FullXmldbURI.parseURI is not adding the query?
>>
>> //Eventually rewrite wrappedURI *without* user info
>> if (userInfo != null) {
>>  StringBuffer recomputed = new StringBuffer();//XMLDB_URI_PREFIX);
>>
>>  recomputed.append(wrappedURI.getScheme());
>>  recomputed.append("://");
>>  recomputed.append(wrappedURI.getHost());
>>  if (wrappedURI.getPort() != -1)
>>    recomputed.append(":").append(wrappedURI.getPort());
>>  recomputed.append(wrappedURI.getRawPath());
>>  wrappedURI = new URI(recomputed.toString());
>> }
>> Observation: I don't think this has anything to do with the  
>> problem. But,
>> when the Templates object is created the URIResolver is  
>> instantiated with
>> the XSL document retrieved in the context of the first user that  
>> hits the
>> transform. Like I said, I don't think this is the cause because  
>> path strings
>> are just being concatenated for the resolve, but since the original  
>> problem
>> had to do with sessions not able to change, I thought it was worth  
>> pointing
>> out.
>> In general for the transform function, it might be nice to allow  
>> custom
>> URIResolvers to be set. They should/could be set at the Templates  
>> level (for
>> xsl:import/include) and at the Transformer level (for the document
>> function). For example, this could allow a Transformer to set a  
>> resolver to
>> resolve off a base path for a specific group or user, while still  
>> sharing
>> an initial Templates object.
>> best,
>> -Rob
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's  
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win  
>> great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in  
>> the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Exist-open mailing list
>> Exist-open@...
>> https://lists.sourceforge.net/lists/listinfo/exist-open
>>
>>
>
>
>
> --
> Adam Retter
>
> eXist Developer
> { England }
> adam@...
> irc://irc.freenode.net/existdb


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: FullXmldbURI not producing full URIs, was Re: Maintaining a Session ID from XSL document( ) function

by Adam Retter-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think the document function that he was referring to was in the
XSLT, that will then be handled by the XSLT processor code (eiether
Xalan or Saxon depending on your config) we have no control over that,
apart from registering a custom URI resolved that could be used by
Xalan or Saxon. Are you suggesting that we should do that and that the
URI resolver should handle Querystings?

2008/9/10 Robert Koberg <rob@...>:

>
> On Sep 10, 2008, at 9:33 AM, Adam Retter wrote:
>
>> I have posted a response to the other thread now.
>>
>> Why would you pass a Querystring to the document function?
>
> Well, as in the case of the OP, the document function is calling a dynamic
> page. You could also use it in a custom URIResolver to affect resolution. As
> another example, I have used it in XSL for a custom URIResolver that handles
> a query against a Lucene index to return search results.
>
> Why would you limit the ability to do so?
>
> best,
> -Rob
>
>>
>>
>>
>> 2008/9/10 Robert Koberg <rob@...>:
>>>
>>> Hi,
>>> I wanted to change the subject as I think this might be getting
>>> overlooked.
>>> When looking at the problem that this thread originally described, the
>>> code
>>> took me to FullXmldbURI and its parseURI method. Given the name of the
>>> class, I was wondering if it is considered a bug that the method does not
>>> append the query string (and the fragment). So, if someone passes a URI
>>> to
>>> the document function (and probably other places), the query string (and
>>> fragment) are lost. Is this expected behavior?
>>> best,
>>> -Rob
>>>
>>> On Sep 9, 2008, at 11:45 AM, Robert Koberg wrote:
>>>
>>> Hi,
>>> I just checked out eXist to look at the source for the transform
>>> function.
>>> (holy crap, the svn trunk is huge!)
>>> Could it be that FullXmldbURI.parseURI is not adding the query?
>>>
>>> //Eventually rewrite wrappedURI *without* user info
>>> if (userInfo != null) {
>>>  StringBuffer recomputed = new StringBuffer();//XMLDB_URI_PREFIX);
>>>
>>>  recomputed.append(wrappedURI.getScheme());
>>>  recomputed.append("://");
>>>  recomputed.append(wrappedURI.getHost());
>>>  if (wrappedURI.getPort() != -1)
>>>   recomputed.append(":").append(wrappedURI.getPort());
>>>  recomputed.append(wrappedURI.getRawPath());
>>>  wrappedURI = new URI(recomputed.toString());
>>> }
>>> Observation: I don't think this has anything to do with the problem. But,
>>> when the Templates object is created the URIResolver is instantiated with
>>> the XSL document retrieved in the context of the first user that hits the
>>> transform. Like I said, I don't think this is the cause because path
>>> strings
>>> are just being concatenated for the resolve, but since the original
>>> problem
>>> had to do with sessions not able to change, I thought it was worth
>>> pointing
>>> out.
>>> In general for the transform function, it might be nice to allow custom
>>> URIResolvers to be set. They should/could be set at the Templates level
>>> (for
>>> xsl:import/include) and at the Transformer level (for the document
>>> function). For example, this could allow a Transformer to set a resolver
>>> to
>>> resolve off a base path for a specific group or user, while still sharing
>>> an initial Templates object.
>>> best,
>>> -Rob
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win great
>>> prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in the
>>> world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> _______________________________________________
>>> Exist-open mailing list
>>> Exist-open@...
>>> https://lists.sourceforge.net/lists/listinfo/exist-open
>>>
>>>
>>
>>
>>
>> --
>> Adam Retter
>>
>> eXist Developer
>> { England }
>> adam@...
>> irc://irc.freenode.net/existdb
>
>



--
Adam Retter

eXist Developer
{ England }
adam@...
irc://irc.freenode.net/existdb

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: FullXmldbURI not producing full URIs, was Re: Maintaining a Session ID from XSL document( ) function

by Robert Koberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Sep 10, 2008, at 9:45 AM, Adam Retter wrote:

> I think the document function that he was referring to was in the
> XSLT, that will then be handled by the XSLT processor code (eiether
> Xalan or Saxon depending on your config) we have no control over that,
> apart from registering a custom URI resolved that could be used by
> Xalan or Saxon. Are you suggesting that we should do that and that the
> URI resolver should handle Querystings?

If he (or anybody) uses the transform function in exist, the  
URIResolver is set in that function. It is either set to use one of  
the 2 internal classes in that function class (ExternalResolver,  
DatabaseResolver) (both set on the templates object only).

By handling the querystring, it should just pass the href argument  
('the full uri') given to the document function. The class named  
FullXmldbURI only appends the path. It does not include the fragment  
and the query string. It should, IMO.

best,
-Rob

>
>
> 2008/9/10 Robert Koberg <rob@...>:
>>
>> On Sep 10, 2008, at 9:33 AM, Adam Retter wrote:
>>
>>> I have posted a response to the other thread now.
>>>
>>> Why would you pass a Querystring to the document function?
>>
>> Well, as in the case of the OP, the document function is calling a  
>> dynamic
>> page. You could also use it in a custom URIResolver to affect  
>> resolution. As
>> another example, I have used it in XSL for a custom URIResolver  
>> that handles
>> a query against a Lucene index to return search results.
>>
>> Why would you limit the ability to do so?
>>
>> best,
>> -Rob
>>
>>>
>>>
>>>
>>> 2008/9/10 Robert Koberg <rob@...>:
>>>>
>>>> Hi,
>>>> I wanted to change the subject as I think this might be getting
>>>> overlooked.
>>>> When looking at the problem that this thread originally  
>>>> described, the
>>>> code
>>>> took me to FullXmldbURI and its parseURI method. Given the name  
>>>> of the
>>>> class, I was wondering if it is considered a bug that the method  
>>>> does not
>>>> append the query string (and the fragment). So, if someone passes  
>>>> a URI
>>>> to
>>>> the document function (and probably other places), the query  
>>>> string (and
>>>> fragment) are lost. Is this expected behavior?
>>>> best,
>>>> -Rob
>>>>
>>>> On Sep 9, 2008, at 11:45 AM, Robert Koberg wrote:
>>>>
>>>> Hi,
>>>> I just checked out eXist to look at the source for the transform
>>>> function.
>>>> (holy crap, the svn trunk is huge!)
>>>> Could it be that FullXmldbURI.parseURI is not adding the query?
>>>>
>>>> //Eventually rewrite wrappedURI *without* user info
>>>> if (userInfo != null) {
>>>> StringBuffer recomputed = new StringBuffer();//XMLDB_URI_PREFIX);
>>>>
>>>> recomputed.append(wrappedURI.getScheme());
>>>> recomputed.append("://");
>>>> recomputed.append(wrappedURI.getHost());
>>>> if (wrappedURI.getPort() != -1)
>>>>  recomputed.append(":").append(wrappedURI.getPort());
>>>> recomputed.append(wrappedURI.getRawPath());
>>>> wrappedURI = new URI(recomputed.toString());
>>>> }
>>>> Observation: I don't think this has anything to do with the  
>>>> problem. But,
>>>> when the Templates object is created the URIResolver is  
>>>> instantiated with
>>>> the XSL document retrieved in the context of the first user that  
>>>> hits the
>>>> transform. Like I said, I don't think this is the cause because  
>>>> path
>>>> strings
>>>> are just being concatenated for the resolve, but since the original
>>>> problem
>>>> had to do with sessions not able to change, I thought it was worth
>>>> pointing
>>>> out.
>>>> In general for the transform function, it might be nice to allow  
>>>> custom
>>>> URIResolvers to be set. They should/could be set at the Templates  
>>>> level
>>>> (for
>>>> xsl:import/include) and at the Transformer level (for the document
>>>> function). For example, this could allow a Transformer to set a  
>>>> resolver
>>>> to
>>>> resolve off a base path for a specific group or user, while still  
>>>> sharing
>>>> an initial Templates object.
>>>> best,
>>>> -Rob
>>>>
>>>> -------------------------------------------------------------------------
>>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>>> challenge
>>>> Build the coolest Linux based applications with Moblin SDK & win  
>>>> great
>>>> prizes
>>>> Grand prize is a trip for two to an Open Source event anywhere in  
>>>> the
>>>> world
>>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>>> _______________________________________________
>>>> Exist-open mailing list
>>>> Exist-open@...
>>>> https://lists.sourceforge.net/lists/listinfo/exist-open
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Adam Retter
>>>
>>> eXist Developer
>>> { England }
>>> adam@...
>>> irc://irc.freenode.net/existdb
>>
>>
>
>
>
> --
> Adam Retter
>
> eXist Developer
> { England }
> adam@...
> irc://irc.freenode.net/existdb


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: FullXmldbURI not producing full URIs, was Re: Maintaining a Session ID from XSL document( ) function

by Adam Retter-3 :: Rate this Message: