couchbase / couchbase-lite-ios

Lightweight, embedded, syncable NoSQL database engine for iOS and MacOS apps.
Apache License 2.0
1.62k stars 297 forks source link

Expose CBL_URLProtocol.h as a public header in CouchbaseListener.framework #259

Closed mz2 closed 10 years ago

mz2 commented 10 years ago

(Sorry if the following is entirely misinformed)

I can see why CBL_URLProtocol is a project-level implementation detail of CouchbaseLite framework. However, to take use of the listener I've come across cases where I would like to see a HTTP-schemed URLs for documents and views in the database, and would therefore like to use the CBL_URLProtocol's +HTTPURLForServerURL:

/** An alternate root URL with HTTP scheme; use this for CouchApps in UIWebViews.
    (This URL will have the hostname of the cbl: URL with ".couchbase." appended.) */
+ (NSURL*) HTTPURLForServerURL: (NSURL*)serverURL;

I wonder if I'm doing something wrong though - is there another way to get a couchbase schemed or a HTTP schemed URLs for things?

snej commented 10 years ago

Yes, you can get CBLDatabase.internalURL which is the REST URL of the database, then append the (escaped) doc ID to it.

mz2 commented 10 years ago

Got you, appending the necessary path components to it is all I need.