You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Laurie Harper <zo...@holoweb.net> on 2002/11/01 06:05:55 UTC

URL construction

I there somewhere that fully documents how URLs are interpreted by Turbine,
and how to construct URLs in templates? Currently I'm using

  $link.setPath('Page.vm').setAction('Action')

That has the disadvantage that if I rename the template all the links break
:-( Is there a way to get the page set to the current screen? I was hoping
for something like

  $link.setAction('...')

But that doesn't seem to be supported...

Secondly, can I use URLs with additional path info? For example I'd like to
have URLs like

  http://.../x/servlet/x/.../SomeScreen.vm/path/to/dir

And retrieve the string '/path/to/dir' in my screens and actions. I looked
at doing

 $link.setPage('...').setAction('...').addPathInfo('/path/to/dir')

But all the addPathInfo() methods take a name/value pair which seems
wrong...

Thanks,

L.  


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: URL construction

Posted by Laurie Harper <zo...@holoweb.net>.
On 11/4/02 11:33 AM, "Laurie Harper" <zo...@holoweb.net> wrote:
> I tried copying velocity.properties from the Velocity distribution into my
> classes directory and got exceptions on startup, so I figured I'd look into
> improving the integration at some point. I just haven't had time to look at
> that yet.

So I took a look at this and discovered the code was doing exactly what I
planned to add: passing all the velocity service configuration into
Velocity. The 'ugly' code is just translating paths into correct absolute
values; at the end of that, everything gets passed through.

So I took another look at things and found that the reason the properties I
added didn't work was because I used the wrong names. I was using the names
Velocity logs, which turn out not to be correct. Using the right property
names seems to do the trick, mostly.

Global macro library re-loading still isn't working, but that seems to be a
Velocity issue so I'll take it to the velocity list :-)

Thanks for the help,

L.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: URL construction

Posted by Laurie Harper <zo...@holoweb.net>.
On 11/3/02 7:05 PM, "Chris K Chew" <ch...@fenetics.com> wrote:

> Yeah, simply extend TemplateLink and change the TR.props $link tool value to
> your new class.  Look at the xreference code online to see how the setPage
> and setAction methods work.  You will need to copy the "return this;" style.

Ah, OK, it can be overridden in config :)
 
> I am not sure about the path parameters switch, and don't have the
> capability to look into it until tomorrow.  I would think you can override
> the parameterparser implementation in the TR.props:
> 
> services.RunDataService.default.parameter.parser=path.to.your.new.parser
> 
> I would keep recommend keeping the path-like parameters, though, and protect
> the path-to-dir using encoding.

Like I say, it's working OK using a query parameter, I'd just rather have
URLs that are a bit more intuitive :)

> Whatever happened with the Velocity Properties?

I tried copying velocity.properties from the Velocity distribution into my
classes directory and got exceptions on startup, so I figured I'd look into
improving the integration at some point. I just haven't had time to look at
that yet.

L.

