blob: 1611d56bd34c383716b415ce251d49f62353c357 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>Path</title>
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Path";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../javax/ws/rs/PATCH.html" title="annotation in javax.ws.rs"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../javax/ws/rs/PathParam.html" title="annotation in javax.ws.rs"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?javax/ws/rs/Path.html" target="_top">Frames</a></li>
<li><a href="Path.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.required.element.summary">Required</a>&nbsp;|&nbsp;</li>
<li>Optional</li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.element.detail">Element</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">javax.ws.rs</div>
<h2 title="Annotation Type Path" class="title">Annotation Type Path</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>@Target(value={TYPE,METHOD})
@Retention(value=RUNTIME)
@Documented
public @interface <span class="memberNameLabel">Path</span></pre>
<div class="block">Identifies the URI path that a resource class or class method will serve
requests for.
<p>Paths are relative. For an annotated class the base URI is the
application path, see <a href="../../../javax/ws/rs/ApplicationPath.html" title="annotation in javax.ws.rs"><code>ApplicationPath</code></a>. For an annotated
method the base URI is the
effective URI of the containing class. For the purposes of absolutizing a
path against the base URI , a leading '/' in a path is
ignored and base URIs are treated as if they ended in '/'. E.g.:</p>
<pre>&#64;Path("widgets")
public class WidgetsResource {
&#64;GET
String getList() {...}
&#64;GET &#64;Path("{id}")
String getWidget(&#64;PathParam("id") String id) {...}
}</pre>
<p>In the above, if the application path is
<code>catalogue</code> and the application is deployed at
<code>http://example.com/</code>, then <code>GET</code> requests for
<code>http://example.com/catalogue/widgets</code> will be handled by the
<code>getList</code> method while requests for
<code>http://example.com/catalogue/widgets/<i>nnn</i></code> (where
<code><i>nnn</i></code> is some value) will be handled by the
<code>getWidget</code> method. The same would apply if the value of either
<code>@Path</code> annotation started with '/'.</p>
<p>Classes and methods may also be annotated with <a href="../../../javax/ws/rs/Consumes.html" title="annotation in javax.ws.rs"><code>Consumes</code></a> and
<a href="../../../javax/ws/rs/Produces.html" title="annotation in javax.ws.rs"><code>Produces</code></a> to filter the requests they will receive.</p></div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../javax/ws/rs/Consumes.html" title="annotation in javax.ws.rs"><code>Consumes</code></a>,
<a href="../../../javax/ws/rs/Produces.html" title="annotation in javax.ws.rs"><code>Produces</code></a>,
<a href="../../../javax/ws/rs/PathParam.html" title="annotation in javax.ws.rs"><code>PathParam</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="annotation.type.required.element.summary">
<!-- -->
</a>
<h3>Required Element Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Required Element Summary table, listing required elements, and an explanation">
<caption><span>Required Elements</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Required Element and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../javax/ws/rs/Path.html#value--">value</a></span></code>
<div class="block">Defines a URI template for the resource class or method, must not
include matrix parameters.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="annotation.type.element.detail">
<!-- -->
</a>
<h3>Element Detail</h3>
<a name="value--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>value</h4>
<pre>public abstract&nbsp;java.lang.String&nbsp;value</pre>
<div class="block">Defines a URI template for the resource class or method, must not
include matrix parameters.
<p>Embedded template parameters are allowed and are of the form:</p>
<pre> param = "{" *WSP name *WSP [ ":" *WSP regex *WSP ] "}"
name = (ALPHA / DIGIT / "_")*(ALPHA / DIGIT / "." / "_" / "-" ) ; \w[\w\.-]*
regex = *( nonbrace / "{" *nonbrace "}" ) ; where nonbrace is any char other than "{" and "}"</pre>
<p>See <a href="http://tools.ietf.org/html/rfc5234">RFC 5234</a>
for a description of the syntax used above and the expansions of
<code>WSP</code>, <code>ALPHA</code> and <code>DIGIT</code>. In the above <code>name</code>
is the template parameter name and the optional <code>regex</code> specifies
the contents of the capturing group for the parameter. If <code>regex</code>
is not supplied then a default value of <code>[^/]+</code> which terminates at
a path segment boundary, is used. Matching of request URIs to URI
templates is performed against encoded path values and implementations
will not escape literal characters in regex automatically, therefore any
literals in <code>regex</code> should be escaped by the author according to
the rules of
<a href="http://tools.ietf.org/html/rfc3986#section-3.3">RFC 3986 section 3.3</a>.
Caution is recommended in the use of <code>regex</code>, incorrect use can
lead to a template parameter matching unexpected URI paths. See
<a href="http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html">Pattern</a>
for further information on the syntax of regular expressions.
Values of template parameters may be extracted using <a href="../../../javax/ws/rs/PathParam.html" title="annotation in javax.ws.rs"><code>PathParam</code></a>.</p>
<p>The literal part of the supplied value (those characters
that are not part of a template parameter) is automatically percent
encoded to conform to the <code>path</code> production of
<a href="http://tools.ietf.org/html/rfc3986#section-3.3">RFC 3986 section 3.3</a>.
Note that percent encoded values are allowed in the literal part of the
value, an implementation will recognize such values and will not double
encode the '%' character.</p></div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../javax/ws/rs/PATCH.html" title="annotation in javax.ws.rs"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../javax/ws/rs/PathParam.html" title="annotation in javax.ws.rs"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?javax/ws/rs/Path.html" target="_top">Frames</a></li>
<li><a href="Path.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.required.element.summary">Required</a>&nbsp;|&nbsp;</li>
<li>Optional</li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.element.detail">Element</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>