You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kevjay <ke...@gmail.com> on 2012/01/25 22:55:52 UTC

How to get actual data from ByteArrayResource

I have a ByteArrayResource where I have overridden getData (RSS feed).  I
have no problem accessing this through the browser and seeing my content. 
However, I want to "inject" this in an actual page via Label for debugging
purposes.  I've tried getting a hold of the actual data a number of ways
like the following in a Panel:

ResourceReference resourcesReference = new RSSReference();
Attributes attrs = new Attributes(getRequestCycle().getRequest(),
getRequestCycle().getResponse()); 
resourceReference.getResource().respond(attrs); 
String test = null;
getRequestCycle().getResponse().write(test);

However, nothing seems to work.  Any help is greatly appreciated!  I'm using
wicket 1.5.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-actual-data-from-ByteArrayResource-tp4328722p4328722.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: How to get actual data from ByteArrayResource

Posted by kevjay <ke...@gmail.com>.
Thanks Martin!  I should have been more clear that my app is actually
creating the RSS which is why I want to display it one of my Panels for
debug purposes.  Anyways, your code below helped me finally get my solution. 
It didn't like StringResponse, but ByteArrayResponse worked just fine:

ResourceReference resourceReference = new RSSReference();    
ByteArrayResponse tmpResponse = new ByteArrayResponse(); 
Attributes attrs = new Attributes(getRequestCycle().getRequest(),
tmpResponse); 
resourceReference.getResource().respond(attrs);
String rss = new String(tmpResponse.getBytes());

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-actual-data-from-ByteArrayResource-tp4328722p4331308.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: How to get actual data from ByteArrayResource

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

I think it will be easier for you to just get the RSS from your
service (the way you give it to ByteArrayResource).
But it is possible with your approach as well (see below).

On Wed, Jan 25, 2012 at 11:55 PM, kevjay <ke...@gmail.com> wrote:
> I have a ByteArrayResource where I have overridden getData (RSS feed).  I
> have no problem accessing this through the browser and seeing my content.
> However, I want to "inject" this in an actual page via Label for debugging
> purposes.  I've tried getting a hold of the actual data a number of ways
> like the following in a Panel:
>
> ResourceReference resourcesReference = new RSSReference();

StringResponse tmpResponse = new StringResponse();
Attributes attrs = new Attributes(getRequestCycle().getRequest(), tmpResponse);

> resourceReference.getResource().respond(attrs);
> String test = null;
> getRequestCycle().getResponse().write(test);

rss = tmpResponse.getBuffer();

>
> However, nothing seems to work.  Any help is greatly appreciated!  I'm using
> wicket 1.5.
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-actual-data-from-ByteArrayResource-tp4328722p4328722.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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