You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by thermus <ms...@gmail.com> on 2008/12/15 07:17:19 UTC

[T5] Handle post from external application

What is the proper way to handle a form post to a Tapestry page from an
external application?  I know how to encode the parameters in the URL and
use the onActivate context, but in this case, the data being passed from the
external application will exceed the URL length limit so I need to use post.

Can anyone advise how to do this?


-- 
View this message in context: http://www.nabble.com/-T5--Handle-post-from-external-application-tp21008825p21008825.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: [T5] Handle post from external application

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 23 Sep 2009 21:08:16 -0300, thermus <ms...@gmail.com> escreveu:

> Thiago,

Hi!

> I know this thread is old, but I had a related question.  If I submit a  
> form to a response page, what method can be used in the response page to  
> redirect to a URL like your "use both!" example?  i.e. How can I append
> "?parameter3=3&parameter4=4..." to the end of the context when  
> redirecting after POST?

Inject the PageRenderLinkSource and use its  
createPageRenderLinkWithContext() method to generate a Link. In this Link  
object, use its addParameter() method to add the query parameters  
(?parameter3=3&parameter4=4). Then return this Link in some event handler  
method (onSubmit or any other). I have not tested it, though.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: [T5] Handle post from external application

Posted by thermus <ms...@gmail.com>.

Thiago H. de Paula Figueiredo wrote:
> 
> They're not mutually exclusive. They are just different ways to receive  
> parameters. Which one to use is all about the URLs.
> 
> Suppose the page that will receive the request is named "process":
> 
> www.example.com/process/parameter1/parameter2/parameter3: use onActivate
> www.example.com/process?parameter1=1&parameter2=2: use
> Request.getParameter
> www.example.com/process/parameter1/parameter2?parameter3=3: use both!  
> onActivate to get parameters 1 and 2 and Request.getParameter to get  
> parameter 3.
> 
> 

Thiago, 

I know this thread is old, but I had a related question.  If I submit a form
to a response page, what method can be used in the response page to redirect
to a URL like your "use both!" example?  i.e. How can I append
"?parameter3=3&parameter4=4..." to the end of the context when redirecting
after POST?

The idea is to keep the Tapestry onPassivate URL context for real objects,
but allow optional, unordered parameters to be defined in a GET-style
parameter list.  Is this possible in Tapestry?  Thanks!
-- 
View this message in context: http://www.nabble.com/-T5--Handle-post-from-external-application-tp21008825p25531337.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: [T5] Handle post from external application

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Mon, 15 Dec 2008 14:44:50 -0300, thermus <ms...@gmail.com> escreveu:

> Thiago, can the approach you propose coexist with an onActivate context  
> for Tapestry requests or are they mutually exclusive?

They're not mutually exclusive. They are just different ways to receive  
parameters. Which one to use is all about the URLs.

Suppose the page that will receive the request is named "process":

www.example.com/process/parameter1/parameter2/parameter3: use onActivate
www.example.com/process?parameter1=1&parameter2=2: use Request.getParameter
www.example.com/process/parameter1/parameter2?parameter3=3: use both!  
onActivate to get parameters 1 and 2 and Request.getParameter to get  
parameter 3.

> In what page method does getting the request parameters happen (e.g.  
> onActivate?) ?

You can use Request in any method. You use it like you would use  
HttpServletRequest. The difference is that your code depends only in  
Tapestry, not in the Servlet API.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: [T5] Handle post from external application

Posted by thermus <ms...@gmail.com>.
I was talking about posting from another web application to a Tapestry page,
but it really shouldn't matter where the post is coming from (i.e. Java
application, Perl script, etc).

My goal is to have a page that operates normally for Tapestry requests or
REST URL requests from onActivate contexts, but also have the same page be
able to respond to posts from other applications.

Thiago, can the approach you propose coexist with an onActivate context for
Tapestry requests or are they mutually exclusive?  In what page method does
getting the request parameters happen (e.g. onActivate?) ?

