Visual Rules Solution Java Integration Interface <9> - Java classes are invoked through different services - transfer data format types

The parameter streamtype defaults to 1, which can not be configured. You can configure the transmission data format type according to your needs. 0 represents the original string format. 1 means encrypted compressed string. 2 means compressed string. 3 means compressed bytes. 4 means GZIP compressed stream. When the client transmits, set the transmission data format type through Property.getInstance().setServerSendtype(...), the default is 1, that is,
Property.getInstance().setServerSendtype(Property.ENCRYZIPSTRINGSEND), where the value of Property.RAWSEND is 0, The value of Property.ZIPSTRINGSEND is 2, the value of Property.ZIPBYTESEND is 3, and the value of Property.GZIPSEND is 4. When the data format type transmitted by the client is 1, the parameter value of the parameter streamtype can be 0 or 1. Transmission
data format type There are four types of transmission data format, 0 represents the original format, in the code Property. RAWSEND, 1 represents encryption and compression, in the code Property. ENCRYZIPSTRINGSEND, 2 represents the compressed string, in the code Property. ZIPSTRINGSEND,
3 represents compressed binary, in code Property.ZIPBYTESEND, 4 represents GZIP stream, in code Property.GZIPSEND.
Servlet call: Five types of transmission data formats are available, and the transmission data format type in the java code needs to be consistent with the transmission data format type set in the web.xml configuration.
Java code: Property.getInstance().setServerSendtype(...);
web.xml configures the streamtype parameter of DBRuleServerServlet:
<servlet>
<servlet-name>DBRuleServerServlet</servlet-name>
<servlet-class>com.flagleader.webserver.DBRuleServerServlet
</servlet-class>
<init-param>
<param-name>xmltype</param-name>
<param- value>json</param-value>
</init-param>
<init-param>
<param-name>streamtype</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
Socket call: Only 0, 1, and 3 can be used in the five transmission data format types, and the transmission data format type and web in the java code are required The .xml configuration settings are consistent with the type of transmission data format. The code called by 0 and 1 cannot be used in 3, and the code needs to be changed.
Java code: Support transmission data format type 0 , 1
Property.getInstance().setServerSendtype(Property.RAWSEND);

RuleService  engine=RuleServerPoolFactory.getFactory().getRuleService();
web.xml配置DBRuleServerServlet的streamtype参数
<servlet>
<servlet-name>WebRuleServerServlet</servlet-name>
<servlet-class>com.flagleader.webserver.WebRuleServerServlet
</servlet-class>
<init-param>
<param-name>servertype</param-name>
<param-value>socket</param-value>
</init-param>
<init-param>
<param-name>ruleServerPort</param-name>
<param-value>1508</param-value>
</init-param>
<init-param>
<param-name>definepath</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>streamtype</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
Java代码:支持传输数据格式类型3
Property.getInstance().setServerSendtype(Property.ZIPBYTESEND);
RuleService engine = new RuleServerZipFactory("127.0.0.1",1508).getRuleService();
web.xml配置DBRuleServerServlet的streamtype参数
<servlet>
<servlet-name>WebRuleServerServlet</servlet-name>
<servlet-class>com.flagleader.webserver.WebRuleServerServlet
</servlet-class>
<init-param>
<param-name>servertype</param-name>
<param-value>socket</param-value>
</init-param>
<init-param>
<param-name>ruleServerPort</param-name>
<param-value>1508</param-value>
</init-param>
<init-param>
<param-name>definepath</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>streamtype</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326719938&siteId=291194637