6 Replies Latest reply on Sep 28, 2006 11:11 AM by fhh

    Request Parameter not found

    wsollers


      Trying to do:

      @RequestParameter ( "javax.servlet.request.X509Certificate" )
      private X509Certificate[] userCerts;

      And the cert is in the request:

      Request key: javax.servlet.request.X509Certificate value: [Ljava.security.cert.X509Certificate;@155ec9f4

      But it is brought into my ejb3 as null...
      if ( userCerts == null ) {
      /* no certs no access */
      System.out.println ( "No client cert injected" );
      return "NO_CLIENT_CERTS";
      }

      I always get the "No client cert injected" debug...

      Any ideas what I did / am doing wrong?

        • 1. Re: Request Parameter not found

          @RequestParameter is for HTTP request params.

          http://host/page.jsf?username=Steve

          @RequestParameter("username")
          String username;

          assert username == Steve

          I'd guess the problem here is that you don't actually have a request parameter with this data or that Seam has no idea how translate from this string (how did you generate the string?) into an X509Certificate[].

          • 2. Re: Request Parameter not found
            wsollers

            Ok, point taken looked into the servlet dox, it is a request attribute passed through jk...

            NOT a request parameter.

            going to try:

            @In(value="javax.servlet.request.X509Certificate", scope=ScopeType.EVENT)

            • 3. Re: Request Parameter not found
              wsollers

              @In didn't work. However this did:


              FacesContext ctx = FacesContext.getCurrentInstance();
              HttpServletRequest currentRequest = (HttpServletRequest) ctx.getExternalContext().getRequest();
              userCerts3 = ( X509Certificate[] ) currentRequest.getAttribute( "javax.servlet.request.X509Certificate" );


              Its like the WebRequestContext that should be in my context heirarchy is just messed up. Using Seam nightly from 9/17 going to try todays build next.

              Any help or pointers appreciated.

              • 4. Re: Request Parameter not found

                I can verify that @In works appropriated for request attributes.

                • 5. Re: Request Parameter not found
                  wsollers

                  Hmmm I tried @In as follows:

                  @In(value="javax.servlet.request.X509Certificate", scope=ScopeType.EVENT)

                  Use case was a Stateless Session Bean for logging on ( Hooking up Seam Auth stuff )

                  And injected value was null.

                  But:

                  FacesContext ctx = FacesContext.getCurrentInstance();
                  HttpServletRequest currentRequest = (HttpServletRequest) ctx.getExternalContext().getRequest();
                  userCerts3 = ( X509Certificate[] ) currentRequest.getAttribute( "javax.servlet.request.X509Certificate" );


                  Worked.

                  I will recheck my notes.

                  Thanks for the help. ( Still waiting for Lockheed to get the Dev support contract in place.)

                  • 6. Re: Request Parameter not found

                    If you are try to inject this into a session bean you have to declare the seam interceptor - either by using the @Interceptor-Annotation or by using components.xml.

                    Regards

                    fhh