Search Results for 'Cloud/Google App Engine'


1 POSTS

  1. 2011/03/26 RESTfull 서비스 소개 by 산사랑

RESTfull 서비스 소개

웹서비스를 구현하는 방식은 SOAP과 REST 방식이 있습니다. 그중 REST 방식은 간단하게 구현할 수 있어서 많이 사용되는 방식 입니다.

REST와 RESTfull 서비스에 대해서 간단하게 정리를 하였고 JAX-RS를 소개 하고 있습니다.

RESTfull

  • REST (REspresentational State Transfer)
  • URI를 통해 Resource를 요청하고 이를 통해 표현 상태의 변경을 유발하는 통신 Architecture
  • REST 방식의 웹서비스는 세션을 사용하지 않습니다.
  • RESTfull : REST 개변에 충실하게 구현된 웹 Application과 구조
Resource GET
조회
PUT
수정
POST
등록
DELETE
삭제
Collection URI
http://localhost/resources
자료 목록 반환 전체 자료 수정 새로운 자료 생성 전체 자료 삭제
Element URI
http://localhost/resources/123
지정한 자료 반환 지정한 자료 수정/생성 새로운 자료 생성 지정한 자료 삭제
  • JAX-RS
  • JSR-311, Java Annotation API
  • Java API for RESTfull Web Services (2007 ~)
  • 구현체
  • JAX-RS Annotations
  • @Path : 리소스에 대한 접근 경로
  • @GET, @POST, @PUT, @DELETE : Http Request Method
  • @Produces : 반환하는 데이터의 미디어 타입 (XML, JSON)
  • @Consumes : 요청 데이터의 미디어 타입
  • URI matrix parameter
  • Parameter type
  • public static valueOf(String), public static fromString(String)
  • List<T>, Set<T>, SortedSet<T>
  • JAX-RS Sample
@Path("widgets")
@Produces("application/xml")
public class WidgetsResource {
@GET
@Path("offers")
public WidgetList getDiscounted() {
}

//--- Sub-resource Method, 요청을 직접 처리
@GET
@Path("offers/{id}")
@Consumes("application/json")
public Widget findWidget(@QueryParam("id") String id) {
}

@GET
@Produces("text/html")
public String getAsHtml() {
}

//--- Sub-resource Locator, 요청을 처리할 객체를 반환
//--- @GET과 같은 Request Method 지정 어노테이션을 반드시 생략할 것
@Path("offers/{id}")
public WidgetResource findWidget(@QueryParam("id") String id) {
return new WidgetResource(id);
}
}

public class WidgetResource {
public WidgetResource(String id) {
}

@Get
public Widget getDetails() {
}
}
  • Restlet 설정
  • GAE/J(Google App Engine for Java)에 restlet 환경을 설정해 보자.
  • 다운로드 사이트에서 restlet-1.1.10.zip 파일을 다운로드 한다.
  • restlet-1.1.10.zip 파일의 압축을 풀어 lib 디렉토리에 있는 jar 파일을 GAE/J 애플리케이션의 /war/WEB-INF/lib 디렉토리로 복사 한다.
  • 참고 문헌

*** 참고 문헌 ***

Posted by 산사랑

2011/03/26 09:10 2011/03/26 09:10
, , , , , ,
Response
No Trackback , No Comment
RSS :
http://www.jopenbusiness.com/tc/oss/rss/response/318

Trackback URL : http://www.jopenbusiness.com/tc/oss/trackback/318

Leave a comment
[로그인][오픈아이디란?]

블로그 이미지

개인적인 글쓰기와 오픈소스 비즈니스 컨설팅 관련 글을 정리합니다. consult (골뱅이) jopenbusiness.com

- 산사랑

Archives

12명이 RSS를 구독하고 있습니다.

Site Stats

Total hits:
518475
Today:
127
Yesterday:
342

*** 방문자 통계 ***
0518 : (194)
0519 : (179)
0520 : (220)
0521 : (275)
0522 : (337)
0523 : (395)
0524 : (342)
0525 : (127)
7일간 총 방문자수 : 1942