All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.logicbus.service.Helloworld Maven / Gradle / Ivy

There is a newer version: 1.6.16
Show newest version
package com.logicbus.service;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import com.logicbus.backend.Context;
import com.logicbus.backend.Servant;
import com.logicbus.backend.ServantException;
import com.logicbus.backend.message.XMLMessage;
import com.logicbus.models.servant.ServiceDescription;

/**
 * Helloworld
 * 
 * 
* 一个小小的测试服务,向客户端说了声Helloworld * 定义在/com/logicbus/service/servant.xml中,具体配置如下:
* * {@code * * * * * * } * *
* 如果配置在服务器中,访问地址为:
* {@code * http://[host]:[port]/[webcontext]/services/demo/logicbus/Helloworld * } * *
* 本实现支持在服务描述信息中定义参数,参数如下:
* - welcome:用于出现不同的欢迎语 * * @author duanyy * @version 1.4.0 [20141117 duanyy]
* - 将MessageDoc和Context进行合并整合
*/ public class Helloworld extends Servant { protected String m_welcome; public int actionProcess(Context ctx) { XMLMessage msg = (XMLMessage)ctx.asMessage(XMLMessage.class); Element root = msg.getRoot(); Document doc = root.getOwnerDocument(); root.appendChild(doc.createTextNode( m_welcome)); return 0; } public void create(ServiceDescription sd) throws ServantException{ super.create(sd); m_welcome = sd.getProperties().GetValue("welcome", "Welcome to Logic Bus Server!"); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy