1
votes

This issue is related to this thread here:

Unable to get document page name for

I think I have discovered the issue and wondering if others are seeing it or know how to fix it.

The issue seems to be with the Read Public Access Documents setting and accessing a document that is not public access with a url such as:

myserver/mydb.nsf/%24%24OpenDominoDocument.xsp?documentId=00547923F0A3FF1B852572DC00419CE0&action=openDocument

Here is how to duplicate the issue.

  1. Create a form. Make certian public access is not set and $$PublicAccess is not on the form and create some documents for this form.

  2. Create an xpage for the form. Associate the form with the xPage.

  3. Create a view for the new form.

  4. Create a xpage view with xPage associated with this document set. Use the view created above.

  5. Set Read Public Access in the ACL of the DB.

  6. Open the xpage view in the browser.

  7. Open one of the documents in the browser.

  8. Copy the url to the clipboard.

  9. Close the browser. Open the browser and paste in the url. You should get a Unable to get document page name for in the browser. (You will NOT be asked to login, just get the error)

10 Clear Read Public Access documents, close the browser, open the browser and paste in the url. This time it should work. (You will be prompted to login)

What seems to be happening is that if Public Access is set, it seems like if Public Access Documents is set, Domino ASSUMES everyhting should be public access and just tries to display the document and fails.

I am guess it is PMR time again but just wanted to put this out there.

1

1 Answers

4
votes

If you open the stacktrace you will see that the page transformation fails because the document can not be opend: It has an invalid universal id, because the anonymous user is not allowed to see this document.

As far I can see the only workaround is to create your own PageTransformer which handles the Exception and redirects the user to another location.

Here is an example class:

package ch.hasselba.factory;

import java.io.IOException;
import com.ibm.xsp.model.domino.DominoDocumentPageTransformer;
import com.ibm.xsp.FacesExceptionEx;
import javax.faces.context.FacesContext;

public class PageTransformer extends DominoDocumentPageTransformer {

    public boolean isVirtualPage(FacesContext fc, String pStr) {
        return "/$$OpenDominoDocument.xsp".equals(pStr);
    }

    public String transformPageName(FacesContext fc, String pStr) {
        String ret = null;
        try {
           ret = super.transformPageName( fc, pStr );
        } catch (FacesExceptionEx fex) {
            try {
                fc.getExternalContext().redirect("http://www.google.com");
            } catch (IOException e) {
                e.printStackTrace();
            }
            fc.responseComplete();
        }
        return ret;
    }
}

To activate the page transformer you have to overwrite the existing PageTransformer factory. To do this you have to create a file in the WEB_INF folder with the name com.ibm.xsp.factories.properties.

In this file you need to add a line to activate yot factory:

PageTransformer=ch.hasselba.factory.PageTransformer 

This should fetch the error if a user opens a invalid document and redirects him to Google.

More Details can be found here: http://hasselba.ch/blog/?p=1028