Note that there are some explanatory texts on larger screens.

plurals
  1. POXML-RPC authentication (http vs. XmlRpcNotAuthorizedException)
    text
    copied!<p>I could not find an exact answer to my question (either google or here), so my apologies if this is a repeat that I missed:</p> <p>I am writing a XML-RPC server using Apache's XML-RPC libraries (which I'm regretting a bit) in Java that needs to conform to a given specification. With authentication, the server generates an org.apache.xmlrpc.common.XmlRpcNotAuthorizedException. This is not the behaviour that is required. I would like to return an HTTP error 401 (not authenticated) and 403 (forbidden) instead. However, Apache keeps on throwing these exceptions and I cannot find a way around it.</p> <p>For example response received after sending correct username/password:</p> <pre><code>HTTP/1.1 200 OK Content-Length:362 Content-Type:text/xml Server:Jetty(7.x.y-SNAPSHOT) &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;methodResponse&gt; ...correct response information here &lt;/methodResponse&gt; </code></pre> <p>...and wrong username and password:</p> <pre><code>HTTP/1.1 200 OK Content-Length:252 Content-Type:text/xml Server:Jetty(7.x.y-SNAPSHOT) &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;methodResponse&gt; ...xmlrpc exception here &lt;methodResponse&gt; </code></pre> <p>I don't want "HTTP/1.1 200 OK", I want "HTTP/1.1 401 Unauthorized"</p> <p>I was considering inheriting Apache's ReflectiveXmlRpcHandler (or something similar) and trying to intercept the exception, but I was wondering if someone else have found a better idea to this problem.</p> <p>Any ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload