Skip to content

Commit

Permalink
Make compatible with PrimeFaces 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudy De Busscher committed Feb 27, 2015
1 parent 1987112 commit d42143a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Java template
*.class
target

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

#IDE
*.iml
.idea
4 changes: 2 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
<artifactId>advanced-graphic-image</artifactId>
<name>Advanced Graphic image renderer</name>
<packaging>jar</packaging>
<version>1.0.0</version>
<version>1.1.0</version>

<properties>
<primefaces.version>3.4.1</primefaces.version>
<primefaces.version>4.0</primefaces.version>
<myfaces.version>2.1.6</myfaces.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@

import org.primefaces.component.graphicimage.GraphicImage;
import org.primefaces.component.graphicimage.GraphicImageRenderer;
import org.primefaces.context.RequestContext;
import org.primefaces.model.StreamedContent;
import org.primefaces.util.Constants;
import org.primefaces.util.StringEncrypter;

import javax.faces.application.Resource;
import javax.faces.component.UIComponent;
Expand Down Expand Up @@ -66,7 +68,7 @@ private boolean determineSpecificParents(GraphicImage image) {
}

@Override
protected String getImageSrc(FacesContext context, GraphicImage image) {
protected String getImageSrc(FacesContext context, GraphicImage image) throws Exception {
if (determineIfAdvancedRendering(image)) {
String src;
Object value = image.getValue();
Expand All @@ -76,7 +78,9 @@ protected String getImageSrc(FacesContext context, GraphicImage image) {
Resource resource = context.getApplication().getResourceHandler()
.createResource("dynamiccontent", "advancedPrimefaces", streamedContent.getContentType());
String resourcePath = resource.getRequestPath();
String rid = createUniqueContentId(context);
StringEncrypter strEn = RequestContext.getCurrentInstance().getEncrypter();
String rid = strEn.encrypt(image.getValueExpression("value").getExpressionString());

StringBuilder builder = new StringBuilder(resourcePath);
GraphicImageManager graphicImageManager = GraphicImageUtil.retrieveManager(context);
graphicImageManager.registerImage(streamedContent, rid);
Expand Down
4 changes: 2 additions & 2 deletions demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<version>1.0.0</version>

<properties>
<primefaces.version>3.4.1</primefaces.version>
<primefaces.version>4.0</primefaces.version>
<myfaces.version>2.1.6</myfaces.version>
</properties>

Expand Down Expand Up @@ -86,7 +86,7 @@
<dependency>
<groupId>be.rubus.web.jsf.primefaces</groupId>
<artifactId>advanced-graphic-image</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
</dependency>

<dependency>
Expand Down

0 comments on commit d42143a

Please sign in to comment.