Thanks!



Massimo Lusetti wrote:
> 
> On Mon, Dec 15, 2008 at 2:41 PM, Thiago H. de Paula Figueiredo
> <th...@gmail.com> wrote:
> 
>> Em Mon, 15 Dec 2008 03:17:19 -0300, thermus <ms...@gmail.com> escreveu:
>>
>>> What is the proper way to handle a form post to a Tapestry page from an
>>> external application?  I know how to encode the parameters in the URL
>>> and
>>> use the onActivate context, but in this case, the data being passed from
>>> the external application will exceed the URL length limit so I need to
>>> use
>>> post.
>>
>> Inject the Request and use it to get the parameter values, just like you
>> would do without Tapestry. Tapestry adds a hidden field with some values
>> you
>> better not try to deal with them. :)
> 
> We are talking about the client side which is a java app (for example)
> that has to post data to the T5 web app for taking advantage of great
> processing features provider by T5 you have to deal with the hidden
> formadata parameter.
> Please correct me if I'm wrong.
> 
> -- 
> Massimo
> http://meridio.blogspot.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-T5--Handle-post-from-external-application-tp21008825p21018348.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: [T5] Handle post from external application

Posted by Massimo Lusetti <ml...@gmail.com>.
On Mon, Dec 15, 2008 at 2:41 PM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:

> Em Mon, 15 Dec 2008 03:17:19 -0300, thermus <ms...@gmail.com> escreveu:
>
>> What is the proper way to handle a form post to a Tapestry page from an
>> external application?  I know how to encode the parameters in the URL and
>> use the onActivate context, but in this case, the data being passed from
>> the external application will exceed the URL length limit so I need to use
>> post.
>
> Inject the Request and use it to get the parameter values, just like you
> would do without Tapestry. Tapestry adds a hidden field with some values you
> better not try to deal with them. :)

We are talking about the client side which is a java app (for example)
that has to post data to the T5 web app for taking advantage of great
processing features provider by T5 you have to deal with the hidden
formadata parameter.
Please correct me if I'm wrong.

-- 
Massimo
http://meridio.blogspot.com

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


Re: [T5] Handle post from external application

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Mon, 15 Dec 2008 03:17:19 -0300, thermus <ms...@gmail.com> escreveu:

> What is the proper way to handle a form post to a Tapestry page from an
> external application?  I know how to encode the parameters in the URL and
> use the onActivate context, but in this case, the data being passed from  
> the external application will exceed the URL length limit so I need to  
> use post.

Inject the Request and use it to get the parameter values, just like you  
would do without Tapestry. Tapestry adds a hidden field with some values  
you better not try to deal with them. :)

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
Consultor, desenvolvedor e instrutor em Java
http://www.arsmachina.com.br/thiago

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


Re: [T5] Handle post from external application

Posted by Massimo Lusetti <ml...@gmail.com>.
On Mon, Dec 15, 2008 at 7:17 AM, thermus <ms...@gmail.com> wrote:

> What is the proper way to handle a form post to a Tapestry page from an
> external application?  I know how to encode the parameters in the URL and
> use the onActivate context, but in this case, the data being passed from the
> external application will exceed the URL length limit so I need to use post.
>
> Can anyone advise how to do this?

You have to look at the generated HTML fro your page, grab the
t:formdata form parameter and (hard)code it into your app which will
post to T5, obviously you have to use the appropriate parameter too.
Of course you will tie together with that particular version of T5.

This way it'll do the job. Yep i know it's no more then an hack but is
the only way to do that right now, maybe (i think so) in the future T5
will have more RESTfull "features" to facilitate this but for now you
have to be satisfied.

I would like to see more discussion in this topic since i find T5 a
great framework to build web app for app (B2B or call that the way you
want), non only for browsers.

Regards
-- 
Massimo
http://meridio.blogspot.com

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