You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Rodrigo Heffner <ro...@gmail.com> on 2012/09/18 16:01:32 UTC

StringRequestTarget migration question

Hi,

I'm migrating an application from wicket 1.4 to 6.0 . What should I use to
replace "setRequestTarget" and the StringRequestTarget? Here's the piece of
code where it's used:

// this is added to a page...

new AbstractAjaxBehavior() {

   public void onRequest() {
      final RequestCycle requestCycle = RequestCycle.get();

     JSONObject object = new JSONObject();
     // logic putting properties in the JSON object

      requestCycle.setRequestTarget(new
StringRequestTarget("application/json", "utf-8", object.toString())); *//
Not sure how this will look on 6.0*
   }
};

Thank you.

-- 
Rodrigo H M Bezerra

Re: StringRequestTarget migration question

Posted by Rodrigo Heffner <ro...@gmail.com>.
Ok, finally managed to run the page affected by the code and it's working
as expected.

Thanks!

On 18 September 2012 15:35, Martin Grigorov <mg...@apache.org> wrote:

> See TextRequestHandler too.
>
> On Tue, Sep 18, 2012 at 5:18 PM, Rodrigo Heffner
> <ro...@gmail.com> wrote:
> > Thanks, Decebal!
> >
> > I removed an extra "{" after the ByteArrayResource - it's looking like
> this
> > now:
> >
> > String jsonData = object.toString();
> > IResource jsonResource = new ByteArrayResource("text/plain",
> > jsonData.getBytes());
> > IRequestHandler requestHandler = new ResourceRequestHandler(jsonResource,
> > null);
> > requestHandler.respond(getRequestCycle());
> >
> > ... and I removed the StringRequestTarget line. The compiler isn't
> > complaining so I'm hoping this will work, but I'll be able to test
> > functionally only in few hours.
> >
> > Thanks again.
> >
> > On 18 September 2012 15:07, Decebal Suiu <de...@asf.ro> wrote:
> >
> >> Hi
> >>
> >> Try (wicket 1.5 but I think that works for wicket 6):
> >>     String jsonData = object.toString()
> >>     IResource jsonResource = new ByteArrayResource("text/plain",
> >> jsonData.getBytes()) {
> >>     IRequestHandler requestHandler = new
> >> ResourceRequestHandler(jsonResource, null);
> >>     requestHandler.respond(getRequestCycle());
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://apache-wicket.1842946.n4.nabble.com/StringRequestTarget-migration-question-tp4652110p4652111.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
> >>
> >>
> >
> >
> > --
> > Rodrigo H M Bezerra
>
>
>
> --
> 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
>
>


-- 
Rodrigo H M Bezerra

Re: StringRequestTarget migration question

Posted by Martin Grigorov <mg...@apache.org>.
See TextRequestHandler too.

On Tue, Sep 18, 2012 at 5:18 PM, Rodrigo Heffner
<ro...@gmail.com> wrote:
> Thanks, Decebal!
>
> I removed an extra "{" after the ByteArrayResource - it's looking like this
> now:
>
> String jsonData = object.toString();
> IResource jsonResource = new ByteArrayResource("text/plain",
> jsonData.getBytes());
> IRequestHandler requestHandler = new ResourceRequestHandler(jsonResource,
> null);
> requestHandler.respond(getRequestCycle());
>
> ... and I removed the StringRequestTarget line. The compiler isn't
> complaining so I'm hoping this will work, but I'll be able to test
> functionally only in few hours.
>
> Thanks again.
>
> On 18 September 2012 15:07, Decebal Suiu <de...@asf.ro> wrote:
>
>> Hi
>>
>> Try (wicket 1.5 but I think that works for wicket 6):
>>     String jsonData = object.toString()
>>     IResource jsonResource = new ByteArrayResource("text/plain",
>> jsonData.getBytes()) {
>>     IRequestHandler requestHandler = new
>> ResourceRequestHandler(jsonResource, null);
>>     requestHandler.respond(getRequestCycle());
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/StringRequestTarget-migration-question-tp4652110p4652111.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
>>
>>
>
>
> --
> Rodrigo H M Bezerra



-- 
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


Re: StringRequestTarget migration question

Posted by Rodrigo Heffner <ro...@gmail.com>.
Thanks, Decebal!

I removed an extra "{" after the ByteArrayResource - it's looking like this
now:

String jsonData = object.toString();
IResource jsonResource = new ByteArrayResource("text/plain",
jsonData.getBytes());
IRequestHandler requestHandler = new ResourceRequestHandler(jsonResource,
null);
requestHandler.respond(getRequestCycle());

... and I removed the StringRequestTarget line. The compiler isn't
complaining so I'm hoping this will work, but I'll be able to test
functionally only in few hours.

Thanks again.

On 18 September 2012 15:07, Decebal Suiu <de...@asf.ro> wrote:

> Hi
>
> Try (wicket 1.5 but I think that works for wicket 6):
>     String jsonData = object.toString()
>     IResource jsonResource = new ByteArrayResource("text/plain",
> jsonData.getBytes()) {
>     IRequestHandler requestHandler = new
> ResourceRequestHandler(jsonResource, null);
>     requestHandler.respond(getRequestCycle());
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/StringRequestTarget-migration-question-tp4652110p4652111.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
>
>


-- 
Rodrigo H M Bezerra

Re: StringRequestTarget migration question

Posted by Decebal Suiu <de...@asf.ro>.
Hi

Try (wicket 1.5 but I think that works for wicket 6):
    String jsonData = object.toString()
    IResource jsonResource = new ByteArrayResource("text/plain",
jsonData.getBytes()) { 
    IRequestHandler requestHandler = new
ResourceRequestHandler(jsonResource, null); 
    requestHandler.respond(getRequestCycle()); 




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/StringRequestTarget-migration-question-tp4652110p4652111.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