blob: cd2611081d0e2867db620f057e05b85da74a3adb [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>Providers</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="Providers";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</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/ext/Provider.html" title="annotation in javax.ws.rs.ext"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../javax/ws/rs/ext/ReaderInterceptor.html" title="interface in javax.ws.rs.ext"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?javax/ws/rs/ext/Providers.html" target="_top">Frames</a></li>
<li><a href="Providers.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>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</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.ext</div>
<h2 title="Interface Providers" class="title">Interface Providers</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public interface <span class="typeNameLabel">Providers</span></pre>
<div class="block">An injectable interface providing runtime lookup of provider instances.</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/core/Context.html" title="annotation in javax.ws.rs.core"><code>Context</code></a>,
<a href="../../../../javax/ws/rs/ext/MessageBodyReader.html" title="interface in javax.ws.rs.ext"><code>MessageBodyReader</code></a>,
<a href="../../../../javax/ws/rs/ext/MessageBodyWriter.html" title="interface in javax.ws.rs.ext"><code>MessageBodyWriter</code></a>,
<a href="../../../../javax/ws/rs/ext/ContextResolver.html" title="interface in javax.ws.rs.ext"><code>ContextResolver</code></a>,
<a href="../../../../javax/ws/rs/ext/ExceptionMapper.html" title="interface in javax.ws.rs.ext"><code>ExceptionMapper</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;<a href="../../../../javax/ws/rs/ext/ContextResolver.html" title="interface in javax.ws.rs.ext">ContextResolver</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../javax/ws/rs/ext/Providers.html#getContextResolver-java.lang.Class-javax.ws.rs.core.MediaType-">getContextResolver</a></span>(java.lang.Class&lt;T&gt;&nbsp;contextType,
<a href="../../../../javax/ws/rs/core/MediaType.html" title="class in javax.ws.rs.core">MediaType</a>&nbsp;mediaType)</code>
<div class="block">Get a context resolver for a particular type of context and media type.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>&lt;T extends java.lang.Throwable&gt;<br><a href="../../../../javax/ws/rs/ext/ExceptionMapper.html" title="interface in javax.ws.rs.ext">ExceptionMapper</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../javax/ws/rs/ext/Providers.html#getExceptionMapper-java.lang.Class-">getExceptionMapper</a></span>(java.lang.Class&lt;T&gt;&nbsp;type)</code>
<div class="block">Get an exception mapping provider for a particular class of exception.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;<a href="../../../../javax/ws/rs/ext/MessageBodyReader.html" title="interface in javax.ws.rs.ext">MessageBodyReader</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../javax/ws/rs/ext/Providers.html#getMessageBodyReader-java.lang.Class-java.lang.reflect.Type-java.lang.annotation.Annotation:A-javax.ws.rs.core.MediaType-">getMessageBodyReader</a></span>(java.lang.Class&lt;T&gt;&nbsp;type,
java.lang.reflect.Type&nbsp;genericType,
java.lang.annotation.Annotation[]&nbsp;annotations,
<a href="../../../../javax/ws/rs/core/MediaType.html" title="class in javax.ws.rs.core">MediaType</a>&nbsp;mediaType)</code>
<div class="block">Get a message body reader that matches a set of criteria.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;<a href="../../../../javax/ws/rs/ext/MessageBodyWriter.html" title="interface in javax.ws.rs.ext">MessageBodyWriter</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../javax/ws/rs/ext/Providers.html#getMessageBodyWriter-java.lang.Class-java.lang.reflect.Type-java.lang.annotation.Annotation:A-javax.ws.rs.core.MediaType-">getMessageBodyWriter</a></span>(java.lang.Class&lt;T&gt;&nbsp;type,
java.lang.reflect.Type&nbsp;genericType,
java.lang.annotation.Annotation[]&nbsp;annotations,
<a href="../../../../javax/ws/rs/core/MediaType.html" title="class in javax.ws.rs.core">MediaType</a>&nbsp;mediaType)</code>
<div class="block">Get a message body writer that matches a set of criteria.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getMessageBodyReader-java.lang.Class-java.lang.reflect.Type-java.lang.annotation.Annotation:A-javax.ws.rs.core.MediaType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMessageBodyReader</h4>
<pre>&lt;T&gt;&nbsp;<a href="../../../../javax/ws/rs/ext/MessageBodyReader.html" title="interface in javax.ws.rs.ext">MessageBodyReader</a>&lt;T&gt;&nbsp;getMessageBodyReader(java.lang.Class&lt;T&gt;&nbsp;type,
java.lang.reflect.Type&nbsp;genericType,
java.lang.annotation.Annotation[]&nbsp;annotations,
<a href="../../../../javax/ws/rs/core/MediaType.html" title="class in javax.ws.rs.core">MediaType</a>&nbsp;mediaType)</pre>
<div class="block">Get a message body reader that matches a set of criteria. The set of
readers is first filtered by comparing the supplied value of
<code>mediaType</code> with the value of each reader's
<a href="../../../../javax/ws/rs/Consumes.html" title="annotation in javax.ws.rs"><code>Consumes</code></a>, ensuring the supplied value of
<code>type</code> is assignable to the generic type of the reader, and
eliminating those that do not match.
The list of matching readers is then ordered with those with the best
matching values of <a href="../../../../javax/ws/rs/Consumes.html" title="annotation in javax.ws.rs"><code>Consumes</code></a> (x/y > x&#47;* > *&#47;*)
sorted first. Finally, the
<a href="../../../../javax/ws/rs/ext/MessageBodyReader.html#isReadable-java.lang.Class-java.lang.reflect.Type-java.lang.annotation.Annotation:A-javax.ws.rs.core.MediaType-"><code>MessageBodyReader.isReadable(Class, Type, Annotation[], MediaType)</code></a>
method is called on each reader in order using the supplied criteria and
the first reader that returns <code>true</code> is selected and returned.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - type of the the object that is to be read.</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>type</code> - the class of the object that is to be read.</dd>
<dd><code>genericType</code> - the type of object to be produced. E.g. if the
message body is to be converted into a method parameter, this will be
the formal type of the method parameter as returned by
<code>Class.getGenericParameterTypes</code>.</dd>
<dd><code>annotations</code> - an array of the annotations on the declaration of the
artifact that will be initialized with the produced instance. E.g. if
the message body is to be converted into a method parameter, this will
be the annotations on that parameter returned by
<code>Class.getParameterAnnotations</code>.</dd>
<dd><code>mediaType</code> - the media type of the data that will be read.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a MessageBodyReader that matches the supplied criteria or <code>null</code>
if none is found.</dd>
</dl>
</li>
</ul>
<a name="getMessageBodyWriter-java.lang.Class-java.lang.reflect.Type-java.lang.annotation.Annotation:A-javax.ws.rs.core.MediaType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMessageBodyWriter</h4>
<pre>&lt;T&gt;&nbsp;<a href="../../../../javax/ws/rs/ext/MessageBodyWriter.html" title="interface in javax.ws.rs.ext">MessageBodyWriter</a>&lt;T&gt;&nbsp;getMessageBodyWriter(java.lang.Class&lt;T&gt;&nbsp;type,
java.lang.reflect.Type&nbsp;genericType,
java.lang.annotation.Annotation[]&nbsp;annotations,
<a href="../../../../javax/ws/rs/core/MediaType.html" title="class in javax.ws.rs.core">MediaType</a>&nbsp;mediaType)</pre>
<div class="block">Get a message body writer that matches a set of criteria. The set of
writers is first filtered by comparing the supplied value of
<code>mediaType</code> with the value of each writer's
<a href="../../../../javax/ws/rs/Produces.html" title="annotation in javax.ws.rs"><code>Produces</code></a>, ensuring the supplied value of
<code>type</code> is assignable to the generic type of the reader, and
eliminating those that do not match.
The list of matching writers is then ordered with those with the best
matching values of <a href="../../../../javax/ws/rs/Produces.html" title="annotation in javax.ws.rs"><code>Produces</code></a> (x/y > x&#47;* > *&#47;*)
sorted first. Finally, the
<a href="../../../../javax/ws/rs/ext/MessageBodyWriter.html#isWriteable-java.lang.Class-java.lang.reflect.Type-java.lang.annotation.Annotation:A-javax.ws.rs.core.MediaType-"><code>MessageBodyWriter.isWriteable(Class, Type, Annotation[], MediaType)</code></a>
method is called on each writer in order using the supplied criteria and
the first writer that returns <code>true</code> is selected and returned.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - type of the object that is to be written.</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>type</code> - the class of the object that is to be written.</dd>
<dd><code>genericType</code> - the type of object to be written. E.g. if the
message body is to be produced from a field, this will be
the declared type of the field as returned by <code>Field.getGenericType</code>.</dd>
<dd><code>annotations</code> - an array of the annotations on the declaration of the
artifact that will be written. E.g. if the
message body is to be produced from a field, this will be
the annotations on that field returned by
<code>Field.getDeclaredAnnotations</code>.</dd>
<dd><code>mediaType</code> - the media type of the data that will be written.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a MessageBodyReader that matches the supplied criteria or <code>null</code>
if none is found.</dd>
</dl>
</li>
</ul>
<a name="getExceptionMapper-java.lang.Class-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getExceptionMapper</h4>
<pre>&lt;T extends java.lang.Throwable&gt;&nbsp;<a href="../../../../javax/ws/rs/ext/ExceptionMapper.html" title="interface in javax.ws.rs.ext">ExceptionMapper</a>&lt;T&gt;&nbsp;getExceptionMapper(java.lang.Class&lt;T&gt;&nbsp;type)</pre>
<div class="block">Get an exception mapping provider for a particular class of exception.
Returns the provider whose generic type is the nearest superclass of
<code>type</code>.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - type of the exception handled by the exception mapping provider.</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>type</code> - the class of exception.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an <a href="../../../../javax/ws/rs/ext/ExceptionMapper.html" title="interface in javax.ws.rs.ext"><code>ExceptionMapper</code></a> for the supplied type or <code>null</code>
if none is found.</dd>
</dl>
</li>
</ul>
<a name="getContextResolver-java.lang.Class-javax.ws.rs.core.MediaType-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getContextResolver</h4>
<pre>&lt;T&gt;&nbsp;<a href="../../../../javax/ws/rs/ext/ContextResolver.html" title="interface in javax.ws.rs.ext">ContextResolver</a>&lt;T&gt;&nbsp;getContextResolver(java.lang.Class&lt;T&gt;&nbsp;contextType,
<a href="../../../../javax/ws/rs/core/MediaType.html" title="class in javax.ws.rs.core">MediaType</a>&nbsp;mediaType)</pre>
<div class="block">Get a context resolver for a particular type of context and media type.
The set of resolvers is first filtered by comparing the supplied value of
<code>mediaType</code> with the value of each resolver's
<a href="../../../../javax/ws/rs/Produces.html" title="annotation in javax.ws.rs"><code>Produces</code></a>, ensuring the generic type of the context
resolver is assignable to the supplied value of <code>contextType</code>, and
eliminating those that do not match. If only one resolver matches the
criteria then it is returned. If more than one resolver matches then the
list of matching resolvers is ordered with those with the best
matching values of <a href="../../../../javax/ws/rs/Produces.html" title="annotation in javax.ws.rs"><code>Produces</code></a> (x/y > x&#47;* > *&#47;*)
sorted first. A proxy is returned that delegates calls to
<a href="../../../../javax/ws/rs/ext/ContextResolver.html#getContext-java.lang.Class-"><code>ContextResolver.getContext(java.lang.Class)</code></a> to each matching context
resolver in order and returns the first non-null value it obtains or null
if all matching context resolvers return null.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - type of the context.</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>contextType</code> - the class of context desired.</dd>
<dd><code>mediaType</code> - the media type of data for which a context is required.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a matching context resolver instance or <code>null</code> if no matching
context providers are found.</dd>
</dl>
</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/ext/Provider.html" title="annotation in javax.ws.rs.ext"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../javax/ws/rs/ext/ReaderInterceptor.html" title="interface in javax.ws.rs.ext"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?javax/ws/rs/ext/Providers.html" target="_top">Frames</a></li>
<li><a href="Providers.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>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>