[jbossseam-issues] [JBoss JIRA] Resolved: (JBSEAM-1240) DocumentStore and seam-doc.seam

Pete Muir (JIRA) jira-events at lists.jboss.org
Mon Apr 30 10:23:31 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBSEAM-1240?page=all ]

Pete Muir resolved JBSEAM-1240.
-------------------------------

    Fix Version/s: 1.3.0.BETA1
       Resolution: Done

I've committed this patch which fixes both issues

### Eclipse Workspace Patch 1.0
#P jboss-seam
Index: src/pdf/org/jboss/seam/pdf/DocumentStore.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/DocumentStore.java,v
retrieving revision 1.7
diff -u -r1.7 DocumentStore.java
--- src/pdf/org/jboss/seam/pdf/DocumentStore.java	12 Mar 2007 05:31:40 -0000	1.7
+++ src/pdf/org/jboss/seam/pdf/DocumentStore.java	30 Apr 2007 14:18:30 -0000
@@ -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,14 +61,26 @@
   
 
     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();
-        } 
+       if (useExtensions) {
+           baseUrl = baseName + "." + docType.getExtension();
+       } 
         
-        return baseUrl + "?docId=" + contentId;
+       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;
+   }
+    
 }
    


> DocumentStore and seam-doc.seam
> -------------------------------
>
>                 Key: JBSEAM-1240
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1240
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: PDF
>    Affects Versions: 1.2.1.GA
>            Reporter: Pete Muir
>         Assigned To: Norman Richards
>             Fix For: 1.3.0.BETA1
>
>
> A couple of problems
> 1) it doesn't work if the document isn't in the root of the war
> 2) It doesn't work if your extension for faces requests isn't .seam

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list