> 
> Ck
> 
> -----Original Message-----
> From: Laurie Harper [mailto:zodiac@holoweb.net]
> Sent: Sunday, November 03, 2002 4:06 PM
> To: Turbine Users List
> Subject: Re: URL construction
> 
> 
> On 11/3/02 5:21 PM, "Chris K Chew" <ch...@fenetics.com> wrote:
> 
>> One suggestion is to extend TemplateLink with convenience methods for
>> navigating your application.
>> 
>> $link.linkOrderDetail($orderId)
>> ...instead of...
>> $link.setPage("order,OrderDetail.vm").addPathInfo("id",$orderId)
> 
> How would I get Turbine to use the extended implementation? Just replace the
> $link reference in my screen classes?
> 
>> To get the current page, you can look into using the
>> RunData.getXXXTemplate() methods.
> 
> Ah, that does the trick. :-)
> 
>> About the path-to-dir, can you use commas instead of slashes, and
>> tokenize/replace them in the java code?  Or maybe encode the paths it
> using
>> something like base64?  But it seems kind of odd and insecure to pass path
>> info in the URL, maybe you can have a PathTool or something of the sort
> and
>> pass an Id instead?
> 
> Security isn't an issue, I'm exposing an interface to a WebDAV service and
> want the URLs to reflect the WebDAV path. Currently I'm passing paths as
> query parameters, but I'd rather use path info if it's possible. It looks
> like Turbine turns any extra path info into name/value pairs though. I was
> hoping there might be a way to turn that off? Maybe there's a special
> keyword that tells Turbine 'don't parse the URL past this point' or
> something?
> 
> L.
> 
>> 
>> Chris
>> 
>> 
>> -----Original Message-----
>> From: Laurie Harper [mailto:zodiac@holoweb.net]
>> Sent: Thursday, October 31, 2002 10:06 PM
>> To: Turbine Users List
>> Subject: URL construction
>> 
>> 
>> I there somewhere that fully documents how URLs are interpreted by
> Turbine,
>> and how to construct URLs in templates? Currently I'm using
>> 
>> $link.setPath('Page.vm').setAction('Action')
>> 
>> That has the disadvantage that if I rename the template all the links
> break
>> :-( Is there a way to get the page set to the current screen? I was hoping
>> for something like
>> 
>> $link.setAction('...')
>> 
>> But that doesn't seem to be supported...
>> 
>> Secondly, can I use URLs with additional path info? For example I'd like
> to
>> have URLs like
>> 
>> http://.../x/servlet/x/.../SomeScreen.vm/path/to/dir
>> 
>> And retrieve the string '/path/to/dir' in my screens and actions. I looked
>> at doing
>> 
>> $link.setPage('...').setAction('...').addPathInfo('/path/to/dir')
>> 
>> But all the addPathInfo() methods take a name/value pair which seems
>> wrong...
>> 
>> Thanks,
>> 
>> L.
>> 
>> 
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>> 
>> 
>> --
>> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>> 
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: URL construction

Posted by Chris K Chew <ch...@fenetics.com>.
Yeah, simply extend TemplateLink and change the TR.props $link tool value to
your new class.  Look at the xreference code online to see how the setPage
and setAction methods work.  You will need to copy the "return this;" style.

I am not sure about the path parameters switch, and don't have the
capability to look into it until tomorrow.  I would think you can override
the parameterparser implementation in the TR.props:

services.RunDataService.default.parameter.parser=path.to.your.new.parser

I would keep recommend keeping the path-like parameters, though, and protect
the path-to-dir using encoding.

Whatever happened with the Velocity Properties?

Ck

-----Original Message-----
From: Laurie Harper [mailto:zodiac@holoweb.net]
Sent: Sunday, November 03, 2002 4:06 PM
To: Turbine Users List
Subject: Re: URL construction


On 11/3/02 5:21 PM, "Chris K Chew" <ch...@fenetics.com> wrote:

> One suggestion is to extend TemplateLink with convenience methods for
> navigating your application.
>
> $link.linkOrderDetail($orderId)
> ...instead of...
> $link.setPage("order,OrderDetail.vm").addPathInfo("id",$orderId)

How would I get Turbine to use the extended implementation? Just replace the
$link reference in my screen classes?

> To get the current page, you can look into using the
> RunData.getXXXTemplate() methods.

Ah, that does the trick. :-)

> About the path-to-dir, can you use commas instead of slashes, and
> tokenize/replace them in the java code?  Or maybe encode the paths it
using
> something like base64?  But it seems kind of odd and insecure to pass path
> info in the URL, maybe you can have a PathTool or something of the sort
and
> pass an Id instead?

Security isn't an issue, I'm exposing an interface to a WebDAV service and
want the URLs to reflect the WebDAV path. Currently I'm passing paths as
query parameters, but I'd rather use path info if it's possible. It looks
like Turbine turns any extra path info into name/value pairs though. I was
hoping there might be a way to turn that off? Maybe there's a special
keyword that tells Turbine 'don't parse the URL past this point' or
something?

L.

