A component that renders output from the component and doesn't use a template.

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

A component that renders output from the component and doesn't use a template.

Wouter Danes-2

I want to create a component that outputs a tar.gz file.

Now I would like to output this from the doBeforeRender() by calling response.getOutpuStream().

 

I’ve done this and done a flush() on the output stream, but I still get no content back. It appears that the invokeRender() is still called even though there is no render template specified.

 

Is there any way to go around this without adjusting the pipeline?

 

Met vriendelijke groet / Yours sincerely,

 

---

Wouter Danes

Competence Manager Hippo / Java / Alfresco

Hinttech

 

T: +31 6 1158 8264

E: [hidden email]

@wouterdanes

 


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: A component that renders output from the component and doesn't use a template.

Jeroen Reijn
Administrator

Have you looked at the doBeforeServeResource method? I think it does what you want it to do.

Sent from my mobile phone

Op 8 jan. 2013 18:21 schreef "Wouter Danes" <[hidden email]> het volgende:

I want to create a component that outputs a tar.gz file.

Now I would like to output this from the doBeforeRender() by calling response.getOutpuStream().

 

I’ve done this and done a flush() on the output stream, but I still get no content back. It appears that the invokeRender() is still called even though there is no render template specified.

 

Is there any way to go around this without adjusting the pipeline?

 

Met vriendelijke groet / Yours sincerely,

 

---

Wouter Danes

Competence Manager Hippo / Java / Alfresco

Hinttech

 

T: <a href="tel:%2B31%206%201158%208264" value="+31611588264" target="_blank">+31 6 1158 8264

E: [hidden email]

@wouterdanes

 


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: A component that renders output from the component and doesn't use a template.

Wouter Danes-2

Ah, I’ve dug into the code a bit. It appears that if your doBeforeServeResource commits the response (by calling the flush), the aggregation valve doesn’t do the rendering..

That should do the trick! Thanks for the pointer.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Jeroen Reijn
Sent: dinsdag 8 januari 2013 19:08
To: Hippo CMS 7 development public mailinglist
Subject: Re: [Hippo-cms7-user] A component that renders output from the component and doesn't use a template.

 

Have you looked at the doBeforeServeResource method? I think it does what you want it to do.

Sent from my mobile phone

Op 8 jan. 2013 18:21 schreef "Wouter Danes" <[hidden email]> het volgende:

I want to create a component that outputs a tar.gz file.

Now I would like to output this from the doBeforeRender() by calling response.getOutpuStream().

 

I’ve done this and done a flush() on the output stream, but I still get no content back. It appears that the invokeRender() is still called even though there is no render template specified.

 

Is there any way to go around this without adjusting the pipeline?

 

Met vriendelijke groet / Yours sincerely,

 

---

Wouter Danes

Competence Manager Hippo / Java / Alfresco

Hinttech

 

T: <a href="tel:%2B31%206%201158%208264" target="_blank">+31 6 1158 8264

E: [hidden email]

@wouterdanes

 


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: A component that renders output from the component and doesn't use a template.

Minos Chatzidakis-2
As a side note, you'll probably also need to invoke response.setServeResourcePath(path), path being a relative (to the site webapp) path to a blank jsp file.

Minos


On Tue, Jan 8, 2013 at 8:46 PM, Wouter Danes <[hidden email]> wrote:

Ah, I’ve dug into the code a bit. It appears that if your doBeforeServeResource commits the response (by calling the flush), the aggregation valve doesn’t do the rendering..

That should do the trick! Thanks for the pointer.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Jeroen Reijn
Sent: dinsdag 8 januari 2013 19:08
To: Hippo CMS 7 development public mailinglist
Subject: Re: [Hippo-cms7-user] A component that renders output from the component and doesn't use a template.

 

Have you looked at the doBeforeServeResource method? I think it does what you want it to do.

Sent from my mobile phone

Op 8 jan. 2013 18:21 schreef "Wouter Danes" <[hidden email]> het volgende:

I want to create a component that outputs a tar.gz file.

Now I would like to output this from the doBeforeRender() by calling response.getOutpuStream().

 

I’ve done this and done a flush() on the output stream, but I still get no content back. It appears that the invokeRender() is still called even though there is no render template specified.

 

Is there any way to go around this without adjusting the pipeline?

 

Met vriendelijke groet / Yours sincerely,

 

---

Wouter Danes

Competence Manager Hippo / Java / Alfresco

Hinttech

 

