On Sep 4, 11:32 pm, Benjamin Smedberg <[EMAIL PROTECTED]> wrote:
> James Newell wrote:
> > Hi,
>
> > I would like to create a new resource (for the resource:// protocol)
> > globally across XULRunner application. I have tried using
> > setSubstitution() on a new instance of nsIResProtocolHandler but
> > obviously this is not too successful.
>
> The resource protocol handler should be a singleton service. Please ask the
> IO service for getProtocolHandler("resource"), QI that to
> nsIResProtocolHandler, and then call setSubstitution(). However, there is a
> better way, assuming that your resource: maps to a directory location:
>
> If you want to register for the resource://myfoo/ mappping, you can simply
> register a directory service provider for the "resource:myfoo" key: the
> resource protocol handler will automatically ask the directory service for
> that key and set up the substitution correctly.
>
> --BDS

Thanks BDS,

I am using the first method as it makes more sense in the particular
application i am using. It seems to work and if I load "resource://
ufcontent/" into the browser, then I get a directory listing of the
the "root" resource directory as expected. However if I enter
"resource://ufcontent/test.html" I get a not found error. If I enter,
"resource://ufcontent/content/test.html" where content is the
directory within my application that test.html exists it works...

Why does the resource work for "resource://ufcontent/" but not
"resource://ufcontent/test.html"?

Thanks again,

James


_______________________________________________
dev-tech-network mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-network

Reply via email to