You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Tal Shalif <ta...@shalif.com> on 2006/10/24 18:50:59 UTC

HTML Generator/proxy using POST method

How do I generate (in a sitemap.xmap pipeline) HTML from a remote
HTTP server passing through the client browser's form parameters using
the POST method?


What I would like to achieve is embed a foreign site (e.g. a PHP based
trouble ticket system running on Apache server) inside a Forrest/cocoon
site (please see diagram below). I provide the generator with the
client form data via the query string:

 <map:generate type="html"
             src="http://localhost/tr/{1}{2}?{request:queryString}">

But what do I do if the client is sending form data using the POST
method?



+---------------+
| remote:80     |   (remote http)
+---------------+
       ||
       ||
       \/
+-----------------------------------+
| site skinning with forrest/cocoon |  (cocoon/forrest)
+-----------------------------------+
       ||
       ||
       \/
+------------------------------------------+
| User view HTML page and/or submits back  |  (client browser)
| its form data using the POST method      |
+------------------------------------------+
       ||                                /\
       ||				 ||
       \/				 ||
+--------------------------------------------------+
| Cocoon passes the request   |                    |
| to remote server also using | Site skinning with | (cocoon/forrest)
| the POST method             | Cocoon/forres      |
+--------------------------------------------------+

                   ||                   /\
		   ||		        ||
		   \/		        ||
     				
                 +-------------------------+
	         | remote HTTP server:80   |   (remote http)
 	         +-------------------------+



-- 
Tal Shalif

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


Re: HTML Generator/proxy using POST method

Posted by Tal Shalif <co...@t1.nargila.org>.
I have solved the problem by creating a custom generator based on
ProxyGenerator.java (from Lenya). The generator copies parameters and
headers from the original request to the proxy request, then it copies
cookies and headers back to the response.

This seems to work, with the exception that at least in Forrest, the
ResponseWrapper object passed to the generator via the objectModel map
does not allow modification of response headers and unlike
HttpResponse does not have the setStatus() method (sending Form data
via the POST method often results in a 'page temporary moved' and
redirection to another page). I don't know how to solve this problem -
i.e. dynamic redirection from inside an inner body-*, but this is
perhaps more Forrest specific.


> Tal Shalif wrote:
> > How do I generate (in a sitemap.xmap pipeline) HTML from a remote
> > HTTP server passing through the client browser's form parameters using
> > the POST method?
> >
> >
> > What I would like to achieve is embed a foreign site (e.g. a PHP based
> > trouble ticket system running on Apache server) inside a Forrest/cocoon
> > site (please see diagram below). I provide the generator with the
> > client form data via the query string:
> >
> > <map:generate type="html"
> >             src="http://localhost/tr/{1}{2}?{request:queryString}">
> >
> > But what do I do if the client is sending form data using the POST
> > method?
> >
> >
> >
> > +---------------+
> > | remote:80     |   (remote http)
> > +---------------+
> >       ||
> >       ||
> >       \/
> > +-----------------------------------+
> > | site skinning with forrest/cocoon |  (cocoon/forrest)
> > +-----------------------------------+
> >       ||
> >       ||
> >       \/
> > +------------------------------------------+
> > | User view HTML page and/or submits back  |  (client browser)
> > | its form data using the POST method      |
> > +------------------------------------------+
> >       ||                                /\
> >       ||                 ||
> >       \/                 ||
> > +--------------------------------------------------+
> > | Cocoon passes the request   |                    |
> > | to remote server also using | Site skinning with | (cocoon/forrest)
> > | the POST method             | Cocoon/forres      |
> > +--------------------------------------------------+
> >
> >                   ||                   /\
> >            ||                ||
> >            \/                ||
> >
> >                 +-------------------------+
> >              | remote HTTP server:80   |   (remote http)
> >              +-------------------------+
> >
Kaj Kandler <Ka...@conficio.com> wrote:

