You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Denis McCarthy <dm...@annadaletech.com> on 2007/05/29 12:14:25 UTC

Adding a parameter to the url for all pages

Hi,
I've a custom application that runs on a set number of machines. The 
application consists of a custom browser (based on xulrunner and eclipse 
swt Browser class) and a tapestry application. Each machine on which the 
app runs has a unique ID. Currently, when users use the application, 
their information is stored in a standard tapestry visit object. 
However, I'm not a huge fan of the http session, and, given my 
environment, I could do away with it entirely by simply altering each 
submitted URL in the custom browser to include the machine id, and keep 
any session-based variables in the database.

This is simple to do via a listener in the Browser. However, I'm not 
sure if this is possible on the tapestry side. Basically, each url would 
be modifed from http://localhost:8080/app/myPage.sdirect to 
http://localhost:8080/app/myPage.sdirect?machineId=4

or http://localhost:8080/app/myOtherPage.sdirect?sp=1
to http://localhost:8080/app/myOtherPage.sdirect?sp=1&machineId=4

Does this idea make sense? Is there a way to always get a parameter like 
this out of the URL (regardless of whether it's a GET or POST?)
I've been messing around with this idea in my app, but I'm running into 
problems like
'rewind of form myPage/form expected only 0 form elements, but an 
additional id was requested by component myPage/null'

Is this notion I've come up with feasible, or have I been smoking too 
much crack again?

Thanks
Denis

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Adding a parameter to the url for all pages

Posted by Denis McCarthy <dm...@annadaletech.com>.
Never mind - I just came across an example using the cookie source 
hivemind service to accomplish this. This is a much cleaner solution. Thanks

Denis McCarthy wrote:
> That sounds like a good idea. However, I've been unable to find an 
> explanation as to how to set a value explicitly in a cookie (I know that 
> tapestry will implicitly set the session value in a cookie for you to 
> synchronize the server state with the client using a session id) How do 
> you get tapestry to store some other value in a cookie, and is there a 
> way to easily access it? I'm using tap 4.1
> Thanks
> Denis
> 
> Jesse Kuhnert wrote:
>> Why don't you just store the unique machine ID in a cookie ?
>>
>> On 5/29/07, Denis McCarthy <dm...@annadaletech.com> wrote:
>>>
>>> Hi,
>>> I've a custom application that runs on a set number of machines. The
>>> application consists of a custom browser (based on xulrunner and eclipse
>>> swt Browser class) and a tapestry application. Each machine on which the
>>> app runs has a unique ID. Currently, when users use the application,
>>> their information is stored in a standard tapestry visit object.
>>> However, I'm not a huge fan of the http session, and, given my
>>> environment, I could do away with it entirely by simply altering each
>>> submitted URL in the custom browser to include the machine id, and keep
>>> any session-based variables in the database.
>>>
>>> This is simple to do via a listener in the Browser. However, I'm not
>>> sure if this is possible on the tapestry side. Basically, each url would
>>> be modifed from http://localhost:8080/app/myPage.sdirect to
>>> http://localhost:8080/app/myPage.sdirect?machineId=4
>>>
>>> or http://localhost:8080/app/myOtherPage.sdirect?sp=1
>>> to http://localhost:8080/app/myOtherPage.sdirect?sp=1&machineId=4
>>>
>>> Does this idea make sense? Is there a way to always get a parameter like
>>> this out of the URL (regardless of whether it's a GET or POST?)
>>> I've been messing around with this idea in my app, but I'm running into
>>> problems like
>>> 'rewind of form myPage/form expected only 0 form elements, but an
>>> additional id was requested by component myPage/null'
>>>
>>> Is this notion I've come up with feasible, or have I been smoking too
>>> much crack again?
>>>
>>> Thanks
>>> Denis
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Adding a parameter to the url for all pages

Posted by Denis McCarthy <dm...@annadaletech.com>.
That sounds like a good idea. However, I've been unable to find an 
explanation as to how to set a value explicitly in a cookie (I know that 
tapestry will implicitly set the session value in a cookie for you to 
synchronize the server state with the client using a session id) How do 
you get tapestry to store some other value in a cookie, and is there a 
way to easily access it? I'm using tap 4.1
Thanks
Denis

Jesse Kuhnert wrote:
> Why don't you just store the unique machine ID in a cookie ?
> 
> On 5/29/07, Denis McCarthy <dm...@annadaletech.com> wrote:
>>
>> Hi,
>> I've a custom application that runs on a set number of machines. The
>> application consists of a custom browser (based on xulrunner and eclipse
>> swt Browser class) and a tapestry application. Each machine on which the
>> app runs has a unique ID. Currently, when users use the application,
>> their information is stored in a standard tapestry visit object.
>> However, I'm not a huge fan of the http session, and, given my
>> environment, I could do away with it entirely by simply altering each
>> submitted URL in the custom browser to include the machine id, and keep
>> any session-based variables in the database.
>>
>> This is simple to do via a listener in the Browser. However, I'm not
>> sure if this is possible on the tapestry side. Basically, each url would
>> be modifed from http://localhost:8080/app/myPage.sdirect to
>> http://localhost:8080/app/myPage.sdirect?machineId=4
>>
>> or http://localhost:8080/app/myOtherPage.sdirect?sp=1
>> to http://localhost:8080/app/myOtherPage.sdirect?sp=1&machineId=4
>>
>> Does this idea make sense? Is there a way to always get a parameter like
>> this out of the URL (regardless of whether it's a GET or POST?)
>> I've been messing around with this idea in my app, but I'm running into
>> problems like
>> 'rewind of form myPage/form expected only 0 form elements, but an
>> additional id was requested by component myPage/null'
>>
>> Is this notion I've come up with feasible, or have I been smoking too
>> much crack again?
>>
>> Thanks
>> Denis
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Adding a parameter to the url for all pages

Posted by Jesse Kuhnert <jk...@gmail.com>.
Why don't you just store the unique machine ID in a cookie ?

On 5/29/07, Denis McCarthy <dm...@annadaletech.com> wrote:
>
> Hi,
> I've a custom application that runs on a set number of machines. The
> application consists of a custom browser (based on xulrunner and eclipse
> swt Browser class) and a tapestry application. Each machine on which the
> app runs has a unique ID. Currently, when users use the application,
> their information is stored in a standard tapestry visit object.
> However, I'm not a huge fan of the http session, and, given my
> environment, I could do away with it entirely by simply altering each
> submitted URL in the custom browser to include the machine id, and keep
> any session-based variables in the database.
>
> This is simple to do via a listener in the Browser. However, I'm not
> sure if this is possible on the tapestry side. Basically, each url would
> be modifed from http://localhost:8080/app/myPage.sdirect to
> http://localhost:8080/app/myPage.sdirect?machineId=4
>
> or http://localhost:8080/app/myOtherPage.sdirect?sp=1
> to http://localhost:8080/app/myOtherPage.sdirect?sp=1&machineId=4
>
> Does this idea make sense? Is there a way to always get a parameter like
> this out of the URL (regardless of whether it's a GET or POST?)
> I've been messing around with this idea in my app, but I'm running into
> problems like
> 'rewind of form myPage/form expected only 0 form elements, but an
> additional id was requested by component myPage/null'
>
> Is this notion I've come up with feasible, or have I been smoking too
> much crack again?
>
> Thanks
> Denis
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com