You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Tod Thomas <tt...@chubb.com> on 2005/10/17 19:33:47 UTC

Content Aggregation

I am trying to aggregate a couple of web components into a single 
presentation.  The main page is based on a Velocity template.  The other 
is a legacy page generated via CGI on a different server that expects a 
combination of cookies and environment variables to produce its output. 
  Can I do this with Velocity?

I've looked at the J2ee RequestDispatcher Interface and it seems it may 
fit my needs but I'm not sure how to include the end result of the 
generated content from the Velocity template.  I thought if I could 
somehow control the resulting Velocity template output stream I could 
just add my CGI app call, and my Velocity servlet to the 
RequestDispatcher.  I didn't see anything that would let me do that.

Has anyone run into this who might have a solution or an alternative?


Thanks - Tod

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Content Aggregation

Posted by Nathan Bubna <nb...@gmail.com>.
On 10/17/05, Tod Thomas <tt...@chubb.com> wrote:
> Nathan Bubna wrote:
> > The VelocityTools project includes an ImportTool that may work for you.
> >
> > http://jakarta.apache.org/velocity/tools/view/ImportTool.html
>
>
> Thanks.  I've already done something like that using
> java.net.URL.openStream() and streaming the output into a Vector that
> ends up in the Velocity Context.  From there I let a template loop
> render it.

Well, that's not quite what ImportTool does.  It only uses
java.net.URL if you give it an absolute url (e.g.
"http://foo.com/index.html").  if you can give it a relative URL (e.g.
"/foo.html"), then it will use RequestDispatcher and acquire content
through that.  i'm no expert in RequestDispatcher and all that, but
since you were saying that it sounded like what you needed, i thought
this might help.

> The problem is this doesn't pass any of the HTTP header information
> (cookies) to the CGI so none of the dynamic content gets generated on
> the CGI side.

i have no idea if RequestDispatcher does that, and i'm too lazy to
look it up right now.  but along with James, i'd say that HttpClient
is almost certainly capable of that.  it's a good library.

> > On 10/17/05, Tod Thomas <tt...@chubb.com> wrote:
> >
> >>I am trying to aggregate a couple of web components into a single
> >>presentation.  The main page is based on a Velocity template.  The other
> >>is a legacy page generated via CGI on a different server that expects a
> >>combination of cookies and environment variables to produce its output.
> >>  Can I do this with Velocity?
> >>
> >>I've looked at the J2ee RequestDispatcher Interface and it seems it may
> >>fit my needs but I'm not sure how to include the end result of the
> >>generated content from the Velocity template.  I thought if I could
> >>somehow control the resulting Velocity template output stream I could
> >>just add my CGI app call, and my Velocity servlet to the
> >>RequestDispatcher.  I didn't see anything that would let me do that.
> >>
> >>Has anyone run into this who might have a solution or an alternative?
> >>
> >>
> >>Thanks - Tod
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Content Aggregation

Posted by James Kebinger <jk...@gmail.com>.
Right, you'll have to push the headers manually if you're going to pipe your
CGi output - you can do this more easily with the apache httpclient
class(es) than with the URL class, but either way it isn't pretty.

On 10/17/05, Tod Thomas <tt...@chubb.com> wrote:
>
> Nathan Bubna wrote:
> > The VelocityTools project includes an ImportTool that may work for you.
> >
> > http://jakarta.apache.org/velocity/tools/view/ImportTool.html
>
>
> Thanks. I've already done something like that using
> java.net.URL.openStream() and streaming the output into a Vector that
> ends up in the Velocity Context. From there I let a template loop
> render it.
>
> The problem is this doesn't pass any of the HTTP header information
> (cookies) to the CGI so none of the dynamic content gets generated on
> the CGI side.
>
>
> > On 10/17/05, Tod Thomas <tt...@chubb.com> wrote:
> >
> >>I am trying to aggregate a couple of web components into a single
> >>presentation. The main page is based on a Velocity template. The other
> >>is a legacy page generated via CGI on a different server that expects a
> >>combination of cookies and environment variables to produce its output.
> >> Can I do this with Velocity?
> >>
> >>I've looked at the J2ee RequestDispatcher Interface and it seems it may
> >>fit my needs but I'm not sure how to include the end result of the
> >>generated content from the Velocity template. I thought if I could
> >>somehow control the resulting Velocity template output stream I could
> >>just add my CGI app call, and my Velocity servlet to the
> >>RequestDispatcher. I didn't see anything that would let me do that.
> >>
> >>Has anyone run into this who might have a solution or an alternative?
> >>
> >>
> >>Thanks - Tod
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
>

Re: Content Aggregation

Posted by Tod Thomas <tt...@chubb.com>.
Nathan Bubna wrote:
> The VelocityTools project includes an ImportTool that may work for you.
> 
> http://jakarta.apache.org/velocity/tools/view/ImportTool.html


Thanks.  I've already done something like that using 
java.net.URL.openStream() and streaming the output into a Vector that 
ends up in the Velocity Context.  From there I let a template loop 
render it.

The problem is this doesn't pass any of the HTTP header information 
(cookies) to the CGI so none of the dynamic content gets generated on 
the CGI side.


> On 10/17/05, Tod Thomas <tt...@chubb.com> wrote:
> 
>>I am trying to aggregate a couple of web components into a single
>>presentation.  The main page is based on a Velocity template.  The other
>>is a legacy page generated via CGI on a different server that expects a
>>combination of cookies and environment variables to produce its output.
>>  Can I do this with Velocity?
>>
>>I've looked at the J2ee RequestDispatcher Interface and it seems it may
>>fit my needs but I'm not sure how to include the end result of the
>>generated content from the Velocity template.  I thought if I could
>>somehow control the resulting Velocity template output stream I could
>>just add my CGI app call, and my Velocity servlet to the
>>RequestDispatcher.  I didn't see anything that would let me do that.
>>
>>Has anyone run into this who might have a solution or an alternative?
>>
>>
>>Thanks - Tod
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Content Aggregation

Posted by Nathan Bubna <nb...@gmail.com>.
The VelocityTools project includes an ImportTool that may work for you.

http://jakarta.apache.org/velocity/tools/view/ImportTool.html

On 10/17/05, Tod Thomas <tt...@chubb.com> wrote:
> I am trying to aggregate a couple of web components into a single
> presentation.  The main page is based on a Velocity template.  The other
> is a legacy page generated via CGI on a different server that expects a
> combination of cookies and environment variables to produce its output.
>   Can I do this with Velocity?
>
> I've looked at the J2ee RequestDispatcher Interface and it seems it may
> fit my needs but I'm not sure how to include the end result of the
> generated content from the Velocity template.  I thought if I could
> somehow control the resulting Velocity template output stream I could
> just add my CGI app call, and my Velocity servlet to the
> RequestDispatcher.  I didn't see anything that would let me do that.
>
> Has anyone run into this who might have a solution or an alternative?
>
>
> Thanks - Tod
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org