tags:

views:

31

answers:

0

I follow the Weld's doc

in the section 4.11. The InjectionPoint object

There is a very interesting example about how to obtain the http parameter using CDI

but i copy-pasted the code into netbeans, everything compiles, but has an deployment error

Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Injection point has unsatisfied dependencies. Injection point: parameter 1 of java.lang.String com.test.HttpParamProducer.getParamValue(javax.enterprise.inject.spi.InjectionPoint,javax.servlet.ServletRequest); Qualifiers: [@javax.enterprise.inject.Default()]

how to solve this problem???

public class HttpParamProducer {

   @HttpParam("")
   @Produces
   String getParamValue(
           InjectionPoint ip, ServletRequest request) {

      return request.getParameter(ip.getAnnotated().getAnnotation(HttpParam.class).value());

   }
}