Skip to content

Commit

Permalink
WELD-456, WELD-457
Browse files Browse the repository at this point in the history
  • Loading branch information
nickarls committed Mar 14, 2010
1 parent d520d7b commit 1aed0e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion reference/en-US/events.xml
Expand Up @@ -364,7 +364,7 @@ public class Catalog {
products.add(product);
}
void addProduct(@Observes(during = AFTER_SUCCESS) @Deleted Product product) {
void removeProduct(@Observes(during = AFTER_SUCCESS) @Deleted Product product) {
products.remove(product);
}
}]]></programlisting>
Expand Down
10 changes: 7 additions & 3 deletions reference/en-US/injection.xml
Expand Up @@ -743,14 +743,18 @@ public @interface HttpParam {
<programlisting role="JAVA"><![CDATA[class HttpParams
@Produces @HttpParam("")
String getParamValue(ServletRequest request, InjectionPoint ip) {
String getParamValue(InjectionPoint ip) {
ServletRequest request = (ServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
return request.getParameter(ip.getAnnotated().getAnnotation(HttpParam.class).value());
}
}]]></programlisting>

<para>(Note that the <literal>value()</literal> member of the <literal>HttpParam</literal>
annotation is ignored by the container since it is annotated <literal>@Nonbinding.</literal>)</para>
<para>Note that acquiring of the request in this example is JSF-centric. For a more generic solution
you could write your own prodcuer for the request and have it injected as a method parameter.</para>

<para>Note also that the <literal>value()</literal> member of the <literal>HttpParam</literal>
annotation is ignored by the container since it is annotated <literal>@Nonbinding.</literal></para>

<para>The container provides a built-in bean that implements the <literal>InjectionPoint</literal>
interface:</para>
Expand Down

0 comments on commit 1aed0e9

Please sign in to comment.