blob: 2c2da4af3cc90061610cc1d84bead2391edd4e97 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<title>Apache Wink : JAX-RS Context Information</title>
<link rel="stylesheet" href="styles/site.css" type="text/css" />
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
<td valign="top" class="pagebody">
<div class="pageheader">
<span class="pagetitle">
Apache Wink : JAX-RS Context Information
<div class="pagesubheading">
This page last changed on Aug 24, 2009 by <font color="#0050B2">bluk</font>.
<h1><a name="JAX-RSContextInformation-ContextInformation"></a>Context Information</h1>
<p>In addition to request parameters and entities, there is more request information that can be accessed via request @Context injected variables.</p>
<p>When a resource method is invoked, the runtime injects the @Context variables.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
@Path(<span class="code-quote">"/resource"</span>)
<span class="code-keyword">public</span> class Resource {
<span class="code-keyword">private</span> HttpHeaders headers;
<span class="code-keyword">public</span> void get(@Context UriInfo uriInfo) {
/* use headers or uriInfo variable here */
<p><a name="JAX-RSContextInformation-HttpHeaders"></a></p>
<h3><a name=""></a></h3>
<p>HttpHeaders provides methods that allow users to access request headers. A few convenience methods such as #getAcceptableLanguages() and #getAcceptableMediaTypes() provide client preference sorted acceptable responses.</p>
<p><a name="JAX-RSContextInformation-UriInfo"></a></p>
<h3><a name=""></a></h3>
<p>UriInfo provides methods so developers can find or build URI information of the current request.</p>
<p><a name="JAX-RSContextInformation-SecurityContext"></a></p>
<h3><a name=""></a></h3>
<p>SecurityContext provides access to the security information.</p>
<p><a name="JAX-RSContextInformation-Request"></a></p>
<h3><a name=""></a></h3>
<p>Request provides methods for evaluating preconditions and for selecting the best response variant based on the request headers.</p>
<p><a name="JAX-RSContextInformation-Providers"></a></p>
<h3><a name=""></a></h3>
<p>Providers allows access to the user and runtime provided MessageBodyReaders, MessageBodyWriters, ContextResolvers, and ExceptionMappers. It is useful for other providers but can sometimes be useful for resource methods and classes.</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<td height="12" background=""><img src="images/border/spacer.gif" width="1" height="1" border="0"/></td>
<td align="center"><font color="grey">Document generated by Confluence on Nov 11, 2009 06:57</font></td>