[jboss-cvs] jboss-seam/src/pdf/org/jboss/seam/pdf ...
Peter Muir
peter at bleepbleep.org.uk
Mon Apr 30 10:19:43 EDT 2007
User: pmuir
Date: 07/04/30 10:19:43
Modified: src/pdf/org/jboss/seam/pdf DocumentStore.java
Log:
JBSEAM-1240
Revision Changes Path
1.8 +22 -5 jboss-seam/src/pdf/org/jboss/seam/pdf/DocumentStore.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: DocumentStore.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/DocumentStore.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- DocumentStore.java 12 Mar 2007 05:31:40 -0000 1.7
+++ DocumentStore.java 30 Apr 2007 14:19:43 -0000 1.8
@@ -3,6 +3,11 @@
import java.io.Serializable;
import java.util.*;
+import javax.faces.FacesException;
+import javax.faces.application.ViewHandler;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
import org.jboss.seam.*;
import org.jboss.seam.annotations.*;
import org.jboss.seam.pdf.DocumentData.DocType;
@@ -56,7 +61,8 @@
public String preferredUrlForContent(String baseName, DocType docType, String contentId) {
- String baseUrl = "seam-doc.seam";
+ String url = getFacesContext().getApplication().getViewHandler().getActionURL(getFacesContext(), "/seam-doc." + getDefaultSuffix(getFacesContext()));
+ String baseUrl = getFacesContext().getExternalContext().encodeActionURL(url);
if (useExtensions) {
baseUrl = baseName + "." + docType.getExtension();
@@ -65,5 +71,16 @@
return baseUrl + "?docId=" + contentId;
}
+ private FacesContext getFacesContext()
+ {
+ return FacesContext.getCurrentInstance().getCurrentInstance();
+ }
+
+ private static String getDefaultSuffix(FacesContext context) throws FacesException {
+ ExternalContext externalContext = context.getExternalContext();
+ String viewSuffix = externalContext.getInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME);
+ return (viewSuffix != null) ? viewSuffix : ViewHandler.DEFAULT_SUFFIX;
+ }
+
}
More information about the jboss-cvs-commits
mailing list