2.4. RESTEasy エンドポイントの表示
jaxrs
サブシステムの read-resource
操作を使用して、各 RESTEasy エンドポイントの構造化出力を表示できます。以下に、管理 CLI コマンドの例と期待される結果を示します。
/deployment=DEPLOYMENT_NAME/subsystem=jaxrs/rest-resource=org.jboss.as.quickstarts.rshelloworld.HelloWorld:read-resource(include-runtime=true)
{
"outcome" => "success",
"result" => {
"resource-class" => "org.jboss.as.quickstarts.rshelloworld.HelloWorld",
"rest-resource-paths" => [
{
"resource-path" => "/hello/json",
"consumes" => undefined,
"produces" => [
"application/json",
"text/plain"
],
"java-method" => "java.lang.String org.jboss.as.quickstarts.rshelloworld.HelloWorld.getHelloWorldJSON()",
"resource-methods" => [
"POST /wildfly-helloworld-rs/rest/hello/json",
"GET /wildfly-helloworld-rs/rest/hello/json"
]
},
{
"resource-path" => "/hello/xml",
"consumes" => undefined,
"produces" => ["application/xml"],
"java-method" => "java.lang.String org.jboss.as.quickstarts.rshelloworld.HelloWorld.getHelloWorldXML(@QueryParam java.lang.String name = 'LGAO')",
"resource-methods" => ["GET /wildfly-helloworld-rs/rest/hello/xml"]
}
],
"sub-resource-locators" => [{
"resource-class" => "org.jboss.as.quickstarts.rshelloworld.SubHelloWorld",
"rest-resource-paths" => [
{
"resource-path" => "/hello/subMessage/",
"consumes" => undefined,
"produces" => undefined,
"java-method" => "java.lang.String org.jboss.as.quickstarts.rshelloworld.SubHelloWorld.helloInSub()",
"resource-methods" => ["GET /wildfly-helloworld-rs/rest/hello/subMessage/"]
},
{
"resource-path" => "/hello/subMessage/subPath",
"consumes" => undefined,
"produces" => undefined,
"java-method" => "java.lang.String org.jboss.as.quickstarts.rshelloworld.SubHelloWorld.subPath()",
"resource-methods" => ["GET /wildfly-helloworld-rs/rest/hello/subMessage/subPath"]
}
],
"sub-resource-locators" => undefined
}]
}
}
上記の例では、出力情報が resource-class
でグループ化され、resource-path
ごとに順序づけされます。
-
resource-path
はエンドポイントにアクセスするためのアドレスです。 -
resource-class
はエンドポイントが定義されているクラスを定義します。 -
rest-resource-paths
には、リソースパス、HTTP メソッドを定義し、エンドポイントを消費して生成する Java メソッドが含まれます。 -
java-method
は Java メソッドの名前とそのパラメーターを指定します。また、定義される場合、JAX-RS アノテーションについての以下の情報も含まれます。@PathParam
、@QueryParam
、@HeaderParam
、@MatrixParam
、@CookieParam
、@FormParam
、@DefaultValue
。
または、以下の例のように、rest-resource
パラメーターを定義せずに read-resource
操作を使用し、すべてのエンドポイントに関する情報を取得できます。
/deployment=DEPLOYMENT_NAME/subsystem=jaxrs:read-resource(include-runtime=true,recursive=true)