How can we embed and show an InputStream as dynamic image in JSF 2.0 with OmniFaces?
Show an InputStream as dynamic image in JSF
2.6k Views Asked by ngadde At
1
There are 1 best solutions below
Related Questions in JSF-2
- JSF 2 Primefaces : On Ajax reponse I can see extra updates sent by server <update id="javax.faces.Resource"> and which cause my action skipped
- Understanding HTTP sessions in JSF as session attributres are going null unexpectedly while working actively on the application
- How to clear data from datatable using primefaces and java
- CDI Interceptor fires BEFORE HttpAuthenticationMechanism validates request
- JSF user lockout after X failed login attempts
- JSF ExceptionHandler - Response already committed in some cases
- Why am I getting Class NotFound Exception using data table with jsf
- Java Beans - how to ignore boolean isXXXXMethod in favor of BOOLEAN getXXXXMethod in JSF page?
- Input element created with h:inputText is not editable
- NullPointerException during initFaces of a MyFaces 2.0 application while migrating from WLS to Tomcat
- Primefaces 10 HTML styling in DataTable emptyMessage
- jsf2, primefaces 11, Component ID j_idt20 has already been found in the view
- Hide rows of datatable based on condition in JSF2
- How to generate and preview a presigned url of a file in jsf?
- commandLink action parameter not displayed in JSF2
Related Questions in INPUTSTREAM
- Cant read the whole response from the HttpURLConnection I want to achieve that for My Proxy Server?
- Scanning files with ClamAV, while using different inputstreams
- PNG file corrupted after calling ImageReader getHeigth
- Can I modify the bytes which are requested to read but not read in reality of InputStream?
- How to decode extracted text from pdf file in android kotlin?
- Unable to get BufferedReader to advance past the use of a Scanner object in an external java file
- Why fgets(char* buffer, int size, stdin) don't cause Segmentation Fault all time whenever given input string large enough then size of char buffer[]
- java.io.EOFException: Unexpected end of ZLIB input stream from API response
- Java : Convert an Inputstream string into file
- problem with System.in for logical testing java code in servlet
- FileInputStream vs InputStream for ResetExceptions in Amazon S3 file uploading
- Making a FormDataBodyPart from a CyperInputStream
- java.io.FileNotFoundException: C:\Users\HOME\AppData\Local\Temp (Access Denied)
- Jackson YAMLParser can't read input stream
- Webview block ads InputStream from url not working
Related Questions in OMNIFACES
- InputTextarea with maximum rows and columns
- Use Omnifaces in Pac4j during using AuthorizationGenerator
- how to pass attribute by value to backend bean
- How do suppress my PrimeFaces ajaxStatus when using OmniFaces socket and JSF core commandScript?
- Custom validator for a date inside a JSF iterable component (data table)
- How can I create a more fine grained web socket in JSF?
- Does JSF have a way to get the tag handlers in the current view?
- How can I piggyback request arguments from a web socket message without manually constructing array?
- ViewScoped bean being initialized multiple times with includeViewParams="true"
- Using OmniFaces in Spring Boot project
- Manifest cannot detected in Quarkus-Omnifaces Extension
- Gradle 8.0.2 - Unable to deploy Omnifaces 'showcase-master'
- Manually process `unload` event before triggering `preDestroy` method in OmniFaces ViewScoped bean
- @PreDestroy method not called when leaving page of bean annotated with OmniFaces "ViewScoped"
- How to invalidate views for the current session in JSF?
Related Questions in GRAPHICIMAGE
- PrimeFaces p:graphicImage support for Streamed Content SVG
- Can show a single 'o:graphicImage' image but not multiple numbers of image
- java.lang.NullPointerException at org.primefaces.component.graphicimage.GraphicImageRenderer.encodeEnd(GraphicImageRenderer.java:43)
- Primefaces p:graphicImage dynamicContent failed to load 404
- imageRotateAndResize with Galleria in Primefaces
- BLOB from MySQL not properly displayed
- p:graphicImage with StreamedContent throws "Error in streaming dynamic resource"
- o:graphicImage caching possible?
- StreamedContent not getting populated beyond RENDER_RESPONSE
- Displaying the same image several times with multiple p:graphicImage without multiple HTTP requests
- Passing dynamic param through bundle.properties to alt text value of graphicImage
- How to remove borders from loading gif on a dark background?
- Why do some HTTP requests for Primefaces <p:graphicImage> return 0 bytes while others work?
- Is there news on getting the URL of <p:graphicImage>?
- Is there a way to make a graphicimage in Primefaces execute the "value" method only on demand?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
OmniFaces does not offer any utility for this — yet.
If the image files are located on the disk file system, then you need to create a virtual context in the servletcontainer configuration so that they can be accessed by a normal URL. See also Load images from outside of webapps / webcontext / deploy folder using <h:graphicImage> or <img> tag.
If the image files are stored in the DB, then you need to create a simple servlet which just writes the
InputStreamof the image from the DB to theOutputStreamof the HTTP response. See also How to retrieve and display images from a database in a JSP page? (note that this doesn't require JSP/HTML, you can as good just use<h:graphicImage>as it merely generates a HTML<img>element).There's the PrimeFaces
<p:graphicImage>, but this is a bit unintuitive to implement. See also Display dynamic image from database with p:graphicImage and StreamedContent.Update: since OmniFaces 2.0 (for JSF 2.2) there's a
<o:graphicImage>component which supports among others directly referencing abyte[]orInputStreamproperty in an@ApplicationScopedmanaged bean in an intuitive way like below:In contrary to PrimeFaces
<p:graphicImage>, no<f:param>is needed and the EL method arguments are evaluated during render response phase, but the EL method itself is only invoked when the browser actually requests the image. See also the showcase and the blog on the subject.