[
https://issues.apache.org/jira/browse/XMLRPC-182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13085039#comment-13085039
]
Fatih Tekin commented on XMLRPC-182:
------------------------------------
You can creat a class name as below PropertyHandlerMappingWithoutDot and you
may edit it the you want to use.
ServletWebServer webServer = new ServletWebServer(ucipAuthenticationServlet,
port);
XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();
PropertyHandlerMappingWithoutDot phm = new PropertyHandlerMappingWithoutDot();
xmlRpcServer.setHandlerMapping(phm);
package com.ericsson.enk.ucip.server;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.XmlRpcHandler;
import org.apache.xmlrpc.server.PropertyHandlerMapping;
import org.apache.xmlrpc.server.XmlRpcNoSuchHandlerException;
public class PropertyHandlerMappingWithoutDot extends PropertyHandlerMapping{
@Override
public void addHandler(String pKey, Class pClass) throws
XmlRpcException {
registerPublicMethods(pKey, pClass);
}
//If you want server to response any request than you should open this
function that overrides request map
// @Override
// public XmlRpcHandler getHandler(String pHandlerName) throws
XmlRpcNoSuchHandlerException, XmlRpcException {
// XmlRpcHandler result = (XmlRpcHandler)
handlerMap.get("AnyUcipOperation");
// if (result == null) {
// throw new XmlRpcNoSuchHandlerException("No such
handler: " + pHandlerName);
// }
// return result;
// }
@Override
public void load(ClassLoader pClassLoader, Map pMap) throws
XmlRpcException {
for (Iterator iter = pMap.entrySet().iterator();
iter.hasNext(); ) {
Map.Entry entry = (Map.Entry) iter.next();
String key = (String) entry.getKey();
String value = (String) entry.getValue();
Class c = newHandlerClass(pClassLoader, value);
registerPublicMethods(key, c);
}
}
@Override
protected void registerPublicMethods(String pKey,
Class pType) throws XmlRpcException {
Map map = new HashMap();
Method[] methods = pType.getMethods();
for (int i = 0; i < methods.length; i++) {
final Method method = methods[i];
if (!isHandlerMethod(method)) {
continue;
}
String name = method.getName();
Method[] mArray;
Method[] oldMArray = (Method[]) map.get(name);
if (oldMArray == null) {
mArray = new Method[]{method};
} else {
mArray = new Method[oldMArray.length+1];
System.arraycopy(oldMArray, 0, mArray, 0,
oldMArray.length);
mArray[oldMArray.length] = method;
}
map.put(name, mArray);
}
for (Iterator iter = map.entrySet().iterator();
iter.hasNext(); ) {
Map.Entry entry = (Map.Entry) iter.next();
String name = (String) entry.getKey();
Method[] mArray = (Method[]) entry.getValue();
handlerMap.put(name, newXmlRpcHandler(pType, mArray));
}
}
}
> PropertyHandlerMapping should allow unprefixed names
> ----------------------------------------------------
>
> Key: XMLRPC-182
> URL: https://issues.apache.org/jira/browse/XMLRPC-182
> Project: XML-RPC
> Issue Type: Improvement
> Components: Source
> Affects Versions: 3.1.3
> Reporter: Oliver Wagner
> Assignee: Jochen Wiedmann
> Priority: Minor
> Fix For: 3.1.4
>
>
> Currently PropertyHandlerMapping will always register method names with the
> form "<pKey>.<methodname>", there is no way to create a method without
> prefix. Even when pKey is null, the name generated will be
> "null.<methodname>".
> Similiar to the recent change on the client side, I propose to change name
> generation to not generate a prefix if pKey is null, e.g. in
> registerPublicMethods():
> String name=(pKey!=null)?(pKey + "." +
> method.getName()):method.getName();
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]