提交 6db74bed 编写于 作者: Z zhourui

add jaxrs parameter internal

上级 3fa03e7a
......@@ -2,9 +2,7 @@ package com.x.base.core.project.config;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
......@@ -449,11 +447,14 @@ public class Message extends GsonPropertyObject {
private static final String DEFAULT_URL = "";
private static final String DEFAULT_METHOD = "get";
private static final Boolean DEFAULT_INTERNAL = true;
public RestfulConsumer() {
super(MessageConnector.CONSUME_RESTFUL, false);
this.url = DEFAULT_URL;
this.method = DEFAULT_METHOD;
this.internal = DEFAULT_INTERNAL;
}
@FieldDescribe("地址")
......@@ -462,6 +463,13 @@ public class Message extends GsonPropertyObject {
@FieldDescribe("方法")
private String method;
@FieldDescribe("是否是系统内部请求.")
private Boolean internal;
public Boolean getInternal() {
return null == this.internal ? DEFAULT_INTERNAL : this.internal;
}
public String getUrl() {
return StringUtils.isBlank(this.url) ? DEFAULT_URL : this.url;
}
......
......@@ -99,7 +99,7 @@ public class Messages extends ConcurrentSkipListMap<String, Message> {
o.put(MessageConnector.TYPE_ATTACHMENT_EDITORCANCEL, MESSAGE_OUTER.cloneThenSetDescription("附件可编辑取消"));
o.put(MessageConnector.TYPE_ATTACHMENT_EDITORMODIFY, MESSAGE_OUTER.cloneThenSetDescription("附件可编辑修改"));
o.put(MessageConnector.TYPE_CALENDAR_ALARM, MESSAGE_ALL.cloneThenSetDescription("日历通知"));
o.put(MessageConnector.TYPE_CUSTOM_CREATE, MESSAGE_OUTER.cloneThenSetDescription("自定义消息创建"));
o.put(MessageConnector.TYPE_CUSTOM_CREATE, MESSAGE_ALL.cloneThenSetDescription("自定义消息创建"));
o.put(MessageConnector.TYPE_TEAMWORK_TASKCREATE, MESSAGE_ALL.cloneThenSetDescription("工作管理任务创建"));
o.put(MessageConnector.TYPE_TEAMWORK_TASKUPDATE, MESSAGE_ALL.cloneThenSetDescription("工作管理任务更新"));
o.put(MessageConnector.TYPE_TEAMWORK_TASKDELETE, MESSAGE_ALL.cloneThenSetDescription("工作管理任务删除"));
......@@ -111,7 +111,9 @@ public class Messages extends ConcurrentSkipListMap<String, Message> {
o.put(MessageConnector.TYPE_BBS_REPLYCREATE, MESSAGE_ALL.cloneThenSetDescription("论坛创建回复"));
o.put(MessageConnector.TYPE_MIND_FILESEND, MESSAGE_ALL.cloneThenSetDescription("脑图发送"));
o.put(MessageConnector.TYPE_MIND_FILESHARE, MESSAGE_ALL.cloneThenSetDescription("脑图分享"));
o.put(MessageConnector.TYPE_IM_CREATE, new Message(MessageConnector.CONSUME_WS, MessageConnector.CONSUME_PMS_INNER).cloneThenSetDescription("聊聊消息"));
o.put(MessageConnector.TYPE_IM_CREATE,
new Message(MessageConnector.CONSUME_WS, MessageConnector.CONSUME_PMS_INNER)
.cloneThenSetDescription("聊聊消息"));
return o;
}
......
......@@ -165,9 +165,9 @@ public class ApplicationServerTools extends JettySeverTools {
Server server = new Server(threadPool);
server.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", MAX_FORM_CONTENT_SIZE);
if (BooleanUtils.isTrue(applicationServer.getSslEnable())) {
addHttpsConnector(server, applicationServer.getPort(), false);
addHttpsConnector(server, applicationServer.getPort(), true);
} else {
addHttpConnector(server, applicationServer.getPort(), false);
addHttpConnector(server, applicationServer.getPort(), true);
}
GzipHandler gzipHandler = new GzipHandler();
gzipHandler.setHandler(handlers);
......
......@@ -94,9 +94,9 @@ public class CenterServerTools extends JettySeverTools {
server.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", MAX_FORM_CONTENT_SIZE);
if (BooleanUtils.isTrue(centerServer.getSslEnable())) {
addHttpsConnector(server, centerServer.getPort(), false);
addHttpsConnector(server, centerServer.getPort(), true);
} else {
addHttpConnector(server, centerServer.getPort(), false);
addHttpConnector(server, centerServer.getPort(), true);
}
GzipHandler gzipHandler = new GzipHandler();
......
......@@ -114,9 +114,9 @@ public class WebServerTools extends JettySeverTools {
threadPool.setMaxThreads(THREAD_POOL_SIZE_MAX);
Server server = new Server(threadPool);
if (BooleanUtils.isTrue(webServer.getSslEnable())) {
addHttpsConnector(server, webServer.getPort(), false);
addHttpsConnector(server, webServer.getPort(), true);
} else {
addHttpConnector(server, webServer.getPort(), false);
addHttpConnector(server, webServer.getPort(), true);
}
GzipHandler gzipHandler = new GzipHandler();
gzipHandler.setHandler(handlers);
......
......@@ -2,7 +2,9 @@ package com.x.message.assemble.communicate;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -13,6 +15,7 @@ import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
......@@ -23,6 +26,7 @@ import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject_;
import com.x.base.core.project.config.Message.RestfulConsumer;
import com.x.base.core.project.connection.CipherConnectionAction;
import com.x.base.core.project.connection.HttpConnectionResponse;
import com.x.base.core.project.gson.XGsonBuilder;
import com.x.base.core.project.logger.Logger;
......@@ -74,7 +78,11 @@ public class RestfulConsumeQueue extends AbstractQueue<Message> {
RestfulConsumer consumer = gson.fromJson(message.getProperties().getConsumerJsonElement(),
RestfulConsumer.class);
String url = url(message, consumer);
HttpConnectionResponse response = client.restful(consumer.getMethod(), url, null, gson.toJson(message),
Map<String, String> heads = new HashMap<>();
if (BooleanUtils.isTrue(consumer.getInternal())) {
CipherConnectionAction.cipher().forEach(o -> heads.put(o.getName(), o.getValue().toString()));
}
HttpConnectionResponse response = client.restful(consumer.getMethod(), url, heads, gson.toJson(message),
5000, 5000);
if (null == response) {
throw new ExceptionRestful(message.getTitle(), message.getPerson(), url);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册