You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2016/10/07 16:33:47 UTC
[05/11] incubator-juneau git commit: JUNEAU-16 - Support for Swagger
documentation
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/main/java/org/apache/juneau/server/test/NlsResource.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/java/org/apache/juneau/server/test/NlsResource.java b/juneau-server-test/src/main/java/org/apache/juneau/server/test/NlsResource.java
index 1929a15..074a410 100755
--- a/juneau-server-test/src/main/java/org/apache/juneau/server/test/NlsResource.java
+++ b/juneau-server-test/src/main/java/org/apache/juneau/server/test/NlsResource.java
@@ -40,7 +40,7 @@ public class NlsResource extends RestServletGroupDefault {
@RestResource(
path="/test1",
messages="NlsResource",
- label="Test1.a",
+ title="Test1.a",
description="Test1.b"
)
public static class Test1 extends RestServletDefault {
@@ -48,28 +48,27 @@ public class NlsResource extends RestServletGroupDefault {
@RestMethod(
name="POST", path="/{a}",
description="Test1.c",
- input={
- @Var(category="attr", name="a", description="Test1.d"),
- @Var(category="param", name="b", description="Test1.e"),
- @Var(category="content", description="Test1.f"),
- @Var(category="header", name="D", description="Test1.g"),
- @Var(category="attr", name="a2", description="Test1.h"),
- @Var(category="param", name="b2", description="Test1.i"),
- @Var(category="header", name="D2", description="Test1.j"),
- @Var(category="foo", name="bar", description="Test1.k"),
+ parameters={
+ @Var(in="path", name="a", description="Test1.d"),
+ @Var(in="query", name="b", description="Test1.e"),
+ @Var(in="body", description="Test1.f"),
+ @Var(in="header", name="D", description="Test1.g"),
+ @Var(in="path", name="a2", description="Test1.h"),
+ @Var(in="query", name="b2", description="Test1.i"),
+ @Var(in="header", name="D2", description="Test1.j"),
},
responses={
@Response(200),
@Response(value=201,
description="Test1.l",
- output={
- @Var(category="foo", name="bar", description="Test1.m"),
+ headers={
+ @Var(in="foo", name="bar", description="Test1.m"),
}
)
}
)
- public String test1(@Attr("a") String a, @Param("b") String b, @Content String c, @Header("D") String d,
- @Attr("e") String e, @Param("f") String f, @Header("g") String g) {
+ public String test1(@Path("a") String a, @Query("b") String b, @Body String c, @Header("D") String d,
+ @Path("e") String e, @Query("f") String f, @Header("g") String g) {
return null;
}
}
@@ -86,8 +85,8 @@ public class NlsResource extends RestServletGroupDefault {
@RestMethod(
name="POST", path="/{a}"
)
- public String test2(@Attr("a") String a, @Param("b") String b, @Content String c, @Header("D") String d,
- @Attr("e") String e, @Param("f") String f, @Header("g") String g) {
+ public String test2(@Path("a") String a, @Query("b") String b, @Body String c, @Header("D") String d,
+ @Path("e") String e, @Query("f") String f, @Header("g") String g) {
return null;
}
}
@@ -104,8 +103,8 @@ public class NlsResource extends RestServletGroupDefault {
@RestMethod(
name="POST", path="/{a}"
)
- public String test3(@Attr("a") String a, @Param("b") String b, @Content String c, @Header("D") String d,
- @Attr("e") String e, @Param("f") String f, @Header("g") String g) {
+ public String test3(@Path("a") String a, @Query("b") String b, @Body String c, @Header("D") String d,
+ @Path("e") String e, @Query("f") String f, @Header("g") String g) {
return null;
}
@@ -129,8 +128,8 @@ public class NlsResource extends RestServletGroupDefault {
@RestMethod(
name="POST", path="/{a}"
)
- public String test4(@Attr("a") String a, @Param("b") String b, @Content String c, @Header("D") String d,
- @Attr("e") String e, @Param("f") String f, @Header("g") String g) {
+ public String test4(@Path("a") String a, @Query("b") String b, @Body String c, @Header("D") String d,
+ @Path("e") String e, @Query("f") String f, @Header("g") String g) {
return null;
}
}
@@ -147,8 +146,8 @@ public class NlsResource extends RestServletGroupDefault {
@RestMethod(
name="POST", path="/{a}"
)
- public String test5(@Attr("a") String a, @Param("b") String b, @Content String c, @Header("D") String d,
- @Attr("e") String e, @Param("f") String f, @Header("g") String g) {
+ public String test5(@Path("a") String a, @Query("b") String b, @Body String c, @Header("D") String d,
+ @Path("e") String e, @Query("f") String f, @Header("g") String g) {
return null;
}
}
@@ -159,7 +158,7 @@ public class NlsResource extends RestServletGroupDefault {
@RestResource(
path="/test6",
messages="NlsResource",
- label="$L{foo}",
+ title="$L{foo}",
description="$L{foo}"
)
public static class Test6 extends RestServletDefault {
@@ -167,28 +166,27 @@ public class NlsResource extends RestServletGroupDefault {
@RestMethod(
name="POST", path="/{a}",
description="$L{foo}",
- input={
- @Var(category="attr", name="a", description="$L{foo}"),
- @Var(category="param", name="b", description="$L{foo}"),
- @Var(category="content", description="$L{foo}"),
- @Var(category="header", name="D", description="$L{foo}"),
- @Var(category="attr", name="a2", description="$L{foo}"),
- @Var(category="param", name="b2", description="$L{foo}"),
- @Var(category="header", name="D2", description="$L{foo}"),
- @Var(category="foo", name="bar", description="$L{foo}"),
+ parameters={
+ @Var(in="path", name="a", description="$L{foo}"),
+ @Var(in="query", name="b", description="$L{foo}"),
+ @Var(in="body", description="$L{foo}"),
+ @Var(in="header", name="D", description="$L{foo}"),
+ @Var(in="path", name="a2", description="$L{foo}"),
+ @Var(in="query", name="b2", description="$L{foo}"),
+ @Var(in="header", name="D2", description="$L{foo}")
},
responses={
@Response(200),
@Response(value=201,
description="$L{foo}",
- output={
- @Var(category="foo", name="bar", description="$L{foo}"),
+ headers={
+ @Var(in="foo", name="bar", description="$L{foo}"),
}
)
}
)
- public String test6(@Attr("a") String a, @Param("b") String b, @Content String c, @Header("D") String d,
- @Attr("e") String e, @Param("f") String f, @Header("g") String g) {
+ public String test6(@Path("a") String a, @Query("b") String b, @Body String c, @Header("D") String d,
+ @Path("e") String e, @Query("f") String f, @Header("g") String g) {
return null;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/main/java/org/apache/juneau/server/test/NoParserInputResource.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/java/org/apache/juneau/server/test/NoParserInputResource.java b/juneau-server-test/src/main/java/org/apache/juneau/server/test/NoParserInputResource.java
index 66a9170..4a1b072 100755
--- a/juneau-server-test/src/main/java/org/apache/juneau/server/test/NoParserInputResource.java
+++ b/juneau-server-test/src/main/java/org/apache/juneau/server/test/NoParserInputResource.java
@@ -30,27 +30,27 @@ public class NoParserInputResource extends RestServlet {
private static final long serialVersionUID = 1L;
//====================================================================================================
- // @Content annotated InputStream.
+ // @Body annotated InputStream.
//====================================================================================================
@RestMethod(name="PUT", path="/testInputStream")
- public String testInputStream(@Content InputStream in) throws Exception {
+ public String testInputStream(@Body InputStream in) throws Exception {
return IOUtils.read(in);
}
//====================================================================================================
- // @Content annotated Reader.
+ // @Body annotated Reader.
//====================================================================================================
@RestMethod(name="PUT", path="/testReader")
- public String testReader(@Content Reader in) throws Exception {
+ public String testReader(@Body Reader in) throws Exception {
return IOUtils.read(in);
}
//====================================================================================================
- // @Content annotated PushbackReader.
+ // @Body annotated PushbackReader.
// This should always fail since the servlet reader is not a pushback reader.
//====================================================================================================
@RestMethod(name="PUT", path="/testPushbackReader")
- public String testPushbackReader(@Content PushbackReader in) throws Exception {
+ public String testPushbackReader(@Body PushbackReader in) throws Exception {
return IOUtils.read(in);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/main/java/org/apache/juneau/server/test/OnPostCallResource.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/java/org/apache/juneau/server/test/OnPostCallResource.java b/juneau-server-test/src/main/java/org/apache/juneau/server/test/OnPostCallResource.java
index 9e4c2b7..c2f656f 100755
--- a/juneau-server-test/src/main/java/org/apache/juneau/server/test/OnPostCallResource.java
+++ b/juneau-server-test/src/main/java/org/apache/juneau/server/test/OnPostCallResource.java
@@ -35,7 +35,7 @@ import org.apache.juneau.server.annotation.*;
public class OnPostCallResource extends RestServlet {
private static final long serialVersionUID = 1L;
- @Produces({"text/s1","text/s2","text/s3"})
+ @Produces("text/s1,text/s2,text/s3")
public static class TestSerializer extends WriterSerializer {
@Override /* Serializer */
protected void doSerialize(SerializerSession session, Object o) throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/main/java/org/apache/juneau/server/test/OnPreCallResource.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/java/org/apache/juneau/server/test/OnPreCallResource.java b/juneau-server-test/src/main/java/org/apache/juneau/server/test/OnPreCallResource.java
index 69bcf21..dcbc8be 100755
--- a/juneau-server-test/src/main/java/org/apache/juneau/server/test/OnPreCallResource.java
+++ b/juneau-server-test/src/main/java/org/apache/juneau/server/test/OnPreCallResource.java
@@ -37,7 +37,7 @@ import org.apache.juneau.server.annotation.*;
public class OnPreCallResource extends RestServlet {
private static final long serialVersionUID = 1L;
- @Consumes({"text/a1","text/a2","text/a3"})
+ @Consumes("text/a1,text/a2,text/a3")
public static class TestParserA extends ReaderParser {
@SuppressWarnings("unchecked")
@Override /* Parser */
@@ -69,7 +69,7 @@ public class OnPreCallResource extends RestServlet {
@Property(name="p4",value="mp4")
}
)
- public String testPropertiesOverriddenByAnnotation(@Content String in) {
+ public String testPropertiesOverriddenByAnnotation(@Body String in) {
return in;
}
@@ -80,6 +80,6 @@ public class OnPreCallResource extends RestServlet {
public String testPropertiesOverriddenProgrammatically(RestRequest req, @Properties ObjectMap properties) throws Exception {
properties.put("p3", "pp3");
properties.put("p4", "pp4");
- return req.getInput(String.class);
+ return req.getBody(String.class);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/main/java/org/apache/juneau/server/test/OptionsWithoutNlsResource.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/java/org/apache/juneau/server/test/OptionsWithoutNlsResource.java b/juneau-server-test/src/main/java/org/apache/juneau/server/test/OptionsWithoutNlsResource.java
index fb34878..fe17127 100755
--- a/juneau-server-test/src/main/java/org/apache/juneau/server/test/OptionsWithoutNlsResource.java
+++ b/juneau-server-test/src/main/java/org/apache/juneau/server/test/OptionsWithoutNlsResource.java
@@ -12,9 +12,9 @@
// ***************************************************************************************************************************
package org.apache.juneau.server.test;
+import org.apache.juneau.dto.swagger.*;
import org.apache.juneau.server.*;
import org.apache.juneau.server.annotation.*;
-import org.apache.juneau.server.labels.*;
/**
* JUnit automated testcase resource.
@@ -29,8 +29,8 @@ public class OptionsWithoutNlsResource extends RestServletDefault {
// Should get to the options page without errors
//====================================================================================================
@RestMethod(name="OPTIONS", path="/testOptions/*")
- public ResourceOptions testOptions(RestRequest req) {
- return new ResourceOptions(this, req);
+ public Swagger testOptions(RestRequest req) {
+ return req.getSwagger();
}
//====================================================================================================
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/main/java/org/apache/juneau/server/test/ParamsResource.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/java/org/apache/juneau/server/test/ParamsResource.java b/juneau-server-test/src/main/java/org/apache/juneau/server/test/ParamsResource.java
index 9e2d339..b2cc2d1 100755
--- a/juneau-server-test/src/main/java/org/apache/juneau/server/test/ParamsResource.java
+++ b/juneau-server-test/src/main/java/org/apache/juneau/server/test/ParamsResource.java
@@ -113,108 +113,108 @@ public class ParamsResource extends RestServletDefault {
}
//====================================================================================================
- // @Param annotation - GET
+ // @FormData annotation - GET
//====================================================================================================
@RestMethod(name="GET", path="/testParamGet/*")
- public String testParamGet(RestRequest req, @Param("p1") String p1, @Param("p2") int p2) throws Exception {
+ public String testParamGet(RestRequest req, @Query("p1") String p1, @Query("p2") int p2) throws Exception {
return "p1=["+p1+","+req.getParameter("p1")+","+req.getParameter("p1", String.class)+"],p2=["+p2+","+req.getParameter("p2")+","+req.getParameter("p2", int.class)+"]";
}
//====================================================================================================
- // @Param annotation - POST
+ // @FormData annotation - POST
//====================================================================================================
@RestMethod(name="POST", path="/testParamPost/*")
- public String testParamPost(RestRequest req, @Param("p1") String p1, @Param("p2") int p2) throws Exception {
+ public String testParamPost(RestRequest req, @FormData("p1") String p1, @FormData("p2") int p2) throws Exception {
return "p1=["+p1+","+req.getParameter("p1")+","+req.getParameter("p1", String.class)+"],p2=["+p2+","+req.getParameter("p2")+","+req.getParameter("p2", int.class)+"]";
}
//====================================================================================================
- // @QParam annotation - GET
+ // @Query annotation - GET
//====================================================================================================
@RestMethod(name="GET", path="/testQParamGet/*")
- public String testQParamGet(RestRequest req, @QParam("p1") String p1, @QParam("p2") int p2) throws Exception {
+ public String testQParamGet(RestRequest req, @Query("p1") String p1, @Query("p2") int p2) throws Exception {
return "p1=["+p1+","+req.getQueryParameter("p1")+","+req.getQueryParameter("p1", String.class)+"],p2=["+p2+","+req.getQueryParameter("p2")+","+req.getQueryParameter("p2", int.class)+"]";
}
//====================================================================================================
- // @QParam annotation - POST
+ // @Query annotation - POST
//====================================================================================================
@RestMethod(name="POST", path="/testQParamPost/*")
- public String testQParamPost(RestRequest req, @QParam("p1") String p1, @QParam("p2") int p2) throws Exception {
+ public String testQParamPost(RestRequest req, @Query("p1") String p1, @Query("p2") int p2) throws Exception {
return "p1=["+p1+","+req.getQueryParameter("p1")+","+req.getQueryParameter("p1", String.class)+"],p2=["+p2+","+req.getQueryParameter("p2")+","+req.getQueryParameter("p2", int.class)+"]";
}
//====================================================================================================
- // @Param(format=PLAIN) annotation - GET
+ // @FormData(format=PLAIN) annotation - GET
//====================================================================================================
@RestMethod(name="GET", path="/testPlainParamGet/*")
- public String testPlainParamGet(RestRequest req, @Param(value="p1",format="PLAIN") String p1) throws Exception {
+ public String testPlainParamGet(RestRequest req, @Query(value="p1",format="PLAIN") String p1) throws Exception {
return "p1=["+p1+","+req.getParameter("p1")+","+req.getParameter("p1", String.class)+"]";
}
//====================================================================================================
- // @Param(format=PLAIN) annotation - POST
+ // @FormData(format=PLAIN) annotation - POST
//====================================================================================================
@RestMethod(name="POST", path="/testPlainParamPost/*")
- public String testPlainParamPost(RestRequest req, @Param(value="p1",format="PLAIN") String p1) throws Exception {
+ public String testPlainParamPost(RestRequest req, @FormData(value="p1",format="PLAIN") String p1) throws Exception {
return "p1=["+p1+","+req.getParameter("p1")+","+req.getParameter("p1", String.class)+"]";
}
//====================================================================================================
- // @QParam(format=PLAIN) annotation - GET
+ // @Query(format=PLAIN) annotation - GET
//====================================================================================================
@RestMethod(name="GET", path="/testPlainQParamGet/*")
- public String testPlainQParamGet(RestRequest req, @QParam(value="p1",format="PLAIN") String p1) throws Exception {
+ public String testPlainQParamGet(RestRequest req, @Query(value="p1",format="PLAIN") String p1) throws Exception {
return "p1=["+p1+","+req.getQueryParameter("p1")+","+req.getQueryParameter("p1", String.class)+"]";
}
//====================================================================================================
- // @QParam(format=PLAIN) annotation - POST
+ // @Query(format=PLAIN) annotation - POST
//====================================================================================================
@RestMethod(name="POST", path="/testPlainQParamPost/*")
- public String testPlainQParamPost(RestRequest req, @QParam(value="p1",format="PLAIN") String p1) throws Exception {
+ public String testPlainQParamPost(RestRequest req, @Query(value="p1",format="PLAIN") String p1) throws Exception {
return "p1=["+p1+","+req.getQueryParameter("p1")+","+req.getQueryParameter("p1", String.class)+"]";
}
//====================================================================================================
- // @HasParam annotation - GET
+ // @HasQuery annotation - GET
//====================================================================================================
@RestMethod(name="GET", path="/testHasParamGet/*")
- public String testHasParamGet(RestRequest req, @HasParam("p1") boolean p1, @HasParam("p2") Boolean p2) throws Exception {
+ public String testHasParamGet(RestRequest req, @HasQuery("p1") boolean p1, @HasQuery("p2") Boolean p2) throws Exception {
return "p1=["+p1+","+req.hasParameter("p1")+"],p2=["+p2+","+req.hasParameter("p2")+"]";
}
//====================================================================================================
- // @HasParam annotation - POST
+ // @HasQuery annotation - POST
//====================================================================================================
@RestMethod(name="POST", path="/testHasParamPost/*")
- public String testHasParamPost(RestRequest req, @HasParam("p1") boolean p1, @HasParam("p2") Boolean p2) throws Exception {
+ public String testHasParamPost(RestRequest req, @HasFormData("p1") boolean p1, @HasFormData("p2") Boolean p2) throws Exception {
return "p1=["+p1+","+req.hasParameter("p1")+"],p2=["+p2+","+req.hasParameter("p2")+"]";
}
//====================================================================================================
- // @HasQParam annotation - GET
+ // @HasQuery annotation - GET
//====================================================================================================
@RestMethod(name="GET", path="/testHasQParamGet/*")
- public String testHasQParamGet(RestRequest req, @HasQParam("p1") boolean p1, @HasQParam("p2") Boolean p2) throws Exception {
+ public String testHasQParamGet(RestRequest req, @HasQuery("p1") boolean p1, @HasQuery("p2") Boolean p2) throws Exception {
return "p1=["+p1+","+req.hasQueryParameter("p1")+"],p2=["+p2+","+req.hasQueryParameter("p2")+"]";
}
//====================================================================================================
- // @HasQParam annotation - POST
+ // @HasQuery annotation - POST
//====================================================================================================
@RestMethod(name="POST", path="/testHasQParamPost/*")
- public String testHasQParamPost_post(RestRequest req, @HasQParam("p1") boolean p1, @HasQParam("p2") Boolean p2) throws Exception {
+ public String testHasQParamPost_post(RestRequest req, @HasQuery("p1") boolean p1, @HasQuery("p2") Boolean p2) throws Exception {
return "p1=["+p1+","+req.hasQueryParameter("p1")+"],p2=["+p2+","+req.hasQueryParameter("p2")+"]";
}
//====================================================================================================
- // Form POSTS with @Content parameter
+ // Form POSTS with @Body parameter
//====================================================================================================
@RestMethod(name="POST", path="/testFormPostAsContent/*")
- public String testFormPostAsContent(@Content Test6Bean bean,
- @HasQParam("p1") boolean hqp1, @HasQParam("p2") boolean hqp2,
- @QParam("p1") String qp1, @QParam("p2") int qp2) throws Exception {
+ public String testFormPostAsContent(@Body Test6Bean bean,
+ @HasQuery("p1") boolean hqp1, @HasQuery("p2") boolean hqp2,
+ @Query("p1") String qp1, @Query("p2") int qp2) throws Exception {
return "bean=["+JsonSerializer.DEFAULT_LAX.toString(bean)+"],qp1=["+qp1+"],qp2=["+qp2+"],hqp1=["+hqp1+"],hqp2=["+hqp2+"]";
}
@@ -224,22 +224,22 @@ public class ParamsResource extends RestServletDefault {
}
//====================================================================================================
- // Test @Param and @QParam annotations when using multi-part parameters (e.g. &key=val1,&key=val2).
+ // Test @FormData and @Query annotations when using multi-part parameters (e.g. &key=val1,&key=val2).
//====================================================================================================
@RestMethod(name="GET", path="/testMultiPartParams")
public String testMultiPartParams(
- @QParam(value="p1",multipart=true) String[] p1,
- @QParam(value="p2",multipart=true) int[] p2,
- @QParam(value="p3",multipart=true) List<String> p3,
- @QParam(value="p4",multipart=true) List<Integer> p4,
- @Param(value="p5",multipart=true) String[] p5,
- @Param(value="p6",multipart=true) int[] p6,
- @Param(value="p7",multipart=true) List<String> p7,
- @Param(value="p8",multipart=true) List<Integer> p8,
- @QParam(value="p9",multipart=true) A[] p9,
- @QParam(value="p10",multipart=true) List<A> p10,
- @Param(value="p11",multipart=true) A[] p11,
- @Param(value="p12",multipart=true) List<A> p12) throws Exception {
+ @Query(value="p1",multipart=true) String[] p1,
+ @Query(value="p2",multipart=true) int[] p2,
+ @Query(value="p3",multipart=true) List<String> p3,
+ @Query(value="p4",multipart=true) List<Integer> p4,
+ @Query(value="p5",multipart=true) String[] p5,
+ @Query(value="p6",multipart=true) int[] p6,
+ @Query(value="p7",multipart=true) List<String> p7,
+ @Query(value="p8",multipart=true) List<Integer> p8,
+ @Query(value="p9",multipart=true) A[] p9,
+ @Query(value="p10",multipart=true) List<A> p10,
+ @Query(value="p11",multipart=true) A[] p11,
+ @Query(value="p12",multipart=true) List<A> p12) throws Exception {
ObjectMap m = new ObjectMap()
.append("p1", p1)
.append("p2", p2)
@@ -273,7 +273,7 @@ public class ParamsResource extends RestServletDefault {
@Property(name=UonSerializerContext.UON_simpleMode, value="true")
}
)
- public DTO2s.B testFormPostsWithMultiParamsViaProperty(@Content DTO2s.B content) throws Exception {
+ public DTO2s.B testFormPostsWithMultiParamsViaProperty(@Body DTO2s.B content) throws Exception {
return content;
}
@@ -287,7 +287,7 @@ public class ParamsResource extends RestServletDefault {
@Property(name=UonSerializerContext.UON_simpleMode, value="true")
}
)
- public DTO2s.C testFormPostsWithMultiParamsUsingAnnotation(@Content DTO2s.C content) throws Exception {
+ public DTO2s.C testFormPostsWithMultiParamsUsingAnnotation(@Body DTO2s.C content) throws Exception {
return content;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/main/java/org/apache/juneau/server/test/ParsersResource.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/java/org/apache/juneau/server/test/ParsersResource.java b/juneau-server-test/src/main/java/org/apache/juneau/server/test/ParsersResource.java
index d6a8ac5..608f9d5 100755
--- a/juneau-server-test/src/main/java/org/apache/juneau/server/test/ParsersResource.java
+++ b/juneau-server-test/src/main/java/org/apache/juneau/server/test/ParsersResource.java
@@ -47,7 +47,7 @@ public class ParsersResource extends RestServletDefault {
// Parser defined on class.
//====================================================================================================
@RestMethod(name="PUT", path="/testParserOnClass")
- public String testParserOnClass(@Content String in) {
+ public String testParserOnClass(@Body String in) {
return in;
}
@@ -55,7 +55,7 @@ public class ParsersResource extends RestServletDefault {
// Parser defined on method.
//====================================================================================================
@RestMethod(name="PUT", path="/testParserOnMethod", parsers=TestParserB.class)
- public String testParserOnMethod(@Content String in) {
+ public String testParserOnMethod(@Body String in) {
return in;
}
@@ -72,7 +72,7 @@ public class ParsersResource extends RestServletDefault {
// Parser overridden on method.
//====================================================================================================
@RestMethod(name="PUT", path="/testParserOverriddenOnMethod", parsers={TestParserB.class,TestParserC.class}, parsersInherit=PARSERS)
- public String testParserOverriddenOnMethod(@Content String in) {
+ public String testParserOverriddenOnMethod(@Body String in) {
return in;
}
@@ -89,11 +89,11 @@ public class ParsersResource extends RestServletDefault {
// Parser with different Accept than Content-Type.
//====================================================================================================
@RestMethod(name="PUT", path="/testParserWithDifferentMediaTypes", parsers={TestParserD.class}, parsersInherit=PARSERS)
- public String testParserWithDifferentMediaTypes(@Content String in) {
+ public String testParserWithDifferentMediaTypes(@Body String in) {
return in;
}
- @Consumes({"text/a","text/d"})
+ @Consumes("text/a,text/d")
public static class TestParserD extends ReaderParser {
@SuppressWarnings("unchecked")
@Override /* Parser */
@@ -106,7 +106,7 @@ public class ParsersResource extends RestServletDefault {
// Check for valid error response.
//====================================================================================================
@RestMethod(name="PUT", path="/testValidErrorResponse")
- public String testValidErrorResponse(@Content String in) {
+ public String testValidErrorResponse(@Body String in) {
return in;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/main/java/org/apache/juneau/server/test/PropertiesResource.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/java/org/apache/juneau/server/test/PropertiesResource.java b/juneau-server-test/src/main/java/org/apache/juneau/server/test/PropertiesResource.java
index 198595c..73b8775 100755
--- a/juneau-server-test/src/main/java/org/apache/juneau/server/test/PropertiesResource.java
+++ b/juneau-server-test/src/main/java/org/apache/juneau/server/test/PropertiesResource.java
@@ -59,7 +59,7 @@ public class PropertiesResource extends RestServletDefault {
res.setOutput(null);
}
- @Produces({"application/json","text/json"})
+ @Produces("application/json,text/json")
public static class PropertySerializer1 extends WriterSerializer {
@Override /* Serializer */
protected void doSerialize(SerializerSession session, Object output) throws Exception {
@@ -78,7 +78,7 @@ public class PropertiesResource extends RestServletDefault {
res.setOutput(null);
}
- @Produces({"application/json","text/json"})
+ @Produces("application/json,text/json")
public static class PropertySerializer2 extends WriterSerializer {
@Override /* Serializer */
protected void doSerialize(SerializerSession session, Object output) throws Exception {
@@ -86,5 +86,4 @@ public class PropertiesResource extends RestServletDefault {
session.getWriter().write(format("A=%s,P=%s,H=%s", p.get("A"), p.get("P"), p.get("h")));
}
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/main/java/org/apache/juneau/server/test/RestClient2Resource.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/java/org/apache/juneau/server/test/RestClient2Resource.java b/juneau-server-test/src/main/java/org/apache/juneau/server/test/RestClient2Resource.java
index 57e8a17..197ab40 100755
--- a/juneau-server-test/src/main/java/org/apache/juneau/server/test/RestClient2Resource.java
+++ b/juneau-server-test/src/main/java/org/apache/juneau/server/test/RestClient2Resource.java
@@ -31,6 +31,6 @@ public class RestClient2Resource extends RestServletDefault {
//====================================================================================================
@RestMethod(name="POST", path="/")
public Reader test1(RestRequest req) throws Exception {
- return new StringReader(req.getInputAsString());
+ return new StringReader(req.getBodyAsString());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/main/java/org/apache/juneau/server/test/SerializersResource.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/java/org/apache/juneau/server/test/SerializersResource.java b/juneau-server-test/src/main/java/org/apache/juneau/server/test/SerializersResource.java
index 82230a4..8051b08 100755
--- a/juneau-server-test/src/main/java/org/apache/juneau/server/test/SerializersResource.java
+++ b/juneau-server-test/src/main/java/org/apache/juneau/server/test/SerializersResource.java
@@ -85,7 +85,7 @@ public class SerializersResource extends RestServletDefault {
return "test4";
}
- @Produces(value={"text/a","text/d"},contentType="text/d")
+ @Produces(value="text/a,text/d",contentType="text/d")
public static class TestSerializerD extends WriterSerializer {
@Override /* Serializer */
protected void doSerialize(SerializerSession session, Object o) throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/main/java/org/apache/juneau/server/test/TransformsResource.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/java/org/apache/juneau/server/test/TransformsResource.java b/juneau-server-test/src/main/java/org/apache/juneau/server/test/TransformsResource.java
index 3b98afa..78e7226 100755
--- a/juneau-server-test/src/main/java/org/apache/juneau/server/test/TransformsResource.java
+++ b/juneau-server-test/src/main/java/org/apache/juneau/server/test/TransformsResource.java
@@ -36,11 +36,11 @@ public class TransformsResource extends TransformsParentResource {
return new A();
}
@RestMethod(name="PUT", path="/testClassTransformOverridesParentClassTransform")
- public A test1b(@Content A a) {
+ public A test1b(@Body A a) {
return a;
}
@RestMethod(name="PUT", path="/testClassTransformOverridesParentClassTransform/{a}")
- public A test1c(@Attr A a) {
+ public A test1c(@Path A a) {
return a;
}
@@ -53,11 +53,11 @@ public class TransformsResource extends TransformsParentResource {
return new A();
}
@RestMethod(name="PUT", path="/testMethodTransformOverridesClassTransform", pojoSwaps={SwapA3.class})
- public A test2b(@Content A a) {
+ public A test2b(@Body A a) {
return a;
}
@RestMethod(name="PUT", path="/testMethodTransformOverridesClassTransform/{a}", pojoSwaps={SwapA3.class})
- public A test2c(@Attr A a) {
+ public A test2c(@Path A a) {
return a;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/main/java/org/apache/juneau/server/test/UrlContentResource.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/java/org/apache/juneau/server/test/UrlContentResource.java b/juneau-server-test/src/main/java/org/apache/juneau/server/test/UrlContentResource.java
index 290dd0b..bfd82fd 100755
--- a/juneau-server-test/src/main/java/org/apache/juneau/server/test/UrlContentResource.java
+++ b/juneau-server-test/src/main/java/org/apache/juneau/server/test/UrlContentResource.java
@@ -29,12 +29,12 @@ public class UrlContentResource extends RestServlet {
private static final long serialVersionUID = 1L;
@RestMethod(name="GET", path="/testString")
- public String testString(@Content String content) {
+ public String testString(@Body String content) {
return String.format("class=%s, value=%s", content.getClass().getName(), content.toString());
}
@RestMethod(name="GET", path="/testEnum")
- public String testEnum(@Content TestEnum content) {
+ public String testEnum(@Body TestEnum content) {
return String.format("class=%s, value=%s", content.getClass().getName(), content.toString());
}
@@ -43,7 +43,7 @@ public class UrlContentResource extends RestServlet {
}
@RestMethod(name="GET", path="/testBean")
- public String testBean(@Content TestBean content) throws Exception {
+ public String testBean(@Body TestBean content) throws Exception {
return String.format("class=%s, value=%s", content.getClass().getName(), JsonSerializer.DEFAULT_LAX.serialize(content));
}
@@ -53,7 +53,7 @@ public class UrlContentResource extends RestServlet {
}
@RestMethod(name="GET", path="/testInt")
- public String testString(@Content Integer content) {
+ public String testString(@Body Integer content) {
return String.format("class=%s, value=%s", content.getClass().getName(), content.toString());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/main/resources/org/apache/juneau/server/test/NlsResource.properties
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/main/resources/org/apache/juneau/server/test/NlsResource.properties b/juneau-server-test/src/main/resources/org/apache/juneau/server/test/NlsResource.properties
index 9833d00..d461923 100755
--- a/juneau-server-test/src/main/resources/org/apache/juneau/server/test/NlsResource.properties
+++ b/juneau-server-test/src/main/resources/org/apache/juneau/server/test/NlsResource.properties
@@ -12,68 +12,60 @@
# * *
# ***************************************************************************************************************************
-label = Test2.a
+title = Test2.a
description = Test2.b
-test2 = Test2.c
-test2.req.attr.a = Test2.d
-test2.req.param.b = Test2.e
-test2.req.content = Test2.f
-test2.req.header.D = Test2.g
-test2.req.attr.a2 = Test2.h
-test2.req.param.b2 = Test2.i
-test2.req.header.D2 = Test2.j
-test2.req.foo.bar = Test2.k
-test2.res.200 = OK2
-test2.res.201 = Test2.l
-test2.res.201.foo.bar = Test2.m
+test2.summary = Test2.c
+test2.req.path.a.description = Test2.d
+test2.req.query.b.description = Test2.e
+test2.req.body.description = Test2.f
+test2.req.header.D.description = Test2.g
+test2.req.path.a2.description = Test2.h
+test2.req.query.b2.description = Test2.i
+test2.req.header.D2.description = Test2.j
+test2.res.200.description = OK2
+test2.res.201.description = Test2.l
-Test3.label = Test3.a
+Test3.title = Test3.a
Test3.description = Test3.b
-Test3.test3 = Test3.c
-Test3.test3.req.attr.a = Test3.d
-Test3.test3.req.param.b = Test3.e
-Test3.test3.req.content = Test3.f
-Test3.test3.req.header.D = Test3.g
-Test3.test3.req.attr.a2 = Test3.h
-Test3.test3.req.param.b2 = Test3.i
-Test3.test3.req.header.D2 = Test3.j
-Test3.test3.req.foo.bar = Test3.k
-Test3.test3.res.200 = OK3
-Test3.test3.res.201 = Test3.l
-Test3.test3.res.201.foo.bar = Test3.m
+Test3.test3.summary = Test3.c
+Test3.test3.req.path.a.description = Test3.d
+Test3.test3.req.query.b.description = Test3.e
+Test3.test3.req.body.description = Test3.f
+Test3.test3.req.header.D.description = Test3.g
+Test3.test3.req.path.a2.description = Test3.h
+Test3.test3.req.query.b2.description = Test3.i
+Test3.test3.req.header.D2.description = Test3.j
+Test3.test3.res.200.description = OK3
+Test3.test3.res.201.description = Test3.l
-Test4.label = $L{foo}
+Test4.title = $L{foo}
Test4.description = $L{foo}
-Test4.test4 = $L{foo}
-Test4.test4.req.attr.a = $L{foo}
-Test4.test4.req.param.b = $L{foo}
-Test4.test4.req.content = $L{foo}
-Test4.test4.req.header.D = $L{foo}
-Test4.test4.req.attr.a2 = $L{foo}
-Test4.test4.req.param.b2 = $L{foo}
-Test4.test4.req.header.D2 = $L{foo}
-Test4.test4.req.foo.bar = $L{foo}
-Test4.test4.res.200 = foo$L{foo}foo$L{foo}foo
-Test4.test4.res.201 = $L{foo}
-Test4.test4.res.201.foo.bar = $L{foo}
+Test4.test4.summary = $L{foo}
+Test4.test4.req.path.a.description = $L{foo}
+Test4.test4.req.query.b.description = $L{foo}
+Test4.test4.req.body.description = $L{foo}
+Test4.test4.req.header.D.description = $L{foo}
+Test4.test4.req.path.a2.description = $L{foo}
+Test4.test4.req.query.b2.description = $L{foo}
+Test4.test4.req.header.D2.description = $L{foo}
+Test4.test4.res.200.description = foo$L{foo}foo$L{foo}foo
+Test4.test4.res.201.description = $L{foo}
foo = $L{bar}
bar = baz
-Test5.label = $L{foo2}
-Test5.description = $R{servletLabel}
-Test5.test5 = $R{servletLabel}
-Test5.test5.req.attr.a = $R{servletLabel}
-Test5.test5.req.param.b = $R{servletLabel}
-Test5.test5.req.content = $R{servletLabel}
-Test5.test5.req.header.D = $R{servletLabel}
-Test5.test5.req.attr.a2 = $R{servletLabel}
-Test5.test5.req.param.b2 = $R{servletLabel}
-Test5.test5.req.header.D2 = $R{servletLabel}
-Test5.test5.req.foo.bar = $R{servletLabel}
-Test5.test5.res.200 = foo$R{servletLabel}foo$R{servletLabel}foo
-Test5.test5.res.201 = $R{servletLabel}
-Test5.test5.res.201.foo.bar = $R{servletLabel}
+Test5.title = $L{foo2}
+Test5.description = $R{servletTitle}
+Test5.test5.summary = $R{servletTitle}
+Test5.test5.req.path.a.description = $R{servletTitle}
+Test5.test5.req.query.b.description = $R{servletTitle}
+Test5.test5.req.body.description = $R{servletTitle}
+Test5.test5.req.header.D.description = $R{servletTitle}
+Test5.test5.req.path.a2.description = $R{servletTitle}
+Test5.test5.req.query.b2.description = $R{servletTitle}
+Test5.test5.req.header.D2.description = $R{servletTitle}
+Test5.test5.res.200.description = foo$R{servletTitle}foo$R{servletTitle}foo
+Test5.test5.res.201.description = $R{servletTitle}
Test5.foo2 = $L{bar2}
Test5.bar2 = baz2
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/test/java/org/apache/juneau/server/test/CallbackStringsTest.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/test/java/org/apache/juneau/server/test/CallbackStringsTest.java b/juneau-server-test/src/test/java/org/apache/juneau/server/test/CallbackStringsTest.java
index c370f69..8e487c0 100755
--- a/juneau-server-test/src/test/java/org/apache/juneau/server/test/CallbackStringsTest.java
+++ b/juneau-server-test/src/test/java/org/apache/juneau/server/test/CallbackStringsTest.java
@@ -20,7 +20,7 @@ import org.junit.*;
public class CallbackStringsTest {
//====================================================================================================
- // Basic tests using &Content parameter
+ // Basic tests using @Body parameter
//====================================================================================================
@Test
public void test() throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/test/java/org/apache/juneau/server/test/ContentTest.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/test/java/org/apache/juneau/server/test/ContentTest.java b/juneau-server-test/src/test/java/org/apache/juneau/server/test/ContentTest.java
index 95c1da8..041dc4f 100755
--- a/juneau-server-test/src/test/java/org/apache/juneau/server/test/ContentTest.java
+++ b/juneau-server-test/src/test/java/org/apache/juneau/server/test/ContentTest.java
@@ -28,7 +28,7 @@ public class ContentTest {
private static String URL = "/testContent";
//====================================================================================================
- // Basic tests using &Content parameter
+ // Basic tests using @Body parameter
//====================================================================================================
@Test
public void testUsingContentParam() throws Exception {
@@ -36,29 +36,29 @@ public class ContentTest {
String r;
// @RestMethod(name="POST", path="/boolean")
- // public boolean testBool(@Content boolean b) {
+ // public boolean testBool(@Body boolean b) {
// return b;
// }
- r = c.doPost(URL + "/boolean?content=true", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=true", null).getResponseAsString();
assertEquals("true", r);
- r = c.doPost(URL + "/boolean?content=(true)", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=(true)", null).getResponseAsString();
assertEquals("true", r);
- r = c.doPost(URL + "/boolean?content=$b(true)", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=$b(true)", null).getResponseAsString();
assertEquals("true", r);
- r = c.doPost(URL + "/boolean?content=false", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=false", null).getResponseAsString();
assertEquals("false", r);
- r = c.doPost(URL + "/boolean?content=(false)", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=(false)", null).getResponseAsString();
assertEquals("false", r);
- r = c.doPost(URL + "/boolean?content=$b(false)", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=$b(false)", null).getResponseAsString();
assertEquals("false", r);
try {
- r = c.doPost(URL + "/boolean?content=%00&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=%00&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
try {
- r = c.doPost(URL + "/boolean?content=bad&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=bad&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
@@ -66,154 +66,154 @@ public class ContentTest {
// @RestMethod(name="POST", path="/Boolean")
- // public Boolean testBoolean(@Content Boolean b) {
+ // public Boolean testBoolean(@Body Boolean b) {
// return b;
// }
- r = c.doPost(URL + "/Boolean?content=true", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=true", null).getResponseAsString();
assertEquals("true", r);
- r = c.doPost(URL + "/Boolean?content=(true)", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=(true)", null).getResponseAsString();
assertEquals("true", r);
- r = c.doPost(URL + "/Boolean?content=$b(true)", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=$b(true)", null).getResponseAsString();
assertEquals("true", r);
- r = c.doPost(URL + "/Boolean?content=false", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=false", null).getResponseAsString();
assertEquals("false", r);
- r = c.doPost(URL + "/Boolean?content=(false)", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=(false)", null).getResponseAsString();
assertEquals("false", r);
- r = c.doPost(URL + "/Boolean?content=$b(false)", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=$b(false)", null).getResponseAsString();
assertEquals("false", r);
- r = c.doPost(URL + "/Boolean?content=%00", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=%00", null).getResponseAsString();
assertEquals("null", r);
try {
- r = c.doPost(URL + "/Boolean?content=bad&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=bad&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/int")
- // public int testInt(@Content int i) {
+ // public int testInt(@Body int i) {
// return i;
// }
- r = c.doPost(URL + "/int?content=-123", null).getResponseAsString();
+ r = c.doPost(URL + "/int?body=-123", null).getResponseAsString();
assertEquals("-123", r);
- r = c.doPost(URL + "/int?content=(-123)", null).getResponseAsString();
+ r = c.doPost(URL + "/int?body=(-123)", null).getResponseAsString();
assertEquals("-123", r);
- r = c.doPost(URL + "/int?content=$n(-123)", null).getResponseAsString();
+ r = c.doPost(URL + "/int?body=$n(-123)", null).getResponseAsString();
assertEquals("-123", r);
try {
- r = c.doPost(URL + "/int?content=%00&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/int?body=%00&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
try {
- r = c.doPost(URL + "/int?content=bad&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/int?body=bad&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/Integer")
- // public Integer testInteger(@Content Integer i) {
+ // public Integer testInteger(@Body Integer i) {
// return i;
// }
- r = c.doPost(URL + "/Integer?content=-123", null).getResponseAsString();
+ r = c.doPost(URL + "/Integer?body=-123", null).getResponseAsString();
assertEquals("-123", r);
- r = c.doPost(URL + "/Integer?content=(-123)", null).getResponseAsString();
+ r = c.doPost(URL + "/Integer?body=(-123)", null).getResponseAsString();
assertEquals("-123", r);
- r = c.doPost(URL + "/Integer?content=$n(-123)", null).getResponseAsString();
+ r = c.doPost(URL + "/Integer?body=$n(-123)", null).getResponseAsString();
assertEquals("-123", r);
- r = c.doPost(URL + "/Integer?content=%00", null).getResponseAsString();
+ r = c.doPost(URL + "/Integer?body=%00", null).getResponseAsString();
assertEquals("null", r);
try {
- r = c.doPost(URL + "/Integer?content=bad&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/Integer?body=bad&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/float")
- // public float testFloat(@Content float f) {
+ // public float testFloat(@Body float f) {
// return f;
// }
- r = c.doPost(URL + "/float?content=-1.23", null).getResponseAsString();
+ r = c.doPost(URL + "/float?body=-1.23", null).getResponseAsString();
assertEquals("-1.23", r);
- r = c.doPost(URL + "/float?content=(-1.23)", null).getResponseAsString();
+ r = c.doPost(URL + "/float?body=(-1.23)", null).getResponseAsString();
assertEquals("-1.23", r);
- r = c.doPost(URL + "/float?content=$n(-1.23)", null).getResponseAsString();
+ r = c.doPost(URL + "/float?body=$n(-1.23)", null).getResponseAsString();
assertEquals("-1.23", r);
try {
- r = c.doPost(URL + "/float?content=%00&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/float?body=%00&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
try {
- r = c.doPost(URL + "/float?content=bad&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/float?body=bad&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/Float")
- // public Float testFloat2(@Content Float f) {
+ // public Float testFloat2(@Body Float f) {
// return f;
// }
- r = c.doPost(URL + "/Float?content=-1.23", null).getResponseAsString();
+ r = c.doPost(URL + "/Float?body=-1.23", null).getResponseAsString();
assertEquals("-1.23", r);
- r = c.doPost(URL + "/Float?content=(-1.23)", null).getResponseAsString();
+ r = c.doPost(URL + "/Float?body=(-1.23)", null).getResponseAsString();
assertEquals("-1.23", r);
- r = c.doPost(URL + "/Float?content=$n(-1.23)", null).getResponseAsString();
+ r = c.doPost(URL + "/Float?body=$n(-1.23)", null).getResponseAsString();
assertEquals("-1.23", r);
- r = c.doPost(URL + "/Float?content=%00", null).getResponseAsString();
+ r = c.doPost(URL + "/Float?body=%00", null).getResponseAsString();
assertEquals("null", r);
try {
- r = c.doPost(URL + "/Float?content=bad&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/Float?body=bad&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/Map")
- // public TreeMap<String,String> testMap(@Content TreeMap<String,String> m) {
+ // public TreeMap<String,String> testMap(@Body TreeMap<String,String> m) {
// return m;
// }
- r = c.doPost(URL + "/Map?content=(a=b,c=d)", null).getResponseAsString();
+ r = c.doPost(URL + "/Map?body=(a=b,c=d)", null).getResponseAsString();
assertEquals("{a:'b',c:'d'}", r);
- r = c.doPost(URL + "/Map?content=%00", null).getResponseAsString();
+ r = c.doPost(URL + "/Map?body=%00", null).getResponseAsString();
assertEquals("null", r);
try {
- r = c.doPost(URL + "/Map?content=bad&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/Map?body=bad&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/B")
- // public DTO2s.B testPojo1(@Content DTO2s.B b) {
+ // public DTO2s.B testPojo1(@Body DTO2s.B b) {
// return b;
// }
DTOs.B b = DTOs.B.create();
- r = c.doPost(URL + "/B?content=" + UonSerializer.DEFAULT.serialize(b), null).getResponseAsString();
+ r = c.doPost(URL + "/B?body=" + UonSerializer.DEFAULT.serialize(b), null).getResponseAsString();
assertEquals("{f01:['a','b'],f02:['c','d'],f03:[1,2],f04:[3,4],f05:[['e','f'],['g','h']],f06:[['i','j'],['k','l']],f07:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f08:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f09:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f10:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f11:['a','b'],f12:['c','d'],f13:[1,2],f14:[3,4],f15:[['e','f'],['g','h']],f16:[['i','j'],['k','l']],f17:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f18:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f19:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f20:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]]}", r);
- r = c.doPost(URL + "/B?content=" + UonSerializer.DEFAULT_SIMPLE.serialize(b), null).getResponseAsString();
+ r = c.doPost(URL + "/B?body=" + UonSerializer.DEFAULT_SIMPLE.serialize(b), null).getResponseAsString();
assertEquals("{f01:['a','b'],f02:['c','d'],f03:[1,2],f04:[3,4],f05:[['e','f'],['g','h']],f06:[['i','j'],['k','l']],f07:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f08:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f09:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f10:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f11:['a','b'],f12:['c','d'],f13:[1,2],f14:[3,4],f15:[['e','f'],['g','h']],f16:[['i','j'],['k','l']],f17:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f18:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f19:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f20:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]]}", r);
// @RestMethod(name="POST", path="/C")
- // public DTO2s.C testPojo2(@Content DTO2s.C c) {
+ // public DTO2s.C testPojo2(@Body DTO2s.C c) {
// return c;
// }
DTOs.C x = DTOs.C.create();
- r = c.doPost(URL + "/C?content=" + UonSerializer.DEFAULT.serialize(x), null).getResponseAsString();
+ r = c.doPost(URL + "/C?body=" + UonSerializer.DEFAULT.serialize(x), null).getResponseAsString();
assertEquals("{f01:['a','b'],f02:['c','d'],f03:[1,2],f04:[3,4],f05:[['e','f'],['g','h']],f06:[['i','j'],['k','l']],f07:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f08:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f09:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f10:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f11:['a','b'],f12:['c','d'],f13:[1,2],f14:[3,4],f15:[['e','f'],['g','h']],f16:[['i','j'],['k','l']],f17:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f18:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f19:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f20:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]]}", r);
- r = c.doPost(URL + "/C?content=" + UonSerializer.DEFAULT_SIMPLE.serialize(x), null).getResponseAsString();
+ r = c.doPost(URL + "/C?body=" + UonSerializer.DEFAULT_SIMPLE.serialize(x), null).getResponseAsString();
assertEquals("{f01:['a','b'],f02:['c','d'],f03:[1,2],f04:[3,4],f05:[['e','f'],['g','h']],f06:[['i','j'],['k','l']],f07:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f08:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f09:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f10:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f11:['a','b'],f12:['c','d'],f13:[1,2],f14:[3,4],f15:[['e','f'],['g','h']],f16:[['i','j'],['k','l']],f17:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f18:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f19:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f20:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]]}", r);
c.closeQuietly();
}
//====================================================================================================
- // Basic tests using &Content parameter with &Accept=text/json
+ // Basic tests using &Body parameter with &Accept=text/json
//====================================================================================================
@Test
public void testUsingContentParamJsonHeader() throws Exception {
@@ -221,21 +221,21 @@ public class ContentTest {
String r;
// @RestMethod(name="POST", path="/boolean")
- // public boolean testBool(@Content boolean b) {
+ // public boolean testBool(@Body boolean b) {
// return b;
// }
- r = c.doPost(URL + "/boolean?content=true", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=true", null).getResponseAsString();
assertEquals("true", r);
- r = c.doPost(URL + "/boolean?content=false", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=false", null).getResponseAsString();
assertEquals("false", r);
try {
- r = c.doPost(URL + "/boolean?content=null&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=null&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
try {
- r = c.doPost(URL + "/boolean?content=bad&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=bad&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
@@ -243,126 +243,126 @@ public class ContentTest {
// @RestMethod(name="POST", path="/Boolean")
- // public Boolean testBoolean(@Content Boolean b) {
+ // public Boolean testBoolean(@Body Boolean b) {
// return b;
// }
- r = c.doPost(URL + "/Boolean?content=true", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=true", null).getResponseAsString();
assertEquals("true", r);
- r = c.doPost(URL + "/Boolean?content=false", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=false", null).getResponseAsString();
assertEquals("false", r);
- r = c.doPost(URL + "/Boolean?content=null", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=null", null).getResponseAsString();
assertEquals("null", r);
try {
- r = c.doPost(URL + "/Boolean?content=bad&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=bad&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/int")
- // public int testInt(@Content int i) {
+ // public int testInt(@Body int i) {
// return i;
// }
- r = c.doPost(URL + "/int?content=-123", null).getResponseAsString();
+ r = c.doPost(URL + "/int?body=-123", null).getResponseAsString();
assertEquals("-123", r);
try {
- r = c.doPost(URL + "/int?content=null&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/int?body=null&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
try {
- r = c.doPost(URL + "/int?content=bad&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/int?body=bad&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/Integer")
- // public Integer testInteger(@Content Integer i) {
+ // public Integer testInteger(@Body Integer i) {
// return i;
// }
- r = c.doPost(URL + "/Integer?content=-123", null).getResponseAsString();
+ r = c.doPost(URL + "/Integer?body=-123", null).getResponseAsString();
assertEquals("-123", r);
- r = c.doPost(URL + "/Integer?content=null", null).getResponseAsString();
+ r = c.doPost(URL + "/Integer?body=null", null).getResponseAsString();
assertEquals("null", r);
try {
- r = c.doPost(URL + "/Integer?content=bad&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/Integer?body=bad&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/float")
- // public float testFloat(@Content float f) {
+ // public float testFloat(@Body float f) {
// return f;
// }
- r = c.doPost(URL + "/float?content=-1.23", null).getResponseAsString();
+ r = c.doPost(URL + "/float?body=-1.23", null).getResponseAsString();
assertEquals("-1.23", r);
try {
- r = c.doPost(URL + "/float?content=null&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/float?body=null&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
try {
- r = c.doPost(URL + "/float?content=bad&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/float?body=bad&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/Float")
- // public Float testFloat2(@Content Float f) {
+ // public Float testFloat2(@Body Float f) {
// return f;
// }
- r = c.doPost(URL + "/Float?content=-1.23", null).getResponseAsString();
+ r = c.doPost(URL + "/Float?body=-1.23", null).getResponseAsString();
assertEquals("-1.23", r);
- r = c.doPost(URL + "/Float?content=null", null).getResponseAsString();
+ r = c.doPost(URL + "/Float?body=null", null).getResponseAsString();
assertEquals("null", r);
try {
- r = c.doPost(URL + "/Float?content=bad&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/Float?body=bad&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/Map")
- // public TreeMap<String,String> testMap(@Content TreeMap<String,String> m) {
+ // public TreeMap<String,String> testMap(@Body TreeMap<String,String> m) {
// return m;
// }
- r = c.doPost(URL + "/Map?content=" + encode("{a:'b',c:'d'}"), null).getResponseAsString();
+ r = c.doPost(URL + "/Map?body=" + encode("{a:'b',c:'d'}"), null).getResponseAsString();
assertEquals("{a:'b',c:'d'}", r);
- r = c.doPost(URL + "/Map?content=null", null).getResponseAsString();
+ r = c.doPost(URL + "/Map?body=null", null).getResponseAsString();
assertEquals("null", r);
try {
- r = c.doPost(URL + "/Map?content=bad&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/Map?body=bad&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/B")
- // public DTO2s.B testPojo1(@Content DTO2s.B b) {
+ // public DTO2s.B testPojo1(@Body DTO2s.B b) {
// return b;
// }
DTOs.B b = DTOs.B.create();
- r = c.doPost(URL + "/B?content=" + encode(JsonSerializer.DEFAULT_LAX.serialize(b)), null).getResponseAsString();
+ r = c.doPost(URL + "/B?body=" + encode(JsonSerializer.DEFAULT_LAX.serialize(b)), null).getResponseAsString();
assertEquals("{f01:['a','b'],f02:['c','d'],f03:[1,2],f04:[3,4],f05:[['e','f'],['g','h']],f06:[['i','j'],['k','l']],f07:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f08:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f09:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f10:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f11:['a','b'],f12:['c','d'],f13:[1,2],f14:[3,4],f15:[['e','f'],['g','h']],f16:[['i','j'],['k','l']],f17:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f18:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f19:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f20:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]]}", r);
// @RestMethod(name="POST", path="/C")
- // public DTO2s.C testPojo2(@Content DTO2s.C c) {
+ // public DTO2s.C testPojo2(@Body DTO2s.C c) {
// return c;
// }
DTOs.C x = DTOs.C.create();
- r = c.doPost(URL + "/C?content=" + encode(JsonSerializer.DEFAULT_LAX.serialize(x)), null).getResponseAsString();
+ r = c.doPost(URL + "/C?body=" + encode(JsonSerializer.DEFAULT_LAX.serialize(x)), null).getResponseAsString();
assertEquals("{f01:['a','b'],f02:['c','d'],f03:[1,2],f04:[3,4],f05:[['e','f'],['g','h']],f06:[['i','j'],['k','l']],f07:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f08:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f09:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f10:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f11:['a','b'],f12:['c','d'],f13:[1,2],f14:[3,4],f15:[['e','f'],['g','h']],f16:[['i','j'],['k','l']],f17:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f18:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f19:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f20:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]]}", r);
c.closeQuietly();
}
//====================================================================================================
- // Basic tests using &Content parameter with &Accept=text/json
+ // Basic tests using &Body parameter with &Accept=text/json
//====================================================================================================
@Test
public void testUsingContentParamJsonParam() throws Exception {
@@ -370,21 +370,21 @@ public class ContentTest {
String r;
// @RestMethod(name="POST", path="/boolean")
- // public boolean testBool(@Content boolean b) {
+ // public boolean testBool(@Body boolean b) {
// return b;
// }
- r = c.doPost(URL + "/boolean?content=true&Content-Type=text/json", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=true&Content-Type=text/json", null).getResponseAsString();
assertEquals("true", r);
- r = c.doPost(URL + "/boolean?content=false&Content-Type=text/json", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=false&Content-Type=text/json", null).getResponseAsString();
assertEquals("false", r);
try {
- r = c.doPost(URL + "/boolean?content=null&Content-Type=text/json&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=null&Content-Type=text/json&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
try {
- r = c.doPost(URL + "/boolean?content=bad&Content-Type=text/json&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/boolean?body=bad&Content-Type=text/json&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
@@ -392,119 +392,119 @@ public class ContentTest {
// @RestMethod(name="POST", path="/Boolean")
- // public Boolean testBoolean(@Content Boolean b) {
+ // public Boolean testBoolean(@Body Boolean b) {
// return b;
// }
- r = c.doPost(URL + "/Boolean?content=true&Content-Type=text/json", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=true&Content-Type=text/json", null).getResponseAsString();
assertEquals("true", r);
- r = c.doPost(URL + "/Boolean?content=false&Content-Type=text/json", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=false&Content-Type=text/json", null).getResponseAsString();
assertEquals("false", r);
- r = c.doPost(URL + "/Boolean?content=null&Content-Type=text/json", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=null&Content-Type=text/json", null).getResponseAsString();
assertEquals("null", r);
try {
- r = c.doPost(URL + "/Boolean?content=bad&Content-Type=text/json&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/Boolean?body=bad&Content-Type=text/json&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/int")
- // public int testInt(@Content int i) {
+ // public int testInt(@Body int i) {
// return i;
// }
- r = c.doPost(URL + "/int?content=-123&Content-Type=text/json", null).getResponseAsString();
+ r = c.doPost(URL + "/int?body=-123&Content-Type=text/json", null).getResponseAsString();
assertEquals("-123", r);
try {
- r = c.doPost(URL + "/int?content=null&Content-Type=text/json&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/int?body=null&Content-Type=text/json&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
try {
- r = c.doPost(URL + "/int?content=bad&Content-Type=text/json&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/int?body=bad&Content-Type=text/json&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/Integer")
- // public Integer testInteger(@Content Integer i) {
+ // public Integer testInteger(@Body Integer i) {
// return i;
// }
- r = c.doPost(URL + "/Integer?content=-123&Content-Type=text/json", null).getResponseAsString();
+ r = c.doPost(URL + "/Integer?body=-123&Content-Type=text/json", null).getResponseAsString();
assertEquals("-123", r);
- r = c.doPost(URL + "/Integer?content=null&Content-Type=text/json", null).getResponseAsString();
+ r = c.doPost(URL + "/Integer?body=null&Content-Type=text/json", null).getResponseAsString();
assertEquals("null", r);
try {
- r = c.doPost(URL + "/Integer?content=bad&Content-Type=text/json&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/Integer?body=bad&Content-Type=text/json&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/float")
- // public float testFloat(@Content float f) {
+ // public float testFloat(@Body float f) {
// return f;
// }
- r = c.doPost(URL + "/float?content=-1.23&Content-Type=text/json", null).getResponseAsString();
+ r = c.doPost(URL + "/float?body=-1.23&Content-Type=text/json", null).getResponseAsString();
assertEquals("-1.23", r);
try {
- r = c.doPost(URL + "/float?content=null&Content-Type=text/json&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/float?body=null&Content-Type=text/json&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
try {
- r = c.doPost(URL + "/float?content=bad&Content-Type=text/json&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/float?body=bad&Content-Type=text/json&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/Float")
- // public Float testFloat2(@Content Float f) {
+ // public Float testFloat2(@Body Float f) {
// return f;
// }
- r = c.doPost(URL + "/Float?content=-1.23&Content-Type=text/json", null).getResponseAsString();
+ r = c.doPost(URL + "/Float?body=-1.23&Content-Type=text/json", null).getResponseAsString();
assertEquals("-1.23", r);
- r = c.doPost(URL + "/Float?content=null&Content-Type=text/json", null).getResponseAsString();
+ r = c.doPost(URL + "/Float?body=null&Content-Type=text/json", null).getResponseAsString();
assertEquals("null", r);
try {
- r = c.doPost(URL + "/Float?content=bad&Content-Type=text/json&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/Float?body=bad&Content-Type=text/json&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/Map")
- // public TreeMap<String,String> testMap(@Content TreeMap<String,String> m) {
+ // public TreeMap<String,String> testMap(@Body TreeMap<String,String> m) {
// return m;
// }
- r = c.doPost(URL + "/Map?content=" + encode("{a:'b',c:'d'}") + "&Content-Type=text/json", null).getResponseAsString();
+ r = c.doPost(URL + "/Map?body=" + encode("{a:'b',c:'d'}") + "&Content-Type=text/json", null).getResponseAsString();
assertEquals("{a:'b',c:'d'}", r);
- r = c.doPost(URL + "/Map?content=null&Content-Type=text/json", null).getResponseAsString();
+ r = c.doPost(URL + "/Map?body=null&Content-Type=text/json", null).getResponseAsString();
assertEquals("null", r);
try {
- r = c.doPost(URL + "/Map?content=bad&Content-Type=text/json&noTrace=true", null).getResponseAsString();
+ r = c.doPost(URL + "/Map?body=bad&Content-Type=text/json&noTrace=true", null).getResponseAsString();
fail("Exception expected!");
} catch (RestCallException e) {
assertEquals(400, e.getResponseCode());
}
// @RestMethod(name="POST", path="/B")
- // public DTO2s.B testPojo1(@Content DTO2s.B b) {
+ // public DTO2s.B testPojo1(@Body DTO2s.B b) {
// return b;
// }
DTOs.B b = DTOs.B.create();
- r = c.doPost(URL + "/B?content=" + encode(JsonSerializer.DEFAULT_LAX.serialize(b)) + "&Content-Type=text/json", null).getResponseAsString();
+ r = c.doPost(URL + "/B?body=" + encode(JsonSerializer.DEFAULT_LAX.serialize(b)) + "&Content-Type=text/json", null).getResponseAsString();
assertEquals("{f01:['a','b'],f02:['c','d'],f03:[1,2],f04:[3,4],f05:[['e','f'],['g','h']],f06:[['i','j'],['k','l']],f07:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f08:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f09:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f10:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f11:['a','b'],f12:['c','d'],f13:[1,2],f14:[3,4],f15:[['e','f'],['g','h']],f16:[['i','j'],['k','l']],f17:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f18:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f19:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f20:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]]}", r);
// @RestMethod(name="POST", path="/C")
- // public DTO2s.C testPojo2(@Content DTO2s.C c) {
+ // public DTO2s.C testPojo2(@Body DTO2s.C c) {
// return c;
// }
DTOs.C x = DTOs.C.create();
- r = c.doPost(URL + "/C?content=" + encode(JsonSerializer.DEFAULT_LAX.serialize(x)) + "&Content-Type=text/json", null).getResponseAsString();
+ r = c.doPost(URL + "/C?body=" + encode(JsonSerializer.DEFAULT_LAX.serialize(x)) + "&Content-Type=text/json", null).getResponseAsString();
assertEquals("{f01:['a','b'],f02:['c','d'],f03:[1,2],f04:[3,4],f05:[['e','f'],['g','h']],f06:[['i','j'],['k','l']],f07:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f08:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f09:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f10:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f11:['a','b'],f12:['c','d'],f13:[1,2],f14:[3,4],f15:[['e','f'],['g','h']],f16:[['i','j'],['k','l']],f17:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f18:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f19:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f20:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]]}", r);
c.closeQuietly();
@@ -519,7 +519,7 @@ public class ContentTest {
String r;
// @RestMethod(name="POST", path="/boolean")
- // public boolean testBool(@Content boolean b) {
+ // public boolean testBool(@Body boolean b) {
// return b;
// }
r = c.doPost(URL + "/boolean", "true").getResponseAsString();
@@ -549,7 +549,7 @@ public class ContentTest {
// @RestMethod(name="POST", path="/Boolean")
- // public Boolean testBoolean(@Content Boolean b) {
+ // public Boolean testBoolean(@Body Boolean b) {
// return b;
// }
r = c.doPost(URL + "/Boolean", "true").getResponseAsString();
@@ -574,7 +574,7 @@ public class ContentTest {
}
// @RestMethod(name="POST", path="/int")
- // public int testInt(@Content int i) {
+ // public int testInt(@Body int i) {
// return i;
// }
r = c.doPost(URL + "/int", "-123").getResponseAsString();
@@ -597,7 +597,7 @@ public class ContentTest {
}
// @RestMethod(name="POST", path="/Integer")
- // public Integer testInteger(@Content Integer i) {
+ // public Integer testInteger(@Body Integer i) {
// return i;
// }
r = c.doPost(URL + "/Integer", "-123").getResponseAsString();
@@ -616,7 +616,7 @@ public class ContentTest {
}
// @RestMethod(name="POST", path="/float")
- // public float testFloat(@Content float f) {
+ // public float testFloat(@Body float f) {
// return f;
// }
r = c.doPost(URL + "/float", "-1.23").getResponseAsString();
@@ -639,7 +639,7 @@ public class ContentTest {
}
// @RestMethod(name="POST", path="/Float")
- // public Float testFloat2(@Content Float f) {
+ // public Float testFloat2(@Body Float f) {
// return f;
// }
r = c.doPost(URL + "/Float", "-1.23").getResponseAsString();
@@ -658,7 +658,7 @@ public class ContentTest {
}
// @RestMethod(name="POST", path="/Map")
- // public TreeMap<String,String> testMap(@Content TreeMap<String,String> m) {
+ // public TreeMap<String,String> testMap(@Body TreeMap<String,String> m) {
// return m;
// }
r = c.doPost(URL + "/Map", "(a=b,c=d)").getResponseAsString();
@@ -673,7 +673,7 @@ public class ContentTest {
}
// @RestMethod(name="POST", path="/B")
- // public DTO2s.B testPojo1(@Content DTO2s.B b) {
+ // public DTO2s.B testPojo1(@Body DTO2s.B b) {
// return b;
// }
DTOs.B b = DTOs.B.create();
@@ -683,7 +683,7 @@ public class ContentTest {
assertEquals("{f01:['a','b'],f02:['c','d'],f03:[1,2],f04:[3,4],f05:[['e','f'],['g','h']],f06:[['i','j'],['k','l']],f07:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f08:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f09:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f10:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f11:['a','b'],f12:['c','d'],f13:[1,2],f14:[3,4],f15:[['e','f'],['g','h']],f16:[['i','j'],['k','l']],f17:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f18:[{a:'a',b:1,c:true},{a:'a',b:1,c:true}],f19:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]],f20:[[{a:'a',b:1,c:true}],[{a:'a',b:1,c:true}]]}", r);
// @RestMethod(name="POST", path="/C")
- // public DTO2s.C testPojo2(@Content DTO2s.C c) {
+ // public DTO2s.C testPojo2(@Body DTO2s.C c) {
// return c;
// }
DTOs.C x = DTOs.C.create();
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7f2bcfdd/juneau-server-test/src/test/java/org/apache/juneau/server/test/ErrorConditionsTest.java
----------------------------------------------------------------------
diff --git a/juneau-server-test/src/test/java/org/apache/juneau/server/test/ErrorConditionsTest.java b/juneau-server-test/src/test/java/org/apache/juneau/server/test/ErrorConditionsTest.java
index 46364cc..58abedf 100755
--- a/juneau-server-test/src/test/java/org/apache/juneau/server/test/ErrorConditionsTest.java
+++ b/juneau-server-test/src/test/java/org/apache/juneau/server/test/ErrorConditionsTest.java
@@ -152,7 +152,7 @@ public class ErrorConditionsTest {
fail("Exception expected");
} catch (RestCallException e) {
checkErrorResponse(debug, e, SC_BAD_REQUEST,
- "Could not convert PARAM 'p1' to type 'int' on method 'org.apache.juneau.server.test.ErrorConditionsResource.testSetParameterToInvalidTypes'");
+ "Could not convert QUERY 'p1' to type 'int' on method 'org.apache.juneau.server.test.ErrorConditionsResource.testSetParameterToInvalidTypes'");
}
try {
@@ -160,7 +160,7 @@ public class ErrorConditionsTest {
fail("Exception expected");
} catch (RestCallException e) {
checkErrorResponse(debug, e, SC_BAD_REQUEST,
- "Could not convert ATTR 'a1' to type 'int' on method 'org.apache.juneau.server.test.ErrorConditionsResource.testSetParameterToInvalidTypes'");
+ "Could not convert PATH 'a1' to type 'int' on method 'org.apache.juneau.server.test.ErrorConditionsResource.testSetParameterToInvalidTypes'");
}
try {