SPATIUM Mobile
주소복사
About Operating System Languages Tools Favorites Notice Visit TEST  
     ADK (3)
     android (3)
     ASP (5)
     ASP.Net (1)
     C# (5)
     HTML (9)
     JAVA (7)
     JavaScript (9)
     jQuery (5)
     Mobile Web (2)
     node.js (1)
     Oracle (8)
     PHP (7)
     Spring Framework (4)
     SQL (17)
     WPF (5)
   ID  
   Password  
  |  
  Location United States
  IP Address 3.147.52.135
2024. 10
12345
6789101112
13141516171819
20212223242526
272829
30
31
Category  Languages, JAVA
Writer 김태우 Date 2016-02-12 16:31:09 Visit 2732
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