[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[jfriends-ml 13536] 「 Jav による RESTful システム構築」を読む会第 2 回議事録
- From: nemo10 <nemo10@xxxxxxxxx>
- Date: Mon, 27 Jun 2011 09:22:39 +0900
- Authentication-results: iron01-mds.s.noc.itscom.net; dkim=permerror (signature did not verify [final] [TEST]) header.i=@gmail.com
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type; bh=23vzVT2zFJmUj5UZwV04dwP1syF6OG0h1L1YkTAgoUk=; b=apBeT3p5bRd+yHMA8mraTKpwTP7bduriQiVtTJnNFO1P9o5qVghMyBOfN/Sz/qinh1 IxzGfeGS+LX6CGuBu5ZF861rnHSCAeisEL3nnuOvvycsWqMrrScK1vv64F3FHDNFyLhu TTAlAp/+F7zpUqkobViA0SEn2lBReZRO1pqvo=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; b=rq4p1juvk1qfY4TJchEkiuPWPHmGrzS7hScklQhoGbHxVN2Q61jSCaodkzaoOm2HCy Y6btH0iFhsxyeQjIERsyw40/w4QMBccc1y82lU1Lv30xVm+hI+lbadSErylxTEf8qHvt B/vu2icz+0/7s8t8NB582FnDFua+EmKdfLPrU=
皆様
第2回議事録をお送りします。
よろしくお願いします。
根本
2011N0625ú yjú
QÁÒ ´(O)@åe@´(q)@Vì@¼i@ª{@ºR@âº@g{@÷ä@¡ä@¡@ª{(L)
P33 ÚqÌXV@æè
3.1.3 JAX-RSÆJavaC^[tFCX
P37 ºLªÌu·×ÄÌÄè`vÆͽÌWÅÜÁ½±ÆÈÌ©?
JAX-RSC[©?
JAX-RSÌdlðmFANXPÊÅKv¾©ç©?
----------------------------------------------------
public class CustomerResourceService implements CustomerResource {@POST
@Consumes("application/xml;charset=utf-8") public Response createCustomer(InputStream is) {
... À ...
}
±ÌáÅÍA 1ÂÌÁèÌ\bhÉεÄC^[tFCXÅè`³ê½^f[^ðI[oCh ·é±ÆÉÈéB\bhÉηé^f[^ðI[oCh·éêAÏXÎÛª 1¾¯¾ÆµÄàA »Ì\bhÉηé·×ÄÌAme[V^f[^ÌÄwèªKvÉÈéB
----------------------------------------------------
P42 ºLweb.xmlÉ¢Ä
com.jaxrs.vendor.JaxrsVendorServlet ÉæÁÄinitparamªá¤àÌÉÈé͸
----------------------------------------------------
<?xml version="1.0"?>
<web-app>
<display-name>Archetype Created Web Application</display-name> <servlet>
<servlet-name>Rest</servlet-name>
<servlet-class>
com.jaxrs.vendor.JaxrsVendorServlet <-- T[ubgè`
</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name> <param-value> <--±Ì¼OÍJAX-RSÉæÁÄÜÁÄ¢é
com.restfully.shop.services.ShoppingApplication </param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Rest</servlet-name> <-- T[ubgÀ
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
----------------------------------------------------
3Íɱ¢ÄA15ÍÉòñÅÇÞ±ÆÆ·éB
15ÍÍA3ÍÉηénYI̽ßB
JettyÍMavenªT|[g·éÌ©
pom.xml Í antÌbuild.xml Ư¶àÌ
pom.xml Íg¢É¢Apom.xmlªÜÆàɯélª¢È¢
p221 pom.xmlÌá Legacy layoutÆͽ©?
----------------------------------------------------
<name/>
<description/><repositories>
<repository>
<id>java.net</id>
<url>http://download.java.net/maven/1</url>
<layout>legacy</layout> <-- legacyCAEgÆͽ©
</repository>
<repository>
<id>maven repo</id>
<name>maven repo</name>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<!-- For resteasy -->
<repository>
<id>jboss</id>
<name>jboss repo</name>
<url>http://repository.jboss.org/maven2</url>
</repository>
</repositories>
----------------------------------------------------
4Í HTTP\bhÆURI}b`O
4.1 HTTP\bhÌoCh
JAX-RSÌW^Ame[V
@javax.ws.rs.GET
@javax.ws.rs.PUT
@javax.ws.rs.POST
@javax.ws.rs.DELETE
@javax.ws.rs.HEAD
^Ame[VÌ¿lÍAPUT POST GET DELTEÌWHTTP\bhðg£µÄÆ©ÈAme[Vðìé½ßB
á¦Î MOVEACOPYAMKCOLALOCKAUNLOCK ÈÇ© è¦éB
µ©µ±Ìæ¤É©RÉg£µÄµÜÁÄA±êÅRESTfulÆ¢¦éÌ©B
4.2.3}gbNXp[^
ºL\LÅ /e55Ì ÅÌ/Í ÁÄàÈÄàÎpXµ¢çµ¢B
----------------------------------------------------
@Path("/mercedes")
public class MercedesService {@GET
@Path("/e55/{year}")
@Produces("image/jpeg")
public Jpeg getE55Picture(@PathParam("year") String year) {
...
}
----------------------------------------------------
fBNg¼ªú{êÌêA¶R[hÍKè³êÄ¢éÌ©? s¾B
17Í
4ÍÌTvR[h
@PATCH Ame[V Ì¿lªí©çÈ¢A±êÍóÔðÂÌÅÍȢ̩B
5Í JAX-RSCWFNV
5.1 î{ JAX-RSAme[VÅCWFNgÅ«éÎÛÍ¡¶Ý·éB
JAX-RSdlªKè·éCWFN VAme[VðȺɦ·B
@javax.ws.rs.PathParam
@javax.ws.rs.MatrixParam
@javax.ws.rs.QueryParam
@javax.ws.rs.FormParam
@javax.ws.rs.HeaderParam
@javax.ws.rs.CookieParam
@javax.ws.rs.core.Context
5.2 @PathParam
5.3 @MatrixParam
----------------------------------------------------
@Path("/{make}") <-- ±±ª cars/{make} ÉÈÁĢȢÌÍëA©?
public class CarResource {@GET
@Path("/{model}/{year}")
@Produces("image/jpeg")
public Jpeg getPicture(@PathParam("make") String make,
@PathParam("model") String model, @MatrixParam("color") String color) { ...
}
----------------------------------------------------
ßèlÍÐÆÂ
RNV
ºLR[hÌ List<String>̪ªCÉÈéA
Integerðè`µ½êA®ì·éÌ©B
----------------------------------------------------
import java.util.List;
@Path("/customers")
public class CustomerResource {@GET
@Produces("application/xml")
public String getCustomers(
@QueryParam("start") int start, @QueryParam("size") int size,
@QueryParam("orderBy") List<String> orderBy) { ...
}
}
----------------------------------------------------
øÅGenericÍæêé© getTypeParametersª éªæêéÌÍgeneric methodÌ^p[^µ©ªçÈ¢ÌÅÍȢ̩B
getGenericParameterTypes Å Typeæ¾Å«È¢©B
JAX-RS © ServletFilterÅ 400 Bad RequestðÐÁ©¯½çÖÅÍÈ¢©B
5ͪIíÁÄA»ÌTvÌ 18ÍðÇÝAñÍ6Í©çB
Èã