Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I would post code but it touches a few too many places and by the time I had it here, it was an essay...</p> <p>What I did:</p> <ul> <li>Created <code>PropagatedHttpException</code> extending <code>RuntimeException</code>. It just has one field, code, which is the HTTP error code.</li> <li>Extend <code>XmlRpcServletServer</code>: <ul> <li>Override writeError to check if the error is a <code>PropagatedHttpException</code> and if it is, throw it back out immediately.</li> <li>Override execute(<code>HttpServletRequest</code>, <code>HttpServletResponse</code>) to catch <code>PropagatedHttpException</code> and pass it on as a proper HTTP error.</li> </ul></li> <li>Extend <code>XmlRpcServlet</code>: <ul> <li>Set a custom <code>AuthenticationHandler</code> which throws <code>PropagatedHttpException</code> for specific HTTP error codes.</li> <li>Override <code>newXmlRpcServer</code> to return the custom <code>XmlRpcServletServer.</code></li> </ul></li> </ul> <p>We already had a custom authentication handler when we started to figure out how this would work but in your case maybe it isn't needed and the writeError code could be adjusted to check for XmlRpcNotAuthorizedException. Actually I had no idea this exception existed until today...</p> <p>The problem you'll have now is that from the client side, Apache XML-RPC doesn't check the error code it gets back and then tries to parse the XML response irrespective of the result.</p> <p>Grooveek's answer is extremely disheartening to us as we want authentication to be hooked into the JRE's built-in authentication so that things like NTLM can work, but if it's going to return an HTTP 200 then it is impossible for this to ever work without breaking the spec.</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