本文整理汇总了Java中org.apache.xmlrpc.common.XmlRpcStreamConfig类的典型用法代码示例。如果您正苦于以下问题:Java XmlRpcStreamConfig类的具体用法?Java XmlRpcStreamConfig怎么用?Java XmlRpcStreamConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlRpcStreamConfig类属于org.apache.xmlrpc.common包,在下文中一共展示了XmlRpcStreamConfig类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeRequest
import org.apache.xmlrpc.common.XmlRpcStreamConfig; //导入依赖的package包/类
public void writeRequest(XmlRpcStreamConfig config, XmlRpcRequest request) throws SAXException {
handler.startDocument();
boolean extensions = config.isEnabledForExtensions();
if (extensions) {
handler.startPrefixMapping("ex", org.apache.xmlrpc.serializer.XmlRpcWriter.EXTENSIONS_URI);
}
handler.startElement("", "methodCall", "methodCall", ZERO_ATTRIBUTES);
handler.startElement("", "methodName", "methodName", ZERO_ATTRIBUTES);
String s = request.getMethodName();
handler.characters(s.toCharArray(), 0, s.length());
handler.endElement("", "methodName", "methodName");
handler.startElement("", "params", "params", ZERO_ATTRIBUTES);
int num = request.getParameterCount();
for (int i = 0; i < num; i++) {
handler.startElement("", "param", "param", ZERO_ATTRIBUTES);
writeValue(request.getParameter(i));
handler.endElement("", "param", "param");
}
handler.endElement("", "params", "params");
handler.endElement("", "methodCall", "methodCall");
if (extensions) {
handler.endPrefixMapping("ex");
}
handler.endDocument();
}
示例2: getParser
import org.apache.xmlrpc.common.XmlRpcStreamConfig; //导入依赖的package包/类
@Override
public TypeParser getParser(XmlRpcStreamConfig pConfig, NamespaceContextImpl pContext, String pURI, String pLocalName) {
TypeParser defaultParser = super.getParser(pConfig, pContext, pURI, pLocalName);
if (defaultParser instanceof I4Parser) {
return new TolerantI4Parser();
} else if (defaultParser instanceof DateParser) {
return new TolerantDateParser(new XmlRpcDateTimeDateFormat(){
private static final long serialVersionUID = 7585237706442299067L;
protected TimeZone getTimeZone() {
return getController().getConfig().getTimeZone();
}
});
} else {
return defaultParser;
}
}
示例3: getSerializer
import org.apache.xmlrpc.common.XmlRpcStreamConfig; //导入依赖的package包/类
/**
* Correctly handle outgoing requests containing XML-RPC "None" values.
*/
@Override
public TypeSerializer getSerializer(XmlRpcStreamConfig pConfig, Object pObject) throws SAXException {
if (pObject == null) {
return new TypeSerializerImpl() {
public void write(ContentHandler pHandler, Object o) throws SAXException {
pHandler.startElement("", VALUE_TAG, VALUE_TAG, ZERO_ATTRIBUTES);
pHandler.startElement("", NullSerializer.NIL_TAG, NullSerializer.NIL_TAG, ZERO_ATTRIBUTES);
pHandler.endElement("", NullSerializer.NIL_TAG, NullSerializer.NIL_TAG);
pHandler.endElement("", VALUE_TAG, VALUE_TAG);
}
};
} else {
return super.getSerializer(pConfig, pObject);
}
}
示例4: getSerializer
import org.apache.xmlrpc.common.XmlRpcStreamConfig; //导入依赖的package包/类
/**
* Serializer.
*/
@Override
public TypeSerializer getSerializer(XmlRpcStreamConfig pConfig, Object pObject) throws SAXException
{
if (pObject instanceof Date)
{
return new DateSerializer(newFormat());
}
return super.getSerializer(pConfig, pObject);
}
示例5: getParser
import org.apache.xmlrpc.common.XmlRpcStreamConfig; //导入依赖的package包/类
@Override
public TypeParser getParser(XmlRpcStreamConfig pConfig, NamespaceContextImpl pContext, String pURI, String pLocalName) {
if (DoubleSerializer.DOUBLE_TAG.equals(pLocalName)) {
return new AnalysisRpcDoubleParser();
}
return super.getParser(pConfig, pContext, pURI, pLocalName);
}
示例6: getParser
import org.apache.xmlrpc.common.XmlRpcStreamConfig; //导入依赖的package包/类
/**
* Correctly handle XML-RPC "None" elements in incoming responses from server.
*/
@Override
public TypeParser getParser(XmlRpcStreamConfig pConfig,
NamespaceContextImpl pContext, String pURI, String pLocalName) {
if ("".equals(pURI) && NullSerializer.NIL_TAG.equals(pLocalName)) {
return new NullParser();
} else {
return super.getParser(pConfig, pContext, pURI, pLocalName);
}
}
示例7: getParser
import org.apache.xmlrpc.common.XmlRpcStreamConfig; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public TypeParser getParser(XmlRpcStreamConfig pConfig, NamespaceContextImpl pContext, String pURI,
String pLocalName) {
if (EObjectSerializer.EOBJECT_TAG.equals(pLocalName)) {
return new EObjectTypeParser();
} else {
return super.getParser(pConfig, pContext, pURI, pLocalName);
}
}
示例8: getSerializer
import org.apache.xmlrpc.common.XmlRpcStreamConfig; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public TypeSerializer getSerializer(XmlRpcStreamConfig pConfig, Object pObject) throws SAXException {
if (pObject instanceof EObject) {
return new EObjectSerializer();
} else {
return super.getSerializer(pConfig, pObject);
}
}
示例9: getParser
import org.apache.xmlrpc.common.XmlRpcStreamConfig; //导入依赖的package包/类
/**
* Date parser.
*/
@Override
public TypeParser getParser(XmlRpcStreamConfig pConfig, NamespaceContextImpl pContext, String pURI, String pLocalName)
{
if (DateSerializer.DATE_TAG.equals(pLocalName))
{
return new DateParser(newFormat());
}
return super.getParser(pConfig, pContext, pURI, pLocalName);
}
示例10: getParser
import org.apache.xmlrpc.common.XmlRpcStreamConfig; //导入依赖的package包/类
@Override
public TypeParser getParser(XmlRpcStreamConfig pConfig,
NamespaceContextImpl pContext, String pURI, String pLocalName) {
if ("".equals(pURI) && NullSerializer.NIL_TAG.equals(pLocalName)) {
return new NullParser();
} else if ("i8".equals(pLocalName)) {
return new LongTypeParser();
} else {
return super.getParser(pConfig, pContext, pURI, pLocalName);
}
}
示例11: getSerializer
import org.apache.xmlrpc.common.XmlRpcStreamConfig; //导入依赖的package包/类
public TypeSerializer getSerializer(XmlRpcStreamConfig pConfig,
Object pObject) throws SAXException {
if (pObject instanceof Long) {
return new LongTypeSerializer();
} else {
return super.getSerializer(pConfig, pObject);
}
}
示例12: callTimeoutInSec
import org.apache.xmlrpc.common.XmlRpcStreamConfig; //导入依赖的package包/类
@Override
public Object callTimeoutInSec(String method, List<?> params, int timeout,
boolean debug) throws XmlRpcException {
XmlRpcStreamConfig config = new XmlRpcHttpRequestConfigImpl();
XmlRpcClient client = new XmlRpcClient();
client.setTypeFactory(new RpcTypeFactory(client));
XmlRpcResponseParser parser = new XmlRpcResponseParser(
(XmlRpcStreamRequestConfig) config, client.getTypeFactory());
XMLReader xr = SAXParsers.newXMLReader();
xr.setContentHandler(parser);
try {
String result = null;
if (getMethodResponse(method) != null) {
result = getMethodResponse(method);
LOGGER.debug("methodresponse call: " + method + " - " + params);
LOGGER.trace("methodresponse reply: " + result);
}
if (result == null && multiRes.size() >= 0) {
result = getResult();
LOGGER.debug("getresult call: " + method + " - " + params);
LOGGER.trace("getresult reply: " + result);
}
xr.parse(new InputSource(new StringReader(result)));
} catch (Exception e) {
throw new XmlRpcException("Exception: " + e.getMessage(), e);
}
if (parser.getErrorCode() != 0) {
throw new XmlRpcException("Fault received[" + parser.getErrorCode()
+ "]: " + parser.getErrorMessage());
}
return parser.getResult();
}
示例13: getSerializer
import org.apache.xmlrpc.common.XmlRpcStreamConfig; //导入依赖的package包/类
@Override
public TypeSerializer getSerializer(XmlRpcStreamConfig pConfig, Object pObject) throws SAXException {
if (pObject instanceof Double) {
return new DoubleSerializer();
} else if (pObject instanceof Integer) {
return new IntegerSerializer();
} else {
return super.getSerializer(pConfig, pObject);
}
}
示例14: XmlRpcWriter
import org.apache.xmlrpc.common.XmlRpcStreamConfig; //导入依赖的package包/类
public XmlRpcWriter(XmlRpcStreamConfig pConfig, ContentHandler pHandler, TypeFactory pTypeFactory) {
super(pConfig, pHandler, pTypeFactory);
handler = pHandler;
}