Author: dlr
Date: Mon Apr 9 17:00:17 2007
New Revision: 526960
URL: http://svn.apache.org/viewvc?view=rev&rev=526960
Log:
* src/java/org/apache/xmlrpc/XmlRpcServer.java
(execute): Add @see tags for most overloads, pointing to the
inner-most method. Document that the method throws
AuthenticationFailed and ParseFailed RuntimeExceptions.
* src/java/org/apache/xmlrpc/WebServer.java
(Connection.run): Handle ParseFailed exception. Update caller of
writeBadRequest() to account for change in method signature.
(writeBadRequest): Change method signature to accept a "why"
parameter.
Modified:
webservices/xmlrpc/branches/XMLRPC_1_2_BRANCH/src/java/org/apache/xmlrpc/WebServer.java
webservices/xmlrpc/branches/XMLRPC_1_2_BRANCH/src/java/org/apache/xmlrpc/XmlRpcServer.java
Modified:
webservices/xmlrpc/branches/XMLRPC_1_2_BRANCH/src/java/org/apache/xmlrpc/WebServer.java
URL:
http://svn.apache.org/viewvc/webservices/xmlrpc/branches/XMLRPC_1_2_BRANCH/src/java/org/apache/xmlrpc/WebServer.java?view=diff&rev=526960&r1=526959&r2=526960
==============================================================================
---
webservices/xmlrpc/branches/XMLRPC_1_2_BRANCH/src/java/org/apache/xmlrpc/WebServer.java
(original)
+++
webservices/xmlrpc/branches/XMLRPC_1_2_BRANCH/src/java/org/apache/xmlrpc/WebServer.java
Mon Apr 9 17:00:17 2007
@@ -811,11 +811,18 @@
keepAlive = false;
writeUnauthorized(httpVersion, method);
}
+ catch (ParseFailed malformedXML)
+ {
+ keepAlive = false;
+ writeBadRequest(malformedXML.toString(),
+ httpVersion);
+ }
}
else
{
keepAlive = false;
- writeBadRequest(httpVersion, method);
+ writeBadRequest("Method " + method + " not " +
+ "implemented (try POST)", httpVersion);
}
output.flush();
}
@@ -913,7 +920,7 @@
output.write(payload);
}
- private void writeBadRequest(String httpVersion, String httpMethod)
+ private void writeBadRequest(String why, String httpVersion)
throws IOException
{
output.write(toHTTPBytes(httpVersion));
@@ -921,8 +928,7 @@
output.write(newline);
output.write(server);
output.write(newline);
- output.write(toHTTPBytes("Method " + httpMethod +
- " not implemented (try POST)"));
+ output.write(toHTTPBytes(why));
}
private void writeUnauthorized(String httpVersion, String httpMethod)
Modified:
webservices/xmlrpc/branches/XMLRPC_1_2_BRANCH/src/java/org/apache/xmlrpc/XmlRpcServer.java
URL:
http://svn.apache.org/viewvc/webservices/xmlrpc/branches/XMLRPC_1_2_BRANCH/src/java/org/apache/xmlrpc/XmlRpcServer.java?view=diff&rev=526960&r1=526959&r2=526960
==============================================================================
---
webservices/xmlrpc/branches/XMLRPC_1_2_BRANCH/src/java/org/apache/xmlrpc/XmlRpcServer.java
(original)
+++
webservices/xmlrpc/branches/XMLRPC_1_2_BRANCH/src/java/org/apache/xmlrpc/XmlRpcServer.java
Mon Apr 9 17:00:17 2007
@@ -122,10 +122,13 @@
* doesn't need to know whether the call was successful or not
* since this is all packed into the response. No context information
* is passed.
+ *
+ * @see #execute(InputStream, XmlRpcContext)
*/
public byte[] execute(InputStream is)
{
- return execute(is, new DefaultXmlRpcContext(null, null,
getHandlerMapping()));
+ return execute(is, new DefaultXmlRpcContext(null, null,
+ getHandlerMapping()));
}
/**
@@ -133,10 +136,13 @@
* found. If the invoked handler is AuthenticatedXmlRpcHandler,
* use the credentials to authenticate the user. No context information
* is passed.
+ *
+ * @see #execute(InputStream, XmlRpcContext)
*/
public byte[] execute(InputStream is, String user, String password)
{
- return execute(is, new DefaultXmlRpcContext(user, password,
getHandlerMapping()));
+ return execute(is, new DefaultXmlRpcContext(user, password,
+ getHandlerMapping()));
}
/**
@@ -144,6 +150,9 @@
* found. If the invoked handler is AuthenticatedXmlRpcHandler,
* use the credentials to authenticate the user. Context information
* is passed to the worker, and may be passed to the request handler.
+ *
+ * @throws AuthenticationFailed If authentication fails.
+ * @throws ParseFailed if unable to parse the request.
*/
public byte[] execute(InputStream is, XmlRpcContext context)
{