Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.7.2
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      n/a

      Description

      We should open our new ResourceRegistry api through a component.

      <ice:outputResource resource="#{bean.resource}"/>

      Users could use our own resource implementations or implement their own Resource classes.
      1. ICE-2348.patch
        34 kB
        Mircea Toma

        Issue Links

          Activity

          Philip Breau created issue -
          Hide
          Philip Breau added a comment -

          sample implementation and test case

          Show
          Philip Breau added a comment - sample implementation and test case
          Philip Breau made changes -
          Field Original Value New Value
          Attachment OutputResourceComponent.war [ 10729 ]
          Philip Breau made changes -
          Hide
          Wolfgang Röckelein added a comment -

          And as a addition to that, it would be really useful, if the xhtmlrenderer from The Flying Saucer Project (https://xhtmlrenderer.dev.java.net/) could be used. As icefaces builds up a DOM already, you could use this renderer to render this DOM to a pdf and output the pdf!

          org.w3c.dom.Document xhtmlContent = ...;
          ITextRenderer renderer = new ITextRenderer();
          Renderer.setDocument(xhtmlContent,"");
          renderer.layout();
          response.setContentType("application/pdf");
          OutputStream browserStream = response.getOutputStream();
          renderer.createPDF(browserStream);
          return;

          So one could offer a link which return the current page as a PDF document.

          Show
          Wolfgang Röckelein added a comment - And as a addition to that, it would be really useful, if the xhtmlrenderer from The Flying Saucer Project ( https://xhtmlrenderer.dev.java.net/ ) could be used. As icefaces builds up a DOM already, you could use this renderer to render this DOM to a pdf and output the pdf! org.w3c.dom.Document xhtmlContent = ...; ITextRenderer renderer = new ITextRenderer(); Renderer.setDocument(xhtmlContent,""); renderer.layout(); response.setContentType("application/pdf"); OutputStream browserStream = response.getOutputStream(); renderer.createPDF(browserStream); return; So one could offer a link which return the current page as a PDF document.
          Philip Breau made changes -
          Issue Type Bug [ 1 ] New Feature [ 2 ]
          Hide
          Stefan Niederhauser added a comment -

          An additional attribute 'filename' that sets the Content-Disposition HTTP header would also be nice.

          Show
          Stefan Niederhauser added a comment - An additional attribute 'filename' that sets the Content-Disposition HTTP header would also be nice.
          Hide
          Ted Goddard added a comment -

          Recommend that we include this component in 1.7.2.

          Show
          Ted Goddard added a comment - Recommend that we include this component in 1.7.2.
          Ted Goddard made changes -
          Fix Version/s 1.7.2 [ 10130 ]
          Assignee Philip Breau [ philip.breau ]
          Hide
          Ted Goddard added a comment -

          The Resource interface should be extended as follows:

          String getFilename()
          Date getExpires()

          ResourceDispatcher would be modified so that

          if getFilename() does not return null, set Content-Disposition header to "attachment; filename=" getFilename();
          if getExpires() returns null, use monitor.expiresBy() else use getExpires() value

          Optional:

          If mimetype is specified in the component attribute, provide this in the rendered link.

          Extend Resource via:
          String getMimetype()

          ResourceDispatcher would be modified so that

          if getMimetype() does not return null, set Content-Type header to getMimetype() otherwise use the mime-type passed at registration. Pass null for mimetype during registration for resources whose mimetype is not defined at that time.

          Show
          Ted Goddard added a comment - The Resource interface should be extended as follows: String getFilename() Date getExpires() ResourceDispatcher would be modified so that if getFilename() does not return null, set Content-Disposition header to "attachment; filename=" getFilename(); if getExpires() returns null, use monitor.expiresBy() else use getExpires() value Optional: If mimetype is specified in the component attribute, provide this in the rendered link. Extend Resource via: String getMimetype() ResourceDispatcher would be modified so that if getMimetype() does not return null, set Content-Type header to getMimetype() otherwise use the mime-type passed at registration. Pass null for mimetype during registration for resources whose mimetype is not defined at that time.
          Hide
          Ted Goddard added a comment -

          Mircea, please review the suggested changes for the Resource and ResourceDispatcher.

          Show
          Ted Goddard added a comment - Mircea, please review the suggested changes for the Resource and ResourceDispatcher.
          Ted Goddard made changes -
          Assignee Philip Breau [ philip.breau ] Mircea Toma [ mircea.toma ]
          Hide
          Ted Goddard added a comment -

          outputResource should also take an image value and, if present, render an anchor tag around the specified image:

          <ice:outputResource image="#

          {resource.imageURL}

          " >

          Optional:

          outputResource should also take a type value:

          <ice:outputResource type="button" > or
          <ice:outputResource type="link" > or

          Show
          Ted Goddard added a comment - outputResource should also take an image value and, if present, render an anchor tag around the specified image: <ice:outputResource image="# {resource.imageURL} " > Optional: outputResource should also take a type value: <ice:outputResource type="button" > or <ice:outputResource type="link" > or
          Michael Thiem made changes -
          Hide
          Mircea Toma added a comment -

          Ted,
          In order to provide all these features in ResourceRegistry API I feel that I need to change it bit so that it can adapt elegantly to all of resource downloading requirements. I really don't want to have a mangled API that all users will be forced to learn and then later, when we want to clean it up, unlearn. I can create a patch with the changes before checking it in.

          Show
          Mircea Toma added a comment - Ted, In order to provide all these features in ResourceRegistry API I feel that I need to change it bit so that it can adapt elegantly to all of resource downloading requirements. I really don't want to have a mangled API that all users will be forced to learn and then later, when we want to clean it up, unlearn. I can create a patch with the changes before checking it in.
          Mircea Toma made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Hide
          Stefan Niederhauser added a comment -

          Another nice thing would be "parametrized resources" meaning that you have the possibility to add a parameter to the resource URI and that parameter would be given to the Resource. The resource could then return different data depending on the provided parameter.

          A possible use could be graphical text images. If you have to display graphics with different texts you don't want to draw all possible images in a graphics program, but rather draw them dynamically using java 2D. The text to be displayed would be the resource parameter.

          Show
          Stefan Niederhauser added a comment - Another nice thing would be "parametrized resources" meaning that you have the possibility to add a parameter to the resource URI and that parameter would be given to the Resource. The resource could then return different data depending on the provided parameter. A possible use could be graphical text images. If you have to display graphics with different texts you don't want to draw all possible images in a graphics program, but rather draw them dynamically using java 2D. The text to be displayed would be the resource parameter.
          Hide
          Ken Fyten added a comment -

          Since there's been a few iterations of requirements please attacha mockup of what the final component TLD would look like for review (attached to this JIRA) prior to commencing development.

          Show
          Ken Fyten added a comment - Since there's been a few iterations of requirements please attacha mockup of what the final component TLD would look like for review (attached to this JIRA) prior to commencing development.
          Ken Fyten made changes -
          Assignee Priority P2
          Affects Version/s 1.7DR#2 [ 10110 ]
          Hide
          Dirk Sandhorst added a comment -

          It would be very important, that it is possible to show the file in a new window (e.g. by target="_blank"), because in many cases the application window shall still be visible, even when the file (e.g. a pdf-file or xls-File) is shown.

          Show
          Dirk Sandhorst added a comment - It would be very important, that it is possible to show the file in a new window (e.g. by target="_blank"), because in many cases the application window shall still be visible, even when the file (e.g. a pdf-file or xls-File) is shown.
          Hide
          Mircea Toma added a comment -

          Added patch with enhanced ResourceRegistry API.

          Show
          Mircea Toma added a comment - Added patch with enhanced ResourceRegistry API.
          Mircea Toma made changes -
          Attachment ICE-2348.patch [ 11099 ]
          Hide
          Mircea Toma added a comment -

          Add patched version of the sample app.

          Show
          Mircea Toma added a comment - Add patched version of the sample app.
          Mircea Toma made changes -
          Hide
          Mircea Toma added a comment -

          Philip,

          Please have a look at the modified sample application to see if the implemented features in the patch are fulfilling your/client's requirements.

          Show
          Mircea Toma added a comment - Philip, Please have a look at the modified sample application to see if the implemented features in the patch are fulfilling your/client's requirements.
          Mircea Toma made changes -
          Assignee Mircea Toma [ mircea.toma ] Philip Breau [ philip.breau ]
          Hide
          Stefan Niederhauser added a comment -

          The things I have added for the "parametrized resource":

          public class ResourceDispatcher implements Server {

          private static final String PARAMETER_NAME = "param";

          private static final String PARAMETER_ENCODING = "UTF-8";

          public URI getParametrizedResourceURI(URI resourceURI, String parameter) {
          try

          { return URI.create(resourceURI.toString() + "?" + PARAMETER_NAME + "=" + URLEncoder.encode(parameter, PARAMETER_ENCODING)); }

          catch (UnsupportedEncodingException e)

          { // utf-8 is supposed to exist return null; }

          }

          private class ResourceServer implements Server, ResponseHandler {
          private ResponseHandler notModified = new ResponseHandler() {

          private String parameter;

          public void service(Request request) throws Exception {
          parameter = request.getParameter("param", null);
          if (parameter != null)

          { // is the iso encoding always right??? parameter = new String(parameter.getBytes("ISO-8859-1"), PARAMETER_ENCODING); }

          ...
          }

          public void respond(Response response) throws Exception

          { .... response.writeBodyFrom(resource.open(parameter)); }

          }

          public interface Resource

          { InputStream open(String parameter) throws IOException; }

          public interface ResourceRegistry

          { URI getParametrizedResourceURI(URI registeredResourceURI, String parameter); }

          public class BridgeFacesContext extends FacesContext implements ResourceRegistry {
          public URI getParametrizedResourceURI(URI resourceURI, String parameter)

          { return resourceDispatcher.getParametrizedResourceURI(resourceURI, parameter); }

          }

          Show
          Stefan Niederhauser added a comment - The things I have added for the "parametrized resource": public class ResourceDispatcher implements Server { private static final String PARAMETER_NAME = "param"; private static final String PARAMETER_ENCODING = "UTF-8"; public URI getParametrizedResourceURI(URI resourceURI, String parameter) { try { return URI.create(resourceURI.toString() + "?" + PARAMETER_NAME + "=" + URLEncoder.encode(parameter, PARAMETER_ENCODING)); } catch (UnsupportedEncodingException e) { // utf-8 is supposed to exist return null; } } private class ResourceServer implements Server, ResponseHandler { private ResponseHandler notModified = new ResponseHandler() { private String parameter; public void service(Request request) throws Exception { parameter = request.getParameter("param", null); if (parameter != null) { // is the iso encoding always right??? parameter = new String(parameter.getBytes("ISO-8859-1"), PARAMETER_ENCODING); } ... } public void respond(Response response) throws Exception { .... response.writeBodyFrom(resource.open(parameter)); } } public interface Resource { InputStream open(String parameter) throws IOException; } public interface ResourceRegistry { URI getParametrizedResourceURI(URI registeredResourceURI, String parameter); } public class BridgeFacesContext extends FacesContext implements ResourceRegistry { public URI getParametrizedResourceURI(URI resourceURI, String parameter) { return resourceDispatcher.getParametrizedResourceURI(resourceURI, parameter); } }
          Hide
          Philip Breau added a comment -

          Updated OuputResource component to use ICE-2348.patch. Resources now load as attachments with the browser 'save as...run as ..' support. Works well in IE, but in Firefox the bridge is disposed once the link is clicked.

          Show
          Philip Breau added a comment - Updated OuputResource component to use ICE-2348 .patch. Resources now load as attachments with the browser 'save as...run as ..' support. Works well in IE, but in Firefox the bridge is disposed once the link is clicked.
          Philip Breau made changes -
          Attachment OutputResourceComponent.zip [ 11102 ]
          Philip Breau made changes -
          Status In Progress [ 3 ] Open [ 1 ]
          Hide
          Philip Breau added a comment -

          Mircea, is it possible for the ResourceDispatcher to still support registering named resources that are not FileResources? I can see people wanting control over naming even if they're not using FileResources, say, serving a ByteArray for dynamically generated streams that should appear to the user as a normal named file.

          Show
          Philip Breau added a comment - Mircea, is it possible for the ResourceDispatcher to still support registering named resources that are not FileResources? I can see people wanting control over naming even if they're not using FileResources, say, serving a ByteArray for dynamically generated streams that should appear to the user as a normal named file.
          Hide
          Philip Breau added a comment -

          above mentioned issue with the bridge being disposed in Firefox when content-disposition and attachment are set have also been reported on the forum when using a custom servlet (http://www.icefaces.org/JForum/posts/list/8909.page#37232).

          Show
          Philip Breau added a comment - above mentioned issue with the bridge being disposed in Firefox when content-disposition and attachment are set have also been reported on the forum when using a custom servlet ( http://www.icefaces.org/JForum/posts/list/8909.page#37232 ).
          Hide
          Philip Breau added a comment -

          Mircea, please see last 3 comments

          Show
          Philip Breau added a comment - Mircea, please see last 3 comments
          Philip Breau made changes -
          Assignee Philip Breau [ philip.breau ] Mircea Toma [ mircea.toma ]
          Hide
          Mircea Toma added a comment -

          1) The renderer needs to render a target="blank" attribute on the anchor so that the browser doesn't navigate to the download URL. Check out modified renderer I sent.

          2) Yes, you can set a file name any resources. The FileResource is just one of the possible implementations. You can extend ByteArrayResource and setFileName on the Resource.Options callback.

          3) Same as in 1).

          Show
          Mircea Toma added a comment - 1) The renderer needs to render a target="blank" attribute on the anchor so that the browser doesn't navigate to the download URL. Check out modified renderer I sent. 2) Yes, you can set a file name any resources. The FileResource is just one of the possible implementations. You can extend ByteArrayResource and setFileName on the Resource.Options callback. 3) Same as in 1).
          Mircea Toma made changes -
          Assignee Mircea Toma [ mircea.toma ] Philip Breau [ philip.breau ]
          Hide
          Philip Breau added a comment -

          added target blank for the link, and Ted's suggestions for image and type button support

          Show
          Philip Breau added a comment - added target blank for the link, and Ted's suggestions for image and type button support
          Philip Breau made changes -
          Attachment OutputResourceComponent.zip [ 11106 ]
          Philip Breau made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Hide
          Philip Breau added a comment -

          only parameterized resources haven't been implemented yet. Should create a new jira for that. IE 6 does not seem to respect the filename specified in content-disposition header and will attempt to save the file with its encoded name

          Show
          Philip Breau added a comment - only parameterized resources haven't been implemented yet. Should create a new jira for that. IE 6 does not seem to respect the filename specified in content-disposition header and will attempt to save the file with its encoded name
          Philip Breau made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Mircea Toma added a comment -

          Parameterized resources can be easily created with the current API. Just implement the Resource interface and pass any needed parameters in the constructor of the implementing class.

          Show
          Mircea Toma added a comment - Parameterized resources can be easily created with the current API. Just implement the Resource interface and pass any needed parameters in the constructor of the implementing class.
          Hide
          Stefan Niederhauser added a comment -

          You are right Mircea, parametrized resources are feasible with the current API.
          One thing that could be a problem is performance when there are lots of registered resources.
          The dispatch from a URL to a resource is done through an iterator of all registered resources. That could take relatively long.

          Show
          Stefan Niederhauser added a comment - You are right Mircea, parametrized resources are feasible with the current API. One thing that could be a problem is performance when there are lots of registered resources. The dispatch from a URL to a resource is done through an iterator of all registered resources. That could take relatively long.
          Hide
          Mircea Toma added a comment -

          The dispatching and iteration is infinitesimal compared to the time required for the HTTP connections and the corresponding transfers.
          What you are asking is pretty much what a Servlet does, generate dynamic content based on some input values read from the HTTP request. Is there a reason why you cannot use a Servlet for what you need?!

          Show
          Mircea Toma added a comment - The dispatching and iteration is infinitesimal compared to the time required for the HTTP connections and the corresponding transfers. What you are asking is pretty much what a Servlet does, generate dynamic content based on some input values read from the HTTP request. Is there a reason why you cannot use a Servlet for what you need?!
          Hide
          Stefan Niederhauser added a comment -

          Sure I could write a servlet, but it's easier to use a higher level API.
          I think this component is ok for our purposes.

          Show
          Stefan Niederhauser added a comment - Sure I could write a servlet, but it's easier to use a higher level API. I think this component is ok for our purposes.
          Mircea Toma made changes -
          Assignee Philip Breau [ philip.breau ] Mircea Toma [ mircea.toma ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #17231 Fri Jul 25 06:35:11 MDT 2008 mircea.toma ICE-2348 Enhance ResourceRegistry API to fulfill the requirements needed by OutputResource component.
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/outputchart/AbstractChart.java
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/inputrichtext/InputRichText.java
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/JarResource.java
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/FileResource.java
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/core/ResourceDispatcher.java
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/ByteArrayResource.java
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/StringResource.java
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/ext/renderkit/ImageRenderer.java
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/outputchart/ChartResource.java
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/BridgeFacesContext.java
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/ResourceRegistry.java
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/Resource.java
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #17232 Fri Jul 25 06:44:14 MDT 2008 mircea.toma ICE-2348 Enhance ResourceRegistry API to fulfill the requirements needed by OutputResource component.
          Files Changed
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/context/ByteArrayResource.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/context/StringResource.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/context/ResourceRegistry.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/context/FileResource.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/context/BridgeFacesContext.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/component/src/com/icesoft/faces/component/ext/renderkit/ImageRenderer.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/webapp/http/core/ResourceDispatcher.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/context/Resource.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/context/JarResource.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/component/src/com/icesoft/faces/component/inputrichtext/InputRichText.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/component/src/com/icesoft/faces/component/outputchart/ChartResource.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/component/src/com/icesoft/faces/component/outputchart/AbstractChart.java
          Hide
          Mircea Toma added a comment -

          Applied ResourceRegistry API changes to fulfill the requirements needed by OutputResource component.

          Show
          Mircea Toma added a comment - Applied ResourceRegistry API changes to fulfill the requirements needed by OutputResource component.
          Hide
          Mircea Toma added a comment -

          Back to you Philip!

          Show
          Mircea Toma added a comment - Back to you Philip!
          Mircea Toma made changes -
          Assignee Mircea Toma [ mircea.toma ] Philip Breau [ philip.breau ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #17251 Wed Jul 30 07:07:53 MDT 2008 mircea.toma ICE-2348 Restore old methods for backwards compatibility and mark them as deprecated.
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/BridgeFacesContext.java
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/ResourceRegistry.java
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #17252 Wed Jul 30 07:08:32 MDT 2008 mircea.toma ICE-2348 Restore old methods for backwards compatibility and mark them as deprecated.
          Files Changed
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/context/ResourceRegistry.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/context/BridgeFacesContext.java
          Hide
          Mircea Toma added a comment -

          Restored old methods for backwards compatibility. Adapted their implementation to use current API. Marked them as deprecated.

          Show
          Mircea Toma added a comment - Restored old methods for backwards compatibility. Adapted their implementation to use current API. Marked them as deprecated.
          Hide
          Isuru Perera added a comment -

          It's better if this component can support CSS. For example, applying the default ICEfaces style classes for button and link types.

          Show
          Isuru Perera added a comment - It's better if this component can support CSS. For example, applying the default ICEfaces style classes for button and link types.
          Hide
          Claudio Tasso added a comment -

          I looked at OutputResourceRender.java and I noticed that in link case the target "blank" is used.
          Is target "blank" necessary for ICEFaces working properly after file download?
          I suppose that target blank was added because without it, after file downloading ICEFaces page does not work any more, is it right?

          Show
          Claudio Tasso added a comment - I looked at OutputResourceRender.java and I noticed that in link case the target "blank" is used. Is target "blank" necessary for ICEFaces working properly after file download? I suppose that target blank was added because without it, after file downloading ICEFaces page does not work any more, is it right?
          Ken Fyten made changes -
          Fix Version/s 1.7.2RC1 [ 10140 ]
          Fix Version/s 1.7.2 [ 10130 ]
          Ken Fyten made changes -
          Fix Version/s 1.7.2 [ 10130 ]
          Fix Version/s 1.7.2RC1 [ 10140 ]
          Hide
          Kristian Luck added a comment -

          Mircea Toma noted that 'The renderer needs to render a target="blank" attribute..." I'm new to ICEfaces, but this seems strikingly similar to the reserved [link] target attribute value of "_blank", which has the following special meaning: "The user agent should load the designated document in a new, unnamed window." (http://www.w3.org/TR/html401/types.html#type-frame-target). Should this have been made "_blank" instead of "blank"?

          Show
          Kristian Luck added a comment - Mircea Toma noted that 'The renderer needs to render a target="blank" attribute..." I'm new to ICEfaces, but this seems strikingly similar to the reserved [link] target attribute value of "_blank", which has the following special meaning: "The user agent should load the designated document in a new, unnamed window." ( http://www.w3.org/TR/html401/types.html#type-frame-target ). Should this have been made "_blank" instead of "blank"?
          Hide
          Asdf Asdf added a comment -

          hello!

          i think there is still a bug in the OutputResourceComponent when using EL for the fileName attribute. i basically downloaded the .war file attached to this case, and added a few lines so it should be easily reproducible:

          in OutputResourceBean.java:

          public String getDynamicFileName()

          { return "i_am_almost_dynamic.pdf"; }

          and in outputResource.jspx:

          <cust:outputResource id="otherPdf"
          resource="#

          {bean.pdfResource}

          "
          mimeType="application/pdf"
          value="Click to load pdf with dynamic filename"
          fileName="#

          {bean.dynamicFileName}

          "
          />

          after clicking on "Click to load pdf with dynamic filename" the app dies with the following stack trace:

          StandardWrapperValve[Blocking Servlet]: PWC1406: Servlet.service() for servlet Blocking Servlet threw exception
          java.lang.NullPointerException: FacesContext -> null
          at javax.faces.component.ValueBindingValueExpressionAdapter.getValue(ValueBindingValueExpressionAdapter.java:98)
          at com.icesoft.faces.component.outputResource.OutputResource.getFileName(OutputResource.java:84)
          at com.icesoft.faces.component.outputResource.OutputResource$1.withOptions(OutputResource.java:46)
          at com.icesoft.faces.webapp.http.core.ResourceDispatcher$ResourceServer.respond(ResourceDispatcher.java:120)
          at com.icesoft.faces.webapp.http.common.standard.CompressingServer$CompressingRequest$1.respond(CompressingServer.java:49)
          at com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:161)
          at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet$ThreadBlockingRequestResponse.respondWith(ThreadBlockingAdaptingServlet.java:36)
          at com.icesoft.faces.webapp.http.common.standard.CompressingServer$CompressingRequest.respondWith(CompressingServer.java:45)
          at com.icesoft.faces.webapp.http.core.ResourceDispatcher$ResourceServer.service(ResourceDispatcher.java:115)
          at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
          at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
          at com.icesoft.faces.webapp.http.common.standard.CompressingServer.service(CompressingServer.java:29)
          at com.icesoft.faces.webapp.http.core.ResourceDispatcher.service(ResourceDispatcher.java:39)
          at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
          at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
          at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
          at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)
          at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:151)
          at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:54)
          at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
          at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
          at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:82)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
          at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:46)
          at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
          at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
          at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
          at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
          at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
          at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
          at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
          at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
          at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
          at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
          at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
          at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
          at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
          at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
          at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
          at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
          at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
          at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
          at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
          at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
          at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

          i will attached my .war file after this message.
          my environment is netbeans 6.5, icefaces from svn (29.09.2008), glassfish2 that was bundled with netbeans.

          best regards, armin walland

          Show
          Asdf Asdf added a comment - hello! i think there is still a bug in the OutputResourceComponent when using EL for the fileName attribute. i basically downloaded the .war file attached to this case, and added a few lines so it should be easily reproducible: in OutputResourceBean.java: public String getDynamicFileName() { return "i_am_almost_dynamic.pdf"; } and in outputResource.jspx: <cust:outputResource id="otherPdf" resource="# {bean.pdfResource} " mimeType="application/pdf" value="Click to load pdf with dynamic filename" fileName="# {bean.dynamicFileName} " /> after clicking on "Click to load pdf with dynamic filename" the app dies with the following stack trace: StandardWrapperValve [Blocking Servlet] : PWC1406: Servlet.service() for servlet Blocking Servlet threw exception java.lang.NullPointerException: FacesContext -> null at javax.faces.component.ValueBindingValueExpressionAdapter.getValue(ValueBindingValueExpressionAdapter.java:98) at com.icesoft.faces.component.outputResource.OutputResource.getFileName(OutputResource.java:84) at com.icesoft.faces.component.outputResource.OutputResource$1.withOptions(OutputResource.java:46) at com.icesoft.faces.webapp.http.core.ResourceDispatcher$ResourceServer.respond(ResourceDispatcher.java:120) at com.icesoft.faces.webapp.http.common.standard.CompressingServer$CompressingRequest$1.respond(CompressingServer.java:49) at com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:161) at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet$ThreadBlockingRequestResponse.respondWith(ThreadBlockingAdaptingServlet.java:36) at com.icesoft.faces.webapp.http.common.standard.CompressingServer$CompressingRequest.respondWith(CompressingServer.java:45) at com.icesoft.faces.webapp.http.core.ResourceDispatcher$ResourceServer.service(ResourceDispatcher.java:115) at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50) at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19) at com.icesoft.faces.webapp.http.common.standard.CompressingServer.service(CompressingServer.java:29) at com.icesoft.faces.webapp.http.core.ResourceDispatcher.service(ResourceDispatcher.java:39) at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50) at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19) at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19) at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63) at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:151) at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:54) at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52) at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29) at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:82) at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:46) at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265) at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106) i will attached my .war file after this message. my environment is netbeans 6.5, icefaces from svn (29.09.2008), glassfish2 that was bundled with netbeans. best regards, armin walland
          Hide
          Asdf Asdf added a comment -

          slightly modified version of the OutputResourceComponent-demoapp to illustrate exception when using EL in "fileName" attribute.

          Show
          Asdf Asdf added a comment - slightly modified version of the OutputResourceComponent-demoapp to illustrate exception when using EL in "fileName" attribute.
          Asdf Asdf made changes -
          Attachment Orc.war [ 11271 ]
          Hide
          Ken Fyten added a comment -

          Re-opened. Looks like we forgot to commit some files for this that are required, and QA didn't get the tests so it didn't fail... (oops).

          Let's make this right for 1.7.2 final.

          Show
          Ken Fyten added a comment - Re-opened. Looks like we forgot to commit some files for this that are required, and QA didn't get the tests so it didn't fail... (oops). Let's make this right for 1.7.2 final.
          Ken Fyten made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #17680 Wed Oct 01 15:26:42 MDT 2008 philip.breau ICE-2348 new outputresource component (no really, this time for sure!)
          - includes comp-showcase example
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/jsp/web/WEB-INF/includes/content/navigation.jspx
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/jsp
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages_es.properties
          Commit graph ADD /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/outputresource/OutputResourceRenderer.java
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages.properties
          Commit graph ADD /icefaces/trunk/icefaces/component-metadata/src/main/resources/conf/custom/outputResource-component.xml
          Commit graph MODIFY /icefaces/trunk/icefaces/component/conf/META-INF/facelet/icefaces.taglib.xml
          Commit graph ADD /icefaces/trunk/icefaces/samples/component-showcase/common-web/WEB-INF/resource/logo.jpg
          Commit graph ADD /icefaces/trunk/icefaces/samples/component-showcase/common-web/WEB-INF/includes/examples/custom/outputResource.jspx
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/jsp/web/WEB-INF/lib
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/FileResource.java
          Commit graph ADD /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/outputresource/OutputResource.java
          Commit graph ADD /icefaces/trunk/icefaces/component-metadata/src/main/resources/conf/custom/outputResource-renderer.xml
          Commit graph ADD /icefaces/trunk/icefaces/samples/component-showcase/portlets/web/Components_OutputResource.jspx
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/jsp/web/showcase.jspx
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/common-web/WEB-INF
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/portlets/conf/liferay/liferay-portlet.xml
          Commit graph ADD /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/outputresource
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/portlets
          Commit graph ADD /icefaces/trunk/icefaces/samples/component-showcase/common-web/WEB-INF/resource/WP_Security_Whitepaper.pdf
          Commit graph ADD /icefaces/trunk/icefaces/samples/component-showcase/common-web/WEB-INF/resource
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/portlets/conf/portlet.xml
          Commit graph ADD /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/bean/examples/component/outputResource
          Commit graph MODIFY /icefaces/trunk/icefaces/core
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/common-web/WEB-INF/faces-config-example-beans.xml
          Commit graph ADD /icefaces/trunk/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/bean/examples/component/outputResource/OutputResourceBean.java
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/portlets/conf/liferay/liferay-display.xml
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/core/ResourceDispatcher.java
          Commit graph MODIFY /icefaces/trunk/icefaces/component-metadata/src/main/resources/conf/extended-faces-config.xml
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/facelets/web/WEB-INF/includes/content/navigation.jspx
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/BridgeFacesContext.java
          Commit graph ADD /icefaces/trunk/icefaces/component-metadata/src/main/resources/conf/ice_cust_properties/cust-outputresource-props.xml
          Commit graph MODIFY /icefaces/trunk/icefaces/component/conf/META-INF/faces-config.xml
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #17682 Wed Oct 01 16:23:13 MDT 2008 philip.breau ICE-2348 new outputresource component (no really, this time for sure!)
          - includes comp-showcase example
          Files Changed
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/samples/component-showcase/portlets/conf/liferay/liferay-portlet.xml
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/samples/component-showcase/facelets/web/WEB-INF/includes/content/navigation.jspx
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages_es.properties
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/component/conf/META-INF/faces-config.xml
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/context/BridgeFacesContext.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/context/FileResource.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/samples/component-showcase/portlets/conf/liferay/liferay-display.xml
          Commit graph ADD /icefaces/branches/icefaces-1.7/icefaces/samples/component-showcase/common-web/WEB-INF/includes/examples/custom/outputResource.jspx
          Commit graph ADD /icefaces/branches/icefaces-1.7/icefaces/component-metadata/src/main/resources/conf/custom/outputResource-component.xml
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/samples/component-showcase/common-web/WEB-INF/faces-config-example-beans.xml
          Commit graph ADD /icefaces/branches/icefaces-1.7/icefaces/samples/component-showcase/portlets/web/Components_OutputResource.jspx
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/samples/component-showcase/jsp/web/WEB-INF/includes/content/navigation.jspx
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/samples/component-showcase/common-src/org/icefaces/application/showcase/view/resources/messages.properties
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/component-metadata/src/main/resources/conf/extended-faces-config.xml
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/samples/component-showcase/portlets/conf/portlet.xml
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/core/src/com/icesoft/faces/webapp/http/core/ResourceDispatcher.java
          Commit graph ADD /icefaces/branches/icefaces-1.7/icefaces/component-metadata/src/main/resources/conf/custom/outputResource-renderer.xml
          Commit graph ADD /icefaces/branches/icefaces-1.7/icefaces/component-metadata/src/main/resources/conf/ice_cust_properties/cust-outputresource-props.xml
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/component/conf/META-INF/facelet/icefaces.taglib.xml
          Commit graph MODIFY /icefaces/branches/icefaces-1.7/icefaces/samples/component-showcase/jsp/web/showcase.jspx
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #17683 Thu Oct 02 08:24:01 MDT 2008 philip.breau - add missing comp classes for ICE-2348
          Files Changed
          Commit graph ADD /icefaces/branches/icefaces-1.7/icefaces/component/src/com/icesoft/faces/component/outputresource/OutputResourceRenderer.java
          Commit graph ADD /icefaces/branches/icefaces-1.7/icefaces/component/src/com/icesoft/faces/component/outputresource/OutputResource.java
          Commit graph ADD /icefaces/branches/icefaces-1.7/icefaces/component/src/com/icesoft/faces/component/outputresource
          Hide
          Philip Breau added a comment -

          checked into 1.7 branch and head

          Show
          Philip Breau added a comment - checked into 1.7 branch and head
          Philip Breau made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Philip Breau made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Ken Fyten made changes -
          Link This issue is duplicated by ICE-2810 [ ICE-2810 ]

            People

            • Assignee:
              Philip Breau
              Reporter:
              Philip Breau
            • Votes:
              19 Vote for this issue
              Watchers:
              20 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: