You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Reinhard Pötz <re...@gmx.net> on 2001/12/05 20:25:34 UTC

Proxy Component?

Is there any possibility to use Cocoon as proxy? I have some "old"
applications (written in PHP) that I want to use in combination with cocoon
(I want to use some actions)

for example:

			<map:match pattern="old_application/**">
			   <map:act type="checkSession"/>
				<map:proxy src="http://old_application_server/{1}"/>
			   </map>
			   <map:redirect-to uri="login.html"/>
			</map:match>


Currently I solved the problem by using the HTML-generator but if I use it
the header information of the client will get lost.

If there is no available component - what would be the best way of
implementing it?

Regards,
Reinhard



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


Re: Proxy Component?

Posted by Stefano Mazzocchi <st...@apache.org>.
Reinhard Pötz wrote:
> 
> Is there any possibility to use Cocoon as proxy?

Hmmm, not in the HTTP/1.1 sense.

> I have some "old"
> applications (written in PHP) that I want to use in combination with cocoon
> (I want to use some actions)
> 
> for example:
> 
>                         <map:match pattern="old_application/**">
>                            <map:act type="checkSession"/>
>                                 <map:proxy src="http://old_application_server/{1}"/>
>                            </map>
>                            <map:redirect-to uri="login.html"/>
>                         </map:match>
> 
> Currently I solved the problem by using the HTML-generator but if I use it
> the header information of the client will get lost.

Try using a Reader:

        <map:match pattern="old_application/**">
         <map:act type="checkSession"/>
          <map:read src="http://old_application_server/{1}"/>
         </map>
        </map:match>

but I'm not sure it's fully action-safe since I don't know of anybody
using it for this.
 
-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------



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


Re: Proxy Component?

Posted by "Piroumian, Konstantin" <KP...@flagship.ru>.
> > You can create a reader for this purpose. I needed something like that
to
> > get direct output from a JSP page (that is generating HTML, not XML) and
> > have implemented the JSPReader. Now you can use it like this:
> >
> >  <map:match pattern="old_application/**">
> >     <map:act type="checkSession"/>
> >  <map:read src="/jsp/page.jsp"/>
> >     </map>
> >     <map:redirect-to uri="login.html"/>
> >  </map:match>
> >
> > So, I hope you got the idea.
> >
> > Btw, developers, there are ServletGenerator and JSPGenerator componenets
> > that implement almost the same thing: get output from a servlet then
> > generate XML from it. JSPGeneretor uses JSPEngine for that. Maybe it'll
be
> > better to have something like ServletComponenet and use it either in
> > generators or readers that have to interact with other servlets?
> >
>
> For purposes of migration, we're looking at starting from HTML JSPs, and
your
> JSPReader sounds like just the thing.  Is it generally available?  And,
> frankly, why is it not a member of the Cocoon2 project?  (The current
> documentation on most of the Generators is sort of poor, as is.)
>

Yes, it is availavle in C2.1-dev branch. I didn't send a patch for C2.0
cause it seemed to me that nobody is really interested in it. Just now I've
send the source of JSPReader adapted for C2.0 to cocoon-users mail list.

What do you mean by being a member of Cocoon2 project? JSPReader is just a
Cocoon component and if it is really needed to anybody else except me then
I'll spend a little time to improve it and provide some documentation.

You can find a sample of usage in C2.1-dev branch.

Regards,
    Konstantin Piroumian

> Judson
>
> > Regards,
> >     Konstantin Piroumian
>


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


Re: Proxy Component?

Posted by Judson Lester <ju...@irev2.com>.
> You can create a reader for this purpose. I needed something like that to
> get direct output from a JSP page (that is generating HTML, not XML) and
> have implemented the JSPReader. Now you can use it like this:
>
>  <map:match pattern="old_application/**">
>     <map:act type="checkSession"/>
>  <map:read src="/jsp/page.jsp"/>
>     </map>
>     <map:redirect-to uri="login.html"/>
>  </map:match>
>
> So, I hope you got the idea.
>
> Btw, developers, there are ServletGenerator and JSPGenerator componenets
> that implement almost the same thing: get output from a servlet then
> generate XML from it. JSPGeneretor uses JSPEngine for that. Maybe it'll be
> better to have something like ServletComponenet and use it either in
> generators or readers that have to interact with other servlets?
>

