You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Jack Axaopoulos <ja...@cisco.com> on 2002/01/10 23:49:06 UTC

URL question

I'm using Turbine 2.1 with velocity and have a question
concerning valid URLs.

After reviewing some of the turbine/velocity code, and doing some tests,
the following URL works:

../servlet/turbine?template=/bank/checking,AccountView.vm

My directory structure looks like:
/templates
/templates/bank
/templates/bank/checking
/templates/bank/checking/AccountView.vm


However, the velocity-site-howto.html seems to imply that the following
URL should also work:

../servlet/turbine/template/bank/checking/AccountView.vm

Is this actually the case??  This does NOT work for me, and if it should
then I know I need to keep digging.

The code in the DefaultParameterParser class picks the URL apart using
this snippet.  It attempts to make PathInfo look like a query string.
But it doesnt look right to me.

-----------------------------------------------------
    // Also cache any pathinfo variables that are passed around as
         // if they are query string data.
         try
         {
             StringTokenizer st = new StringTokenizer(req.getPathInfo(), "/");
             boolean name = true;
             String pathPart = null;
             while(st.hasMoreTokens())
             {
                 if ( name == true )
                 {
                     tmp = JServUtils.URLDecode(st.nextToken());
                     name = false;
                 }
                 else
                 {
                     pathPart = JServUtils.URLDecode(st.nextToken());
                     if ( tmp.length() != 0 )
                     {
                         add (convert(tmp), pathPart);
                     }
                     name = true;
                 }
             }
-----------------------------------------------------

I don't see how tokenizing using "/" will get you the correct answer.
You will end up with template=bank, which is incorrect.

What am I missing here????

Thanks...

J


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


Re: URL question

Posted by Rodney Schneider <rl...@arcalink.com>.
Hi!

> > The following works, but is there a better way?
> > ..servlet/turbine/template/bank,checking,AccountView.vm?action=bank.checking.EnterRecord
>
> I'm new to Turbine (haven't actually used it yet), but after silently
> hanging out on this mailing list, I think you want pass all your
> parameters as key/value pairs separated with a '/' character, so the
> preferred way for the above url would be:
>
> ..servlet/turbine/template/bank,checking,AccountView.vm/action/bank.checking.EnterRecord

Both of the above URLs work because Turbine treats extra path information
like servlet request parameters.  In the above example, there are two Turbine
request parameters, "template" and "action":

template = bank,checking,AccountView.vm
action = bank.checking.EnterRecord

... so the following URL should also work:

.servlet/turbine?template=bank,checking,AccountView.vm&action=bank.checking.EnterRecord

The above methods use the GET HTTP method, but if you were accessing Turbine
from a form using the POST HTTP method, you could also use hidden form fields:

<INPUT TYPE=hidden NAME="template" VALUE="bank,checking,AccountView.vm">
<INPUT TYPE=hidden NAME="action" VALUE="bank.checking.EnterRecord">

It is up to you which you prefer.

Regards,

-- Rodney

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


Re: URL question

Posted by Pete Kazmier <pe...@kazmier.com>.
On Thu, Jan 10, 2002 at 06:15:38PM -0800, Jack Axaopoulos wrote:
> 
> So the correct URL is ../servlet/turbine/template/bank,checking,AccountView.vm
> Ok that works....Cool... this is all coming together now.
> 
> Now what if I want an action to execute before AccountView.vm?
> 
> What would the URL look like?
> 
> The following works, but is there a better way?
> ..servlet/turbine/template/bank,checking,AccountView.vm?action=bank.checking.EnterRecord

I'm new to Turbine (haven't actually used it yet), but after silently
hanging out on this mailing list, I think you want pass all your
parameters as key/value pairs separated with a '/' character, so the
preferred way for the above url would be:

..servlet/turbine/template/bank,checking,AccountView.vm/action/bank.checking.EnterRecord

You can also shorten the classname of your action class in the url by
editing your "module.packages" property in TurbineResources.properties
file.  For exmample, add "bank.checking" to the appropriate class path.

I'm not really sure what you meant by "better way", but I hope this
helps.

Thanks,
Pete

-- 
Peter Kazmier                                 http://www.kazmier.com
PGP Fingerprint   4FE7 8DA3 D0B5 9CAA 69DC  7243 1855 BC2E 4B43 5654

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


Re: URL question

Posted by Jack Axaopoulos <ja...@cisco.com>.
So the correct URL is ../servlet/turbine/template/bank,checking,AccountView.vm
Ok that works....Cool... this is all coming together now.

Now what if I want an action to execute before AccountView.vm?

What would the URL look like?

The following works, but is there a better way?
..servlet/turbine/template/bank,checking,AccountView.vm?action=bank.checking.EnterRecord

Thanks...

J





At 05:31 PM 1/10/2002 -0800, John McNally wrote:
>Jack Axaopoulos wrote:
> >
> > I'm using Turbine 2.1 with velocity and have a question
> > concerning valid URLs.
> >
> > After reviewing some of the turbine/velocity code, and doing some tests,
> > the following URL works:
> >
> > ../servlet/turbine?template=/bank/checking,AccountView.vm
> >
> > My directory structure looks like:
> > /templates
> > /templates/bank
> > /templates/bank/checking
> > /templates/bank/checking/AccountView.vm
> >
> > However, the velocity-site-howto.html seems to imply that the following
> > URL should also work:
> >
> > ../servlet/turbine/template/bank/checking/AccountView.vm
> >
> > Is this actually the case??  This does NOT work for me, and if it should
> > then I know I need to keep digging.
>
>What statement in the howto is giving you the impression that this
>should work?
>
>It should be template/bank,checking,AccountView.vm
>
>john mcnally
>
>--
>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 question

Posted by John McNally <jm...@collab.net>.
Jack Axaopoulos wrote:
> 
> I'm using Turbine 2.1 with velocity and have a question
> concerning valid URLs.
> 
> After reviewing some of the turbine/velocity code, and doing some tests,
> the following URL works:
> 
> ../servlet/turbine?template=/bank/checking,AccountView.vm
> 
> My directory structure looks like:
> /templates
> /templates/bank
> /templates/bank/checking
> /templates/bank/checking/AccountView.vm
> 
> However, the velocity-site-howto.html seems to imply that the following
> URL should also work:
> 
> ../servlet/turbine/template/bank/checking/AccountView.vm
> 
> Is this actually the case??  This does NOT work for me, and if it should
> then I know I need to keep digging.

What statement in the howto is giving you the impression that this
should work?

It should be template/bank,checking,AccountView.vm

john mcnally

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