2 Replies Latest reply on Sep 8, 2008 11:28 AM by demetrio812

    Seam resource problem


      according to this document, I made the following Resource class that works perfectly:

      public class ImageDelivery extends AbstractResource {
           * The maximum width allowed for image rescaling
          private static final int MAX_IMAGE_WIDTH = 1024;
          public String getResourcePath() {
              return "/imageDelivery";
          public void getResource(final HttpServletRequest request, final HttpServletResponse response)
                  throws ServletException, IOException {
              new ContextualHttpServletRequest(request) {
                  public void process() throws IOException {
                      doWork(request, response);
          private void doWork(HttpServletRequest request, HttpServletResponse response) throws IOException {

      Then I had to call a Seam component called uiOptions that looks like this:

      public class UIOptions {
           @In FacesContext facesContext;

      I get the component from the doWork method using this code:

      UIOptions uiOptions = (UIOptions) Component.getInstance("uiOptions", true);

      The problem is that when I call some method of uiOptions that use facesContext it give me the following error:

      org.jboss.seam.RequiredException: @In attribute requires non-null value: uiOptions.facesContext

      so facesContext doesn't exists (is null) on injecting from a resource call, if I use uiOptions in the normal way (for example inside XHTML) it works perfectly...

      Any idea on how to make it works?

      Thanks a lot!

      Demetrio Filocamo