T: <a href="tel:%2B31%206%201158%208264" target="_blank">+31 6 1158 8264

E: [hidden email]

@wouterdanes

 


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



--
With kind regards/Met vriendelijke groet,
Minos Chatzidakis

Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Ard
Reply | Threaded
Open this post in threaded view
|

Re: A component that renders output from the component and doesn't use a template.

Ard
In reply to this post by Wouter Danes-2
On Tue, Jan 8, 2013 at 8:46 PM, Wouter Danes <[hidden email]> wrote:
> Ah, I’ve dug into the code a bit. It appears that if your
> doBeforeServeResource commits the response (by calling the flush), the
> aggregation valve doesn’t do the rendering..

the aggregation valve doesn't do the rendering without the flush
either. Aggregation valve only does not do the rendering for action
urls or resource urls: Action and Resource urls target one single
component, so there is never something to aggregate.

>
> That should do the trick! Thanks for the pointer.

I don't really get how the flush would do the trick. Afaics,
HstComponentInvokerImpl#invokeServeResource will still be called and
will dispatch to some renderer. Perhaps the output to the browser is
correct but I wouldn't be surprised if some warnings are logged.

Personally I think your use case should be tackled by a custom
pipeline that ends with something like 'TarGZOutputtingValve'

Regards ard

>
>
>
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Jeroen
> Reijn
> Sent: dinsdag 8 januari 2013 19:08
> To: Hippo CMS 7 development public mailinglist
> Subject: Re: [Hippo-cms7-user] A component that renders output from the
> component and doesn't use a template.
>
>
>
> Have you looked at the doBeforeServeResource method? I think it does what
> you want it to do.
>
> Sent from my mobile phone
>
> Op 8 jan. 2013 18:21 schreef "Wouter Danes" <[hidden email]> het
> volgende:
>
> I want to create a component that outputs a tar.gz file.
>
> Now I would like to output this from the doBeforeRender() by calling
> response.getOutpuStream().
>
>
>
> I’ve done this and done a flush() on the output stream, but I still get no
> content back. It appears that the invokeRender() is still called even though
> there is no render template specified.
>
>
>
> Is there any way to go around this without adjusting the pipeline?
>
>
>
> Met vriendelijke groet / Yours sincerely,
>
>
>
> ---
>
> Wouter Danes
>
> Competence Manager Hippo / Java / Alfresco
>
> Hinttech
>
>
>
> T: +31 6 1158 8264
>
> E: [hidden email]
>
> @wouterdanes
>
>
>
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
>
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: A component that renders output from the component and doesn't use a template.

Wouter Danes-2
At the start of the aggregation valve it checks for a committed response, if the response  is committed, it doesn't execute, right?
I'll go have a look, I do agree that the custom pipeline (or using the REST pipeline) is probably the best way to go.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Ard Schrijvers
Sent: woensdag 9 januari 2013 11:55
To: Hippo CMS 7 implementation list
Subject: Re: [Hippo-cms7-user] A component that renders output from the component and doesn't use a template.

On Tue, Jan 8, 2013 at 8:46 PM, Wouter Danes <[hidden email]> wrote:
> Ah, I've dug into the code a bit. It appears that if your
> doBeforeServeResource commits the response (by calling the flush), the
> aggregation valve doesn't do the rendering..

the aggregation valve doesn't do the rendering without the flush either. Aggregation valve only does not do the rendering for action urls or resource urls: Action and Resource urls target one single component, so there is never something to aggregate.

>
> That should do the trick! Thanks for the pointer.

I don't really get how the flush would do the trick. Afaics, HstComponentInvokerImpl#invokeServeResource will still be called and will dispatch to some renderer. Perhaps the output to the browser is correct but I wouldn't be surprised if some warnings are logged.

Personally I think your use case should be tackled by a custom pipeline that ends with something like 'TarGZOutputtingValve'

Regards ard

