You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Rahman USTA <ra...@gmail.com> on 2012/01/26 12:29:10 UTC

Wicket as a RESTful Client

Hi, i' ve built a RESTful application with JAX-RS, then i normally access
the web service via CURL in Command Line.

Example codes are such as ;
-------------------

@rem XML representation of all the books
@rem curl -X GET -H "Accept: application/xml"
http://localhost:8080/Rest/rs/items/books

@rem JSon representation of all the books
@rem curl -X GET -H "Accept: application/json"
http://localhost:8080/Rest/rs/items/books

@rem Create a book
@rem curl -X POST --data-binary "{ \"title\":\"H3G3\", \"price\":\"24.0\",
\"description\":\"3rd Scifi IT book\", \"illustrations\":\"false\",
\"isbn\":\"134-234\", \"nbOfPage\":\"241\" }" -H "Content-Type:
application/json" -H "Accept: application/json"
http://localhost:8080/Rest/rs/items/book
--------------------

How can i request to web services like above in Wicket with its own library.




-- 
Rahman USTA
0-(531)-922-28-05
www.kodcu.com

Re: Wicket as a RESTful Client

Posted by Rahman USTA <ra...@gmail.com>.
Can't i do this bu using ;

public class RestfulPage extends WebPage{
    @Override
    protected void configureResponse(WebResponse response) {
       super.configureResponse(response);    //To change body of overridden
methods use File | Settings | File Templates.
       response.sendRedirect("
http://localhost:8080/KodcuComRESTful/kodcuRS/yazilar");
       response.addHeader("accept","application/json");
    }
}

Maybe it is not probable make it in Wicket's own library. I think wicket
can do this. For example i couldnt find change the medhod state to "POST"
or  anything.

2012/1/26 Martin Grigorov <mg...@apache.org>

> This is a strange architecture but ...
> You can use Apache HttpClient, or URL("http://...").openConnection()
> or Ning's AsyncHttpClient to request the REST service.
> With these you can get/update/delete the resources (XML, JSON, ...),
> after that you have to decide how to show it.
>
> On Thu, Jan 26, 2012 at 1:29 PM, Rahman USTA <ra...@gmail.com>
> wrote:
> > Hi, i' ve built a RESTful application with JAX-RS, then i normally access
> > the web service via CURL in Command Line.
> >
> > Example codes are such as ;
> > -------------------
> >
> > @rem XML representation of all the books
> > @rem curl -X GET -H "Accept: application/xml"
> > http://localhost:8080/Rest/rs/items/books
> >
> > @rem JSon representation of all the books
> > @rem curl -X GET -H "Accept: application/json"
> > http://localhost:8080/Rest/rs/items/books
> >
> > @rem Create a book
> > @rem curl -X POST --data-binary "{ \"title\":\"H3G3\",
> \"price\":\"24.0\",
> > \"description\":\"3rd Scifi IT book\", \"illustrations\":\"false\",
> > \"isbn\":\"134-234\", \"nbOfPage\":\"241\" }" -H "Content-Type:
> > application/json" -H "Accept: application/json"
> > http://localhost:8080/Rest/rs/items/book
> > --------------------
> >
> > How can i request to web services like above in Wicket with its own
> library.
> >
> >
> >
> >
> > --
> > Rahman USTA
> > 0-(531)-922-28-05
> > www.kodcu.com
>
>
>
> --
> 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
>
>


-- 
Rahman USTA
0-(531)-922-28-05
www.kodcu.com

Re: Wicket as a RESTful Client

Posted by Martin Grigorov <mg...@apache.org>.
This is a strange architecture but ...
You can use Apache HttpClient, or URL("http://...").openConnection()
or Ning's AsyncHttpClient to request the REST service.
With these you can get/update/delete the resources (XML, JSON, ...),
after that you have to decide how to show it.

On Thu, Jan 26, 2012 at 1:29 PM, Rahman USTA <ra...@gmail.com> wrote:
> Hi, i' ve built a RESTful application with JAX-RS, then i normally access
> the web service via CURL in Command Line.
>
> Example codes are such as ;
> -------------------
>
> @rem XML representation of all the books
> @rem curl -X GET -H "Accept: application/xml"
> http://localhost:8080/Rest/rs/items/books
>
> @rem JSon representation of all the books
> @rem curl -X GET -H "Accept: application/json"
> http://localhost:8080/Rest/rs/items/books
>
> @rem Create a book
> @rem curl -X POST --data-binary "{ \"title\":\"H3G3\", \"price\":\"24.0\",
> \"description\":\"3rd Scifi IT book\", \"illustrations\":\"false\",
> \"isbn\":\"134-234\", \"nbOfPage\":\"241\" }" -H "Content-Type:
> application/json" -H "Accept: application/json"
> http://localhost:8080/Rest/rs/items/book
> --------------------
>
> How can i request to web services like above in Wicket with its own library.
>
>
>
>
> --
> Rahman USTA
> 0-(531)-922-28-05
> www.kodcu.com



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