diff --git a/script/startup.sh b/script/startup.sh
index 1ff426aa..7ed1d91c 100644
--- a/script/startup.sh
+++ b/script/startup.sh
@@ -1,17 +1,12 @@
-# Jar包服务执行脚本
-
-ulimit -n 110000
#Jdk home
-JAVA_HOME="/path/to/java"
+if [ ! -n "$JAVA_HOME" ]; then
+ export JAVA_HOME="/usr/local/java"
+fi
-#Executing user
-RUNNING_USER=root
-
-#App home
-APP_HOME="/path/to/weixin4j/service"
+APP_HOME=$(cd "$(dirname "$0")"; pwd)
#Main class
-APP_MAINCLASS=xx.xxx.mainClass
+APP_MAINCLASS=com.foxinmy.weixin4j.example.server.Weixin4jServerStartup
#classpath
CLASSPATH=$APP_HOME/classes
@@ -49,9 +44,7 @@ start() {
echo "================================"
else
echo -n "Starting $APP_MAINCLASS ..."
-# JAVA_CMD="nohup $JAVA_HOME/bin/java $JAVA_OPTS -classpath $CLASSPATH $APP_MAINCLASS >/dev/null 2>&1 &"
- JAVA_CMD="$JAVA_HOME/bin/java $JAVA_OPTS -classpath $CLASSPATH $APP_MAINCLASS &"
- su - $RUNNING_USER -c "$JAVA_CMD"
+ nohup ${JAVA_HOME}/bin/java ${JAVA_OPTS} -classpath ${CLASSPATH} ${APP_MAINCLASS} > ${APP_HOME}/nohup.log 2>&1 &
checkpid
if [ $psid -ne 0 ]; then
echo "(pid=$psid) [OK]"
@@ -141,4 +134,4 @@ case "$1" in
echo "Usage: $0 {start|stop|restart|status|info}"
exit 1
esac
-exit 0
+exit 0
\ No newline at end of file
diff --git a/weixin4j-example/pom.xml b/weixin4j-example/pom.xml
index 098860cd..d5dc0506 100644
--- a/weixin4j-example/pom.xml
+++ b/weixin4j-example/pom.xml
@@ -5,7 +5,7 @@
com.foxinmy
weixin4j
- 1.7.3
+ 1.7.4
weixin4j-example
1.0
@@ -19,7 +19,7 @@
maven-assembly-plugin
- ../script/assembly.xml
+ src/main/script/assembly.xml
weixin4j-server
@@ -47,13 +47,13 @@
com.foxinmy
weixin4j-mp
- 1.7.3
+ 1.7.4
com.foxinmy
weixin4j-qy
- 1.7.3
+ 1.7.4
diff --git a/weixin4j-example/src/main/script/assembly.xml b/weixin4j-example/src/main/script/assembly.xml
new file mode 100644
index 00000000..565227ae
--- /dev/null
+++ b/weixin4j-example/src/main/script/assembly.xml
@@ -0,0 +1,31 @@
+
+
+ bin
+
+ zip
+
+
+
+
+ io.netty:netty-all
+ com.foxinmy:weixin4j-server
+ com.foxinmy:weixin4j-example
+
+ true
+ /lib
+
+
+
+
+ src/main/script
+ /
+
+ *.sh
+ *.bat
+
+
+
+
\ No newline at end of file
diff --git a/weixin4j-example/src/main/script/startup.sh b/weixin4j-example/src/main/script/startup.sh
index 55f4b16d..7ed1d91c 100644
--- a/weixin4j-example/src/main/script/startup.sh
+++ b/weixin4j-example/src/main/script/startup.sh
@@ -1,18 +1,13 @@
-# Jar执行脚本
-
-ulimit -n 110000
#Jdk home
-JAVA_HOME="/usr/local/java"
-
-#Executing user
-RUNNING_USER=root
-
-#App home
-APP_HOME="/usr/local/weixin4j/weixin4j-server"
-
+if [ ! -n "$JAVA_HOME" ]; then
+ export JAVA_HOME="/usr/local/java"
+fi
+
+APP_HOME=$(cd "$(dirname "$0")"; pwd)
+
#Main class
APP_MAINCLASS=com.foxinmy.weixin4j.example.server.Weixin4jServerStartup
-
+
#classpath
CLASSPATH=$APP_HOME/classes
for i in "$APP_HOME"/lib/*.jar; do
@@ -20,38 +15,36 @@ for i in "$APP_HOME"/lib/*.jar; do
done
CLASSPATH="$CLASSPATH":"$APP_HOME"/conf
-
+
#jvm options
JAVA_OPTS="-Xms256m -Xmx512m -Djava.awt.headless=true -XX:MaxPermSize=128m -server -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=85 -XX:+DisableExplicitGC -Xnoclassgc -Xverify:none"
-
+
#psid
psid=0
-
+
checkpid() {
javaps=`$JAVA_HOME/bin/jps -l | grep $APP_MAINCLASS`
-
+
if [ -n "$javaps" ]; then
psid=`echo $javaps | awk '{print $1}'`
else
psid=0
fi
}
-
+
###################################
#startup
###################################
start() {
checkpid
-
+
if [ $psid -ne 0 ]; then
echo "================================"
echo "warn: $APP_MAINCLASS already started! (pid=$psid)"
echo "================================"
else
echo -n "Starting $APP_MAINCLASS ..."
-# JAVA_CMD="nohup $JAVA_HOME/bin/java $JAVA_OPTS -classpath $CLASSPATH $APP_MAINCLASS >/dev/null 2>&1 &"
- JAVA_CMD="$JAVA_HOME/bin/java $JAVA_OPTS -classpath $CLASSPATH $APP_MAINCLASS &"
- su - $RUNNING_USER -c "$JAVA_CMD"
+ nohup ${JAVA_HOME}/bin/java ${JAVA_OPTS} -classpath ${CLASSPATH} ${APP_MAINCLASS} > ${APP_HOME}/nohup.log 2>&1 &
checkpid
if [ $psid -ne 0 ]; then
echo "(pid=$psid) [OK]"
@@ -60,13 +53,13 @@ start() {
fi
fi
}
-
+
###################################
#stop
###################################
stop() {
checkpid
-
+
if [ $psid -ne 0 ]; then
echo -n "Stopping $APP_MAINCLASS ...(pid=$psid) "
su - $RUNNING_USER -c "kill -9 $psid"
@@ -75,7 +68,7 @@ stop() {
else
echo "[Failed]"
fi
-
+
checkpid
if [ $psid -ne 0 ]; then
stop
@@ -86,20 +79,20 @@ stop() {
echo "================================"
fi
}
-
+
###################################
#status
###################################
status() {
checkpid
-
+
if [ $psid -ne 0 ]; then
echo "$APP_MAINCLASS is running! (pid=$psid)"
else
echo "$APP_MAINCLASS is not running"
fi
}
-
+
###################################
#info
###################################
@@ -116,7 +109,7 @@ info() {
echo "APP_MAINCLASS=$APP_MAINCLASS"
echo "****************************"
}
-
+
###################################
#access only 1 argument:{start|stop|restart|status|info}
###################################
@@ -141,4 +134,4 @@ case "$1" in
echo "Usage: $0 {start|stop|restart|status|info}"
exit 1
esac
-exit 0
+exit 0
\ No newline at end of file
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/type/IndustryType.java b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/type/IndustryType.java
index 42804052..0cb6f76b 100644
--- a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/type/IndustryType.java
+++ b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/type/IndustryType.java
@@ -12,7 +12,7 @@ import java.util.Map;
* @since JDK 1.6
*/
public enum IndustryType {
- ITKEJI_HULIANWANG$DIANZISHANGWU("IT科技", "互联网/电子商务", 1), ITKEJI_ITRUANJIANYUFUWU(
+ ITKEJI_HULIANWANG$DIANZISHANGWU("IT科技", "互联网|电子商务", 1), ITKEJI_ITRUANJIANYUFUWU(
"IT科技", "IT软件与服务", 2), ITKEJI_ITYINGJIANYUSHEBEI("IT科技", "IT硬件与设备",
3), ITKEJI_DIANZIJISHU("IT科技", "电子技术", 4), ITKEJI_TONGXINYUYUNYINGSHANG(
"IT科技", "通信与运营商", 5), ITKEJI_WANGLUOYOUXI("IT科技", "网络游戏", 6), JINRONGYE_YINXING(
diff --git a/weixin4j-server/src/main/java/com/foxinmy/weixin4j/util/HttpUtil.java b/weixin4j-server/src/main/java/com/foxinmy/weixin4j/util/HttpUtil.java
index 2ac9a7b3..cf5769f8 100644
--- a/weixin4j-server/src/main/java/com/foxinmy/weixin4j/util/HttpUtil.java
+++ b/weixin4j-server/src/main/java/com/foxinmy/weixin4j/util/HttpUtil.java
@@ -1,5 +1,6 @@
package com.foxinmy.weixin4j.util;
+import static io.netty.handler.codec.http.HttpHeaderNames.CONNECTION;
import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH;
import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE;
import static io.netty.handler.codec.http.HttpHeaderNames.DATE;
@@ -8,6 +9,7 @@ import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
import io.netty.buffer.Unpooled;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.FullHttpResponse;
+import io.netty.handler.codec.http.HttpHeaderValues;
import io.netty.handler.codec.http.HttpResponse;
import io.netty.handler.codec.http.HttpResponseStatus;
@@ -60,6 +62,7 @@ public class HttpUtil {
* (HttpHeaders.isTransferEncodingChunked(httpRequest)) {
* httpResponse.headers().set(TRANSFER_ENCODING, Values.CHUNKED); }
*/
+ httpResponse.headers().set(CONNECTION, HttpHeaderValues.CLOSE);
httpResponse.headers().set(DATE, new Date());
httpResponse.headers().set(SERVER, SERVER);
httpResponse.headers()