>
>
>
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Jeroen Reijn
> Sent: dinsdag 8 januari 2013 19:08
> To: Hippo CMS 7 development public mailinglist
> Subject: Re: [Hippo-cms7-user] A component that renders output from
> the component and doesn't use a template.
>
>
>
> Have you looked at the doBeforeServeResource method? I think it does
> what you want it to do.
>
> Sent from my mobile phone
>
> Op 8 jan. 2013 18:21 schreef "Wouter Danes"
> <[hidden email]> het
> volgende:
>
> I want to create a component that outputs a tar.gz file.
>
> Now I would like to output this from the doBeforeRender() by calling
> response.getOutpuStream().
>
>
>
> I've done this and done a flush() on the output stream, but I still
> get no content back. It appears that the invokeRender() is still
> called even though there is no render template specified.
>
>
>
> Is there any way to go around this without adjusting the pipeline?
>
>
>
> Met vriendelijke groet / Yours sincerely,
>
>
>
> ---
>
> Wouter Danes
>
> Competence Manager Hippo / Java / Alfresco
>
> Hinttech
>
>
>
> T: +31 6 1158 8264
>
> E: [hidden email]
>
> @wouterdanes
>
>
>
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
>
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Ard
Reply | Threaded
Open this post in threaded view
|

Re: A component that renders output from the component and doesn't use a template.

Ard
On Wed, Jan 9, 2013 at 12:31 PM, Wouter Danes <[hidden email]> wrote:
> At the start of the aggregation valve it checks for a committed response, if the response  is committed, it doesn't execute, right?

Ah I see it also checks for committed, but without being committed it
wouldn't render for a resource url any way because the second check is
'requestContext.getBaseURL().getResourceWindowReferenceNamespace() ==
null' which does not hold.

> I'll go have a look, I do agree that the custom pipeline (or using the REST pipeline) is probably the best way to go.

A rest call that output what you need is indeed preferable imo

Regards Ard

>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Ard Schrijvers
> Sent: woensdag 9 januari 2013 11:55
> To: Hippo CMS 7 implementation list
> Subject: Re: [Hippo-cms7-user] A component that renders output from the component and doesn't use a template.
>
> On Tue, Jan 8, 2013 at 8:46 PM, Wouter Danes <[hidden email]> wrote:
>> Ah, I've dug into the code a bit. It appears that if your
>> doBeforeServeResource commits the response (by calling the flush), the
>> aggregation valve doesn't do the rendering..
>
> the aggregation valve doesn't do the rendering without the flush either. Aggregation valve only does not do the rendering for action urls or resource urls: Action and Resource urls target one single component, so there is never something to aggregate.
>
>>
>> That should do the trick! Thanks for the pointer.
>
> I don't really get how the flush would do the trick. Afaics, HstComponentInvokerImpl#invokeServeResource will still be called and will dispatch to some renderer. Perhaps the output to the browser is correct but I wouldn't be surprised if some warnings are logged.
>
> Personally I think your use case should be tackled by a custom pipeline that ends with something like 'TarGZOutputtingValve'
>
> Regards ard
>
>>
>>
>>
>> From: [hidden email]
>> [mailto:[hidden email]] On Behalf Of
>> Jeroen Reijn
>> Sent: dinsdag 8 januari 2013 19:08
>> To: Hippo CMS 7 development public mailinglist
>> Subject: Re: [Hippo-cms7-user] A component that renders output from
>> the component and doesn't use a template.
>>
>>
>>
>> Have you looked at the doBeforeServeResource method? I think it does
>> what you want it to do.
>>
>> Sent from my mobile phone
>>
>> Op 8 jan. 2013 18:21 schreef "Wouter Danes"
>> <[hidden email]> het
>> volgende:
>>
>> I want to create a component that outputs a tar.gz file.
>>
>> Now I would like to output this from the doBeforeRender() by calling
>> response.getOutpuStream().
>>
>>
>>
>> I've done this and done a flush() on the output stream, but I still
>> get no content back. It appears that the invokeRender() is still
>> called even though there is no render template specified.
>>
>>
>>
>> Is there any way to go around this without adjusting the pipeline?
>>
>>
>>
>> Met vriendelijke groet / Yours sincerely,
>>
>>
>>
>> ---
>>
>> Wouter Danes
>>
>> Competence Manager Hippo / Java / Alfresco
>>
>> Hinttech
>>
>>
>>
>> T: +31 6 1158 8264
>>
>> E: [hidden email]
>>
>> @wouterdanes
>>
>>
>>
>>
>> _______________________________________________
>> Hippo-cms7-user mailing list and forums
>> http://www.onehippo.org/cms7/support/forums.html
>>
>>
>> _______________________________________________
>> Hippo-cms7-user mailing list and forums
>> http://www.onehippo.org/cms7/support/forums.html
>
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam Boston - 1 Broadway, Cambridge, MA 02142
>
> US +1 877 414 4776 (toll free)
> Europe +31(0)20 522 4466
> www.onehippo.com
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html