For purposes of migration, we're looking at starting from HTML JSPs, and your 
JSPReader sounds like just the thing.  Is it generally available?  And, 
frankly, why is it not a member of the Cocoon2 project?  (The current 
documentation on most of the Generators is sort of poor, as is.)  

Judson

> Regards,
>     Konstantin Piroumian

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org

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


AW: Proxy Component?

Posted by Reinhard Pötz <re...@gmx.net>.
 > -----Ursprüngliche Nachricht-----
 > Von: Piroumian, Konstantin [mailto:KPiroumian@flagship.ru]
 > Gesendet: Donnerstag, 06. Dezember 2001 08:53
 > An: cocoon-dev@xml.apache.org
 > Betreff: Re: Proxy Component?
 >
 >
 > >
 > > Is there any possibility to use Cocoon as proxy? I have some "old"
 > > applications (written in PHP) that I want to use in combination with
 > cocoon
 > > (I want to use some actions)
 > >
 > > for example:
 > >
 > > <map:match pattern="old_application/**">
 > >    <map:act type="checkSession"/>
 > > <map:proxy src="http://old_application_server/{1}"/>
 > >    </map>
 > >    <map:redirect-to uri="login.html"/>
 > > </map:match>
 > >
 > >
 > > Currently I solved the problem by using the HTML-generator but
 > if I use it
 > > the header information of the client will get lost.
 > >
 > > If there is no available component - what would be the best way of
 > > implementing it?
 >
 > You can create a reader for this purpose. I needed something like that to
 > get direct output from a JSP page (that is generating HTML, not XML) and
 > have implemented the JSPReader. Now you can use it like this:
 >
 >  <map:match pattern="old_application/**">
 >     <map:act type="checkSession"/>
 >  <map:read src="/jsp/page.jsp"/>
 >     </map>
 >     <map:redirect-to uri="login.html"/>
 >  </map:match>
 >

Does the reader use the client's header data (for example the User-Agent) or
get this data lost and are replaced with some other values? (I tested this
some month ago with the result that the values in the header were replaced.)

I think of a component that works like a resource reader but uses the
client's http-header data. What do you think?


Regards,
Reinhard Poetz


 > So, I hope you got the idea.
 >
 > Btw, developers, there are ServletGenerator and JSPGenerator componenets
 > that implement almost the same thing: get output from a servlet then
 > generate XML from it. JSPGeneretor uses JSPEngine for that.
 > Maybe it'll be
 > better to have something like ServletComponenet and use it either in
 > generators or readers that have to interact with other servlets?
 >
 > Regards,
 >     Konstantin Piroumian
 >
 > >
 > > Regards,
 > > Reinhard
 > >
 > >
 > >
 > > ---------------------------------------------------------------------
 > > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
 > > For additional commands, email: cocoon-dev-help@xml.apache.org
 > >
 >
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
 > For additional commands, email: cocoon-dev-help@xml.apache.org
 >


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


Re: Proxy Component?

Posted by "Piroumian, Konstantin" <KP...@flagship.ru>.
>
> Is there any possibility to use Cocoon as proxy? I have some "old"
> applications (written in PHP) that I want to use in combination with
cocoon
> (I want to use some actions)
>
> for example:
>
> <map:match pattern="old_application/**">
>    <map:act type="checkSession"/>
> <map:proxy src="http://old_application_server/{1}"/>
>    </map>
>    <map:redirect-to uri="login.html"/>
> </map:match>
>
>
> Currently I solved the problem by using the HTML-generator but if I use it
> the header information of the client will get lost.
>
> If there is no available component - what would be the best way of
> implementing it?

You can create a reader for this purpose. I needed something like that to
get direct output from a JSP page (that is generating HTML, not XML) and
have implemented the JSPReader. Now you can use it like this:

 <map:match pattern="old_application/**">
    <map:act type="checkSession"/>
 <map:read src="/jsp/page.jsp"/>
    </map>
    <map:redirect-to uri="login.html"/>
 </map:match>

So, I hope you got the idea.

Btw, developers, there are ServletGenerator and JSPGenerator componenets
that implement almost the same thing: get output from a servlet then
generate XML from it. JSPGeneretor uses JSPEngine for that. Maybe it'll be
better to have something like ServletComponenet and use it either in
generators or readers that have to interact with other servlets?

Regards,
    Konstantin Piroumian

>
> Regards,
> Reinhard
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>

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