When I've done this in the past I just have Couchbase Lite serve the HTML from an attachment. Like this app does: https://github.com/natevw/CouchTalk-iOS
On Monday, June 9, 2014 9:10:22 AM UTC-7, [email protected] wrote: > > So I tried out my approach and it works. You have to do two things: > > 1) add the specific CORS headers to each response > 2) handle OPTIONS requests, since these requests are automatically send > from most of the browsers as a "preflight" CORS request and couchbase light > has no handler for the OPTIONS method. > > The class to be modified: > > https://github.com/couchbase/couchbase-lite-java-listener/blob/master/src/main/java/com/couchbase/lite/listener/LiteServlet.java > > The code: > > @Override > public void service(HttpServletRequest request, final HttpServletResponse > response)throws ServletException, IOException { > > // Handle OPTIONS request in order to respond to CORS > response.setHeader("Access-Control-Allow-Origin", "*"); > response.setHeader("Access-Control-Allow-Methods", "GET, PUT, POST, > DELETE"); > response.setHeader("Access-Control-Allow-Headers", "content-type, accept"); > if("OPTIONS".equals(request.getMethod())){ > Log.v(Log.TAG_LISTENER, "Handle OPTIONS request in order to respond to > CORS"); > response.setStatus(200); > return; > } > ... > } > > I also attached the modified library for the Phonegap plugin for Android > (couchbase-lite-java-listener-1.0.0-72.jar). > > Hope that helps, cheers, > Stefan > > > -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/00ea118c-85cc-40c4-8065-9ad60e3b2498%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