>
> Chris
>
>
> -----Original Message-----
> From: Laurie Harper [mailto:zodiac@holoweb.net]
> Sent: Thursday, October 31, 2002 10:06 PM
> To: Turbine Users List
> Subject: URL construction
>
>
> I there somewhere that fully documents how URLs are interpreted by
Turbine,
> and how to construct URLs in templates? Currently I'm using
>
> $link.setPath('Page.vm').setAction('Action')
>
> That has the disadvantage that if I rename the template all the links
break
> :-( Is there a way to get the page set to the current screen? I was hoping
> for something like
>
> $link.setAction('...')
>
> But that doesn't seem to be supported...
>
> Secondly, can I use URLs with additional path info? For example I'd like
to
> have URLs like
>
> http://.../x/servlet/x/.../SomeScreen.vm/path/to/dir
>
> And retrieve the string '/path/to/dir' in my screens and actions. I looked
> at doing
>
> $link.setPage('...').setAction('...').addPathInfo('/path/to/dir')
>
> But all the addPathInfo() methods take a name/value pair which seems
> wrong...
>
> Thanks,
>
> L.
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: URL construction

Posted by Laurie Harper <zo...@holoweb.net>.
On 11/3/02 5:21 PM, "Chris K Chew" <ch...@fenetics.com> wrote:

> One suggestion is to extend TemplateLink with convenience methods for
> navigating your application.
> 
> $link.linkOrderDetail($orderId)
> ...instead of...
> $link.setPage("order,OrderDetail.vm").addPathInfo("id",$orderId)

How would I get Turbine to use the extended implementation? Just replace the
$link reference in my screen classes?
 
> To get the current page, you can look into using the
> RunData.getXXXTemplate() methods.

Ah, that does the trick. :-)
 
> About the path-to-dir, can you use commas instead of slashes, and
> tokenize/replace them in the java code?  Or maybe encode the paths it using
> something like base64?  But it seems kind of odd and insecure to pass path
> info in the URL, maybe you can have a PathTool or something of the sort and
> pass an Id instead?

Security isn't an issue, I'm exposing an interface to a WebDAV service and
want the URLs to reflect the WebDAV path. Currently I'm passing paths as
query parameters, but I'd rather use path info if it's possible. It looks
like Turbine turns any extra path info into name/value pairs though. I was
hoping there might be a way to turn that off? Maybe there's a special
keyword that tells Turbine 'don't parse the URL past this point' or
something?

L.

> 
> Chris
> 
> 
> -----Original Message-----
> From: Laurie Harper [mailto:zodiac@holoweb.net]
> Sent: Thursday, October 31, 2002 10:06 PM
> To: Turbine Users List
> Subject: URL construction
> 
> 
> I there somewhere that fully documents how URLs are interpreted by Turbine,
> and how to construct URLs in templates? Currently I'm using
> 
> $link.setPath('Page.vm').setAction('Action')
> 
> That has the disadvantage that if I rename the template all the links break
> :-( Is there a way to get the page set to the current screen? I was hoping
> for something like
> 
> $link.setAction('...')
> 
> But that doesn't seem to be supported...
> 
> Secondly, can I use URLs with additional path info? For example I'd like to
> have URLs like
> 
> http://.../x/servlet/x/.../SomeScreen.vm/path/to/dir
> 
> And retrieve the string '/path/to/dir' in my screens and actions. I looked
> at doing
> 
> $link.setPage('...').setAction('...').addPathInfo('/path/to/dir')
> 
> But all the addPathInfo() methods take a name/value pair which seems
> wrong...
> 
> Thanks,
> 
> L.
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: URL construction

Posted by Chris K Chew <ch...@fenetics.com>.
One suggestion is to extend TemplateLink with convenience methods for
navigating your application.

$link.linkOrderDetail($orderId)
...instead of...
$link.setPage("order,OrderDetail.vm").addPathInfo("id",$orderId)

To get the current page, you can look into using the
RunData.getXXXTemplate() methods.

About the path-to-dir, can you use commas instead of slashes, and
tokenize/replace them in the java code?  Or maybe encode the paths it using
something like base64?  But it seems kind of odd and insecure to pass path
info in the URL, maybe you can have a PathTool or something of the sort and
pass an Id instead?

Chris


-----Original Message-----
From: Laurie Harper [mailto:zodiac@holoweb.net]
Sent: Thursday, October 31, 2002 10:06 PM
To: Turbine Users List
Subject: URL construction


I there somewhere that fully documents how URLs are interpreted by Turbine,
and how to construct URLs in templates? Currently I'm using

  $link.setPath('Page.vm').setAction('Action')

That has the disadvantage that if I rename the template all the links break
:-( Is there a way to get the page set to the current screen? I was hoping
for something like

  $link.setAction('...')

But that doesn't seem to be supported...

Secondly, can I use URLs with additional path info? For example I'd like to
have URLs like

  http://.../x/servlet/x/.../SomeScreen.vm/path/to/dir

And retrieve the string '/path/to/dir' in my screens and actions. I looked
at doing

 $link.setPage('...').setAction('...').addPathInfo('/path/to/dir')

But all the addPathInfo() methods take a name/value pair which seems
wrong...

Thanks,

L.


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>