> Hi Tal,
> you should be able to use {request-param:your parameter}
>
> <map:generate type="html"
> src="http://localhost/tr/{1}{2}?{request-param:first}&{request-param:second}&...">

This will not do as proxy, since there is no knowledge of the query
parameters available to place in the sitemap. Also, above constructs a
query string, which will not be used if the page is to be retrieved
using the POST method.

>
> K<o>
>

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


Re: HTML Generator/proxy using POST method

Posted by Lars Huttar <la...@sil.org>.
On 10/28/2006 3:28 AM, Geert Josten wrote:
> Hi Tal,
>
> You can use the cinclude transformer with elaborate syntax to perform
> more complex HTTP requests.
>
>       <cinclude:includexml>
>         <cinclude:src>
> 		{url you want to access}
>         </cinclude:src>
>         <cinclude:configuration>
>           <cinclude:parameter>
>             <cinclude:name>method</cinclude:name>
>             <cinclude:value>POST</cinclude:value>
>           </cinclude:parameter>
>         </cinclude:configuration>
>         <cinclude:parameters>
>             <cinclude:parameter>
>               <cinclude:name>
>                 {name}
>               </cinclude:name>
>               <cinclude:value>
>                 {value or XML fragment}
>               </cinclude:value>
>             </cinclude:parameter>
>         </cinclude:parameters>
>       </cinclude:includexml>
>
> But this DOES require that the url results XML not HTML.
>
> Kind regards,
> Geert
>   
Didn't I read that the POST method for cinclude is broken (ignored) in 
recent versions?

Lars


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


RE: HTML Generator/proxy using POST method

Posted by Geert Josten <ge...@daidalos.nl>.
Hi Tal,

You can use the cinclude transformer with elaborate syntax to perform
more complex HTTP requests.

      <cinclude:includexml>
        <cinclude:src>
		{url you want to access}
        </cinclude:src>
        <cinclude:configuration>
          <cinclude:parameter>
            <cinclude:name>method</cinclude:name>
            <cinclude:value>POST</cinclude:value>
          </cinclude:parameter>
        </cinclude:configuration>
        <cinclude:parameters>
            <cinclude:parameter>
              <cinclude:name>
                {name}
              </cinclude:name>
              <cinclude:value>
                {value or XML fragment}
              </cinclude:value>
            </cinclude:parameter>
        </cinclude:parameters>
      </cinclude:includexml>

But this DOES require that the url results XML not HTML.

Kind regards,
Geert

> 
   
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984


De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.
 

> Van: Kaj Kandler [mailto:KajKandler@conficio.com] 
> Verzonden: vrijdag 27 oktober 2006 15:01
> Aan: users@cocoon.apache.org
> Onderwerp: Re: HTML Generator/proxy using POST method
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi Tal,
> you should be able to use {request-param:your parameter}
> 
> <map:generate type="html"
> src="http://localhost/tr/{1}{2}?{request-param:first}&{request
> -param:second}&...">
> 
> K<o>
> 
> Tal Shalif wrote:
> > How do I generate (in a sitemap.xmap pipeline) HTML from a 
> remote HTTP 
> > server passing through the client browser's form parameters 
> using the 
> > POST method?
> > 
> > 
> > What I would like to achieve is embed a foreign site (e.g. 
> a PHP based 
> > trouble ticket system running on Apache server) inside a 
> > Forrest/cocoon site (please see diagram below). I provide the 
> > generator with the client form data via the query string:
> > 
> > <map:generate type="html"
> >             src="http://localhost/tr/{1}{2}?{request:queryString}">
> > 
> > But what do I do if the client is sending form data using the POST 
> > method?
> > 
> > 
> > 
> > +---------------+
> > | remote:80     |   (remote http)
> > +---------------+
> >       ||
> >       ||
> >       \/
> > +-----------------------------------+
> > | site skinning with forrest/cocoon |  (cocoon/forrest)
> > +-----------------------------------+
> >       ||
> >       ||
> >       \/
> > +------------------------------------------+
> > | User view HTML page and/or submits back  |  (client browser)
> > | its form data using the POST method      |
> > +------------------------------------------+
> >       ||                                /\
> >       ||                 ||
> >       \/                 ||
> > +--------------------------------------------------+
> > | Cocoon passes the request   |                    |
> > | to remote server also using | Site skinning with | 
> (cocoon/forrest)
> > | the POST method             | Cocoon/forres      |
> > +--------------------------------------------------+
> > 
> >                   ||                   /\
> >            ||                ||
> >            \/                ||
> >                    
> >                 +-------------------------+
> >              | remote HTTP server:80   |   (remote http)
> >              +-------------------------+
> > 
> > 
> > 
> 
> - --
> KajKandler@Conficio.com
>  http://conficio.blogspot.com/
>  ================================================
>  |  We teach software one screencast at a time  |  
> ================================================
>  http://www.conficio.com/
>  Tel: +1 (781) 632 5773 - Fax: +1 (781) 207 9159  Conficio  
> P.O.Box 761062,  Melrose,  MA 02176
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (MingW32)
> 
> iD8DBQFFQgMlRDUvrJRNjTARAvhuAJ9KkeHD8f9BbaoHX2v6OMKP8QXKyACfZGbW
> EIF2BkY4cuspURx1sspI67M=
> =TNBl
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

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


Re: HTML Generator/proxy using POST method

Posted by Kaj Kandler <Ka...@conficio.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Tal,
you should be able to use {request-param:your parameter}

<map:generate type="html"
src="http://localhost/tr/{1}{2}?{request-param:first}&{request-param:second}&...">

K<o>

Tal Shalif wrote:
> How do I generate (in a sitemap.xmap pipeline) HTML from a remote
> HTTP server passing through the client browser's form parameters using
> the POST method?
> 
> 
> What I would like to achieve is embed a foreign site (e.g. a PHP based
> trouble ticket system running on Apache server) inside a Forrest/cocoon
> site (please see diagram below). I provide the generator with the
> client form data via the query string:
> 
> <map:generate type="html"
>             src="http://localhost/tr/{1}{2}?{request:queryString}">
> 
> But what do I do if the client is sending form data using the POST
> method?
> 
> 
> 
> +---------------+
> | remote:80     |   (remote http)
> +---------------+
>       ||
>       ||
>       \/
> +-----------------------------------+
> | site skinning with forrest/cocoon |  (cocoon/forrest)
> +-----------------------------------+
>       ||
>       ||
>       \/
> +------------------------------------------+
> | User view HTML page and/or submits back  |  (client browser)
> | its form data using the POST method      |
> +------------------------------------------+
>       ||                                /\
>       ||                 ||
>       \/                 ||
> +--------------------------------------------------+
> | Cocoon passes the request   |                    |
> | to remote server also using | Site skinning with | (cocoon/forrest)
> | the POST method             | Cocoon/forres      |
> +--------------------------------------------------+
> 
>                   ||                   /\
>            ||                ||
>            \/                ||
>                    
>                 +-------------------------+
>              | remote HTTP server:80   |   (remote http)
>              +-------------------------+
> 
> 
> 

- --
KajKandler@Conficio.com
 http://conficio.blogspot.com/
 ================================================
 |  We teach software one screencast at a time  |
 ================================================
 http://www.conficio.com/
 Tel: +1 (781) 632 5773 - Fax: +1 (781) 207 9159
 Conficio
 P.O.Box 761062,  Melrose,
 MA 02176

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)

iD8DBQFFQgMlRDUvrJRNjTARAvhuAJ9KkeHD8f9BbaoHX2v6OMKP8QXKyACfZGbW
EIF2BkY4cuspURx1sspI67M=
=TNBl
-----END PGP SIGNATURE-----

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