Results 1 to 5 of 5

Thread: How to use RESTful Template

  1. #1

    Default How to use RESTful Template

    hi guys:

    I am new to Spring3.0. Just wondering how to use RESTfulTemplate ? I mean is the class only for test purpose ? I read the reference that it recommend using httpclient.

    Most of time our client side was only html or jsp. so how can we put httpclient in jsp or html code.

    I just feel very confusing about this.


    Thanks
    Tony

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    It isn't just for testing purposes if it was it would be part of the test jar!. You can use the RestTemplate to call REST style/based webservices and interpret the response. The RestTemplate needs something to create and call a url (rest is still HTTP), to do that it is recommended to use the httpclient library (you inject that into the RestTemplate).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    hi Marten:

    Thanks for ur reply.

    But which part call RestTemplate class, by this i mean, user only hit the webpage (jsp, html) and create the URL.

    In the traditional way, jsp -> controller -> server layer -> dataaccess layer

    If using restFul, how the flow will look like ?

    Thanks
    Tony

  4. #4
    Join Date
    Feb 2006
    Location
    Nancy, France
    Posts
    145

    Default

    jsp -> controller -> server layer -> dataaccess layer is the JSF traditionnal way.

    Spring MVC traditionnal way is :

    => controller <=> service layer <=> data access layer
    ||
    forward model
    ||
    <= JSP

    You are mixing client RestTemplate, which is just like calling a WebService and Rest Controllers, which are extracting parameters from URI instead of GET or POST parameters.
    Université Nancy 2
    France

  5. #5

    Default

    hi guys:

    Thanks for ur reply. could u give me a simple example ?

    like i have a jsp page, when i click a submit button and then it will fire a Spring Controller.


    Thanks
    Tony

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •