CouchDB: custom error page - couchdb

Is there a way to customize error pages in CouchDB, particularly in couchapp?
When I try to load URL with undefined/misspelled view
http://localhost:5984/database/_design/app/_view/sample
CouchDB 1.2 just closes the connection:
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
I'd like to customize this behavior.

A partial answer was found here: http://wiki.apache.org/couchdb/Advanced_Shows_and_Lists_Throwing_Redirects

Related

WKWebView delegate method error message

I am using WKWebView to load and display the content of a web site. After the app was launched and running, the delegate method -webView:didFailNavigation:withError:got called. Following is the error description (error.description) extracted from this delegate method using Xcode debugger:
Error Domain=NSURLErrorDomain Code=-999 "(null)" UserInfo={NSErrorFailingURLStringKey=, NSErrorFailingURLKey=, _WKRecoveryAttempterErrorKey=}
I did some Google search and found that Code=-999 is caused by ErrorCancelled, meaning another request is made before the previous request is completed. So how should I fix this issue in my app? Thanks a lot in advance.

OData service can be called in Browsers but in Excel 2016

I got a sample servlet using Olingo lib: https://odata-demoservice.run.aws-usw02-pr.ice.predix.io/DemoService.svc/Products. It works fine in Chrome/IE/FF or in Postman. But when I query in Excel 2016/OS Windows 10 with the steps like:
New Query
From Other Sources
From OData Feed
Got the error like: "We encountered an error while trying to connect. Details: Invalid URI: The hostname could not be parsed"
Any ideas are appreciated.
Thanks
#RodolfoOliveira: yes, I resolved this issue. the reason is that when I deployed it to Cloud, the uri in metadata is still http. What I did is implement a CustomProcessor and correct the url.
More detail is here: https://issues.apache.org/jira/browse/OLINGO-758
just need to do the custom Processor. Do the same as the original source but change a bit about the url. Detail in here: https://olingo.apache.org/javadoc/odata4/org/apache/olingo/server/api/processor/DefaultProcessor.html
Register it with the Handler at first, then the issue should be solved.
ODataHttpHandler handler = odata.createHandler(edm);
handler.register(new CustomDefaultProcessor());
Hope this help.

Microsoft sample WordCount does not work on Local Cluster

I am trying to learn the development process for Service Fabric
by using one of the popular samples from Microsoft, called WordCount.
I do not have Azure account yet, so I installed the Local Cluster
on my Windows 10. I went through the instructions on Microsoft
website and most of it works. I can see the Cluster Manager with:
http://localhost:19080/Explorer
where I can see the application:
fabric:/WordCount WordCount 1.0.0 OK Ready
From inside the Powershell I can connect to the Local Cluster
and run the cmdlets with output as expected
Get-ServiceFabricApplication
Get-ServiceFabricService -ApplicationName 'fabric:/WordCount'
Get-ServiceFabricPartition 'fabric:/WordCount/WordCountService'
The problem is when I run
http://localhost:8081/wordcount/index.html
the browser does not display anything. It is supposed to display
the counts of words generated by client-side JavaScript
and processed by ASP.NET Web API. My browser has JavaScript enabled.
I do not know yet enough about the code in the sample but I have its solution with 4 projects loaded in VS2017. I just want to make it work ASAP.
Below I attach a part of console output in my browser (FireFox). Apparently, the JS script is getting
[HTTP/1.1 404 Not Found 0ms]
in response to all requests.
POST
XHR
http://localhost:8081//wordcount/index.html/api/AddWord/WYVyl [HTTP/1.1 404 Not Found 0ms]
XML Parsing Error: no root element found
Location: http://localhost:8081//wordcount/index.html/api/AddWord/WYVyl
Line Number 1, Column 1: WYVyl:1:1
POST
XHR
http://localhost:8081//wordcount/index.html/api/AddWord/YcIMv [HTTP/1.1 404 Not Found 0ms]
XML Parsing Error: no root element found
Location: http://localhost:8081//wordcount/index.html/api/AddWord/YcIMv
Line Number 1, Column 1: YcIMv:1:1
GET
XHR
http://localhost:8081//wordcount/index.html/api/Count [HTTP/1.1 404 Not Found 0ms]
XML Parsing Error: no root element found
Location: http://localhost:8081//wordcount/index.html /api/Count?c=0.7465426272903215
Line Number 1, Column 1: Count:1:1
The problem is that you're trying to open up "http://localhost:8081/wordcount/index.html" while you should use "http://localhost:8081/wordcount/". Otherwise the javascript code builds incorrect url to access the services.

HTTP Error 405.0 - Method Not Allowed while Form Post

I posted a request to payu server via form submit using angularjs now once payment is completed payu will return a response with hash.But when it hits my success page i get "HTTP Error 405.0 - Method Not Allowed".I found many solutions online but none of that solved my issue.What i understood is that static html do not allow post by default.But my staticFile in IIS is like below
Request Path : *
Module : StaticFileModule
Name : staticFile
Request Restriction >Verb > All Verbs & Access > Script & Invoke > Files and folders
My question now in how to allow POST method for html page.I am using angular and if i change my success url to other than mine it works fine.I think there is some changes to be made to the web config but i tried my best but failed.Any help would be much appreciated.Also lets assume that the page successfully redirects to my success page how to capture the response that payu sends me online.
Thanks in advance if more input is needed from my side kindly ask in reply.
It's not that HTML does not allow POST by default, it's that HTML does not handle POST, period. (Not even if the HTML file contains JavaScript.) POST sends data to a script that runs on your server, and the script has to be smart enough to know what to do with the data. HTML isn't that smart. The only thing your server can do with HTML is to send the HTML back to whatever is requesting it. You need a server-side script that knows how to parse payu's response, do something appropriate with the hash, and then generate some HTML to display in the user's browser.

Error posting to IBM Connections 4.5 activity stream

Using a browser REST client to POST to the activity stream at e.g.
https://connectionsww.demos.ibm.com/connections/opensocial/basic/rest/activitystreams/#me/#all
...with the settings prescribed in IBM Connections OpenSocial API > POSTing new events
...results in the following response:
<error xmlns="http://www.ibm.com/xmlns/prod/sn">
<code>403</code>
<message>You are not authorized to perform the requested action.</message>
<trace></trace>
</error>
What am I missing?
This same approach works nicely on IBM Connections 4.0.
Which setting needs 'switching on'?
Try a URL like this... https://sbtdev.swg.usma.ibm.com:444/connections/opensocial/basic/rest/activitystreams/#me/#all
I added the Basic/Rest component, and it worked for me.
1 - Added URL https://sbtdev.swg.usma.ibm.com:444/connections/opensocial/basic/rest/activitystreams/#me/#all
2 - Changed Method to Post
3 - Added Content-Type: application/json
4 - Authentication -> Basic
5 - Logged IN
6 - Posted
Same thing here: 403 when I make an AJAX call to an IBM Connections 6.0 REST API url. Same error in Chrome, Firefox and IE11. When I open the same URL in a separate browser tab, everything works fine.
Comparing the http headers of both calls, and fiddling with Postman, the diference is the presence and value of the atribute Origin.
Seems that Connections allows calls from its own server. For example, when: Origin: connections.mycompany.com.
It also allows calls when Origin is not defined, which happens when the url is called from a separate browser tab.
There is a doc at IBMs Support site that confirms this - http://www-01.ibm.com/support/docview.wss?uid=swg21999210. It also suggests a workaround that did the job for me: unsetting the Origin attribute in the IBM HTTP Server that is in front of your Connections instance. Add the lines below to the httpd.conf file:
Header unset Origin
RequestHeader unset Origin

Resources