SPATIUM Mobile
주소복사
About Operating System Languages Tools Favorites Notice Visit TEST  
     Android (3)
     Linux (1)
     MacOS (1)
     OS (1)
     Solaris10 (15)
     Windows (1)
     Windows Server (2)
     Windows XP (3)
   ID  
   Password  
  |  
  Location United States
  IP Address 18.118.184.237
2024. 04
123456
78910111213
14151617181920
21222324
25
2627
282930
Category  Languages, JAVA
Writer 김태우 Date 2016-02-12 16:31:09 Visit 2576
REST Service

 

REST Service

 

Request : 3Tier Architecture

  => Client Tier(Java Server, c# Application), BusinessLogic Tier(REST Web), Database Tier(Oracle)

Env : JDK1.8, Tomcat8, Eclipse, Gradle, SpringFrame4

 



 

Client Tier(JavaServer) : User RestTemplate in SpringFramework4

 

 

 



 

BusinessLogic Tier(REST Web) : Use the @RestController in SprinFramework4

Ref : https://spring.io/guides/gs/rest-service/

src/main/java/hello/GreetingController.java

package hello;

import java.util.concurrent.atomic.AtomicLong;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class GreetingController {

    private static final String template = "Hello, %s!";
    private final AtomicLong counter = new AtomicLong();

    @RequestMapping("/greeting")
    public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) {
        return new Greeting(counter.incrementAndGet(),
                            String.format(template, name));
    }
}

 

 

 

Tags  3Tier Architecture, Client Tier, BusinessLogic Tie
  Relation Articles
[Languages-JAVA] REST Service (2016-02-12 16:31:09)
  Your Opinion
Member ID
150 letters
Copyright (C) SPATIUM. All rights reserved.
[SPATIUM]WebMaster Mail