blob: 6491b3f8dc431387ae54a5760aa00c69e4eb2906 [file] [log] [blame]
<!--
/***************************************************************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
***************************************************************************************************************************/
-->
RequestPathMatch
<p>
The {@link oajr.RequestPath} object is the API for accessing the matched variables
and remainder on the URL path.
</p>
<p class='bpcode w800'>
<ja>@RestMethod</ja>(...)
<jk>public</jk> Object myMethod(RequestPathMatch path) {...}
</p>
<h5 class='figure'>Example:</h5>
<p class='bpcode w800'>
<ja>@RestMethod</ja>(..., path=<js>"/{foo}/{bar}/{baz}/*"</js>)
<jk>public void</jk> doGet(RequestPathMatch path) {
<jc>// Example URL: /123/qux/true/quux</jc>
<jk>int</jk> foo = pm.getInt(<js>"foo"</js>); <jc>// =123</jc>
String bar = pm.getString(<js>"bar"</js>); <jc>// =qux</jc>
<jk>boolean</jk> baz = pm.getBoolean(<js>"baz"</js>); <jc>// =true</jc>
String remainder = pm.getRemainder(); <jc>// =quux</jc>
}
</p>
<p>
Some important methods on this class are:
</p>
<ul class='javatree'>
<li class='jc'><c>{@link oajr.RequestPath} <jk>extends</jk> TreeMap&lt;String,String&gt;</c>
<ul>
<li class='jm'>{@link oajr.RequestPath#get(String,Class) get(String,Class)} - Get path match variable converted to a POJO.
<li class='jm'>{@link oajr.RequestPath#get(String,Type,Type...) get(String,Type,Type)} - Get path match variable converted to a map or collection of POJOs.
<li class='jm'>{@link oajr.RequestPath#getString(String) getString(String)} - Get patch match variable as a simple string.
<li class='jm'>{@link oajr.RequestPath#getInt(String) getInt(String)} - Get path match variable as an integer.
<li class='jm'>{@link oajr.RequestPath#getBoolean(String) getBoolean(String)} - Get path match variable as a boolean.
<li class='jm'>{@link oajr.RequestPath#getRemainder() getRemainder()} - Get the path match remainder.
</ul>
</ul>
<ul class='seealso'>
<li class='ja'>{@link oaj.http.annotation.Path}
</ul>