something
This commit is contained in:
parent
c527924169
commit
3e022ad101
@ -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
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.foxinmy</groupId>
|
||||
<artifactId>weixin4j</artifactId>
|
||||
<version>1.7.3</version>
|
||||
<version>1.7.4</version>
|
||||
</parent>
|
||||
<artifactId>weixin4j-example</artifactId>
|
||||
<version>1.0</version>
|
||||
@ -19,7 +19,7 @@
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>../script/assembly.xml</descriptor>
|
||||
<descriptor>src/main/script/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>weixin4j-server</finalName>
|
||||
</configuration>
|
||||
@ -47,13 +47,13 @@
|
||||
<dependency>
|
||||
<groupId>com.foxinmy</groupId>
|
||||
<artifactId>weixin4j-mp</artifactId>
|
||||
<version>1.7.3</version>
|
||||
<version>1.7.4</version>
|
||||
</dependency>
|
||||
<!-- 微信企业号 -->
|
||||
<dependency>
|
||||
<groupId>com.foxinmy</groupId>
|
||||
<artifactId>weixin4j-qy</artifactId>
|
||||
<version>1.7.3</version>
|
||||
<version>1.7.4</version>
|
||||
</dependency>
|
||||
<!-- 微信被动消息(回调模式) -->
|
||||
<dependency>
|
||||
|
||||
31
weixin4j-example/src/main/script/assembly.xml
Normal file
31
weixin4j-example/src/main/script/assembly.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<!-- maven-assembly-plugin:zip可执行包 -->
|
||||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<id>bin</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<includes>
|
||||
<include>io.netty:netty-all</include>
|
||||
<include>com.foxinmy:weixin4j-server</include>
|
||||
<include>com.foxinmy:weixin4j-example</include>
|
||||
</includes>
|
||||
<useProjectArtifact>true</useProjectArtifact>
|
||||
<outputDirectory>/lib</outputDirectory>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>src/main/script</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<includes>
|
||||
<include>*.sh</include>
|
||||
<include>*.bat</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
@ -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
|
||||
@ -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(
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user