diff --git a/assembly.xml b/assembly.xml index fde1cf28..e6f3e2c2 100644 --- a/assembly.xml +++ b/assembly.xml @@ -1,31 +1,32 @@ - - full - - jar - - false - - - target/classes - / - - /** - - - *.properties - *.xml - - - - - - true - - com.foxinmy:weixin4j-base - - - + + + full + + jar + + false + + + target/classes + / + + /** + + + *.properties + *.xml + + + + + + true + + com.foxinmy:weixin4j-base + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index b4cec692..53e84f8b 100644 --- a/pom.xml +++ b/pom.xml @@ -1,260 +1,260 @@ - - - 4.0.0 - com.foxinmy - weixin4j - 1.6.8 - pom - weixin4j - https://github.com/foxinmy/weixin4j - 微信开发工具包 - 2014 - - - Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - A business-friendly OSS license - - - - https://github.com/foxinmy/weixin4j - scm:git:git://github.com/foxinmy/weixin4j.git - scm:git:git@github.com:foxinmy/weixin4j.git - HEAD - - - https://github.com/foxinmy/weixin4j/issues - - - - hujinyuhao@163.com - jinyu - jinyu - https://github.com/foxinmy - +8 - - java developer - - - - - weixin4j-base - weixin4j-mp - weixin4j-qy - weixin4j-server - weixin4j-example - - - UTF-8 - 1.6 - 1.6 - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.0 - - 1.6 - 1.6 - ${project.build.sourceEncoding} - - - - org.apache.maven.plugins - maven-resources-plugin - 2.6 - - ${project.build.sourceEncoding} - - - pem - pfx - p12 - jks - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.5 - - - default-jar - package - - jar - - - target/classes - - *.properties - *.xml - *.txt - **/*.md - - - true - - true - - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.4 - - - attach-sources - - jar-no-fork - - - - - - *.properties - *.xml - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.1 - - - attach-javadocs - - jar - - - - - public - ${project.build.sourceEncoding} - ${project.build.sourceEncoding} - ${project.build.sourceEncoding} - - http://docs.oracle.com/javase/7/docs/api - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.2 - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - verify - - sign - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.18 - - true - - - - org.apache.maven.plugins - maven-assembly-plugin - 2.5.1 - - - ../assembly.xml - - - - - make-assembly - package - - single - - - - - - - - - src/main/java - - **/*.xml - **/*.properties - **/*.pem - **/*.p12 - **/*.pfx - - - - src/main/resources - - *.xml - *.properties - - - - - - - release - - - - org.apache.maven.plugins - maven-source-plugin - - - org.apache.maven.plugins - maven-javadoc-plugin - - - org.apache.maven.plugins - maven-gpg-plugin - - - - - - - - - junit - junit - 4.8.2 - test - - - - - - oss-snapshot - https://oss.sonatype.org/content/repositories/snapshots/ - - - oss-release - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - + + + 4.0.0 + com.foxinmy + weixin4j + 1.6.8 + pom + weixin4j + https://github.com/foxinmy/weixin4j + 微信开发工具包 + 2014 + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + A business-friendly OSS license + + + + https://github.com/foxinmy/weixin4j + scm:git:git://github.com/foxinmy/weixin4j.git + scm:git:git@github.com:foxinmy/weixin4j.git + HEAD + + + https://github.com/foxinmy/weixin4j/issues + + + + hujinyuhao@163.com + jinyu + jinyu + https://github.com/foxinmy + +8 + + java developer + + + + + weixin4j-base + weixin4j-mp + weixin4j-qy + weixin4j-server + weixin4j-example + + + UTF-8 + 1.6 + 1.6 + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.0 + + 1.6 + 1.6 + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-resources-plugin + 2.6 + + ${project.build.sourceEncoding} + + + pem + pfx + p12 + jks + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.5 + + + default-jar + package + + jar + + + target/classes + + *.properties + *.xml + *.txt + **/*.md + + + true + + true + + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.4 + + + attach-sources + + jar-no-fork + + + + + + *.properties + *.xml + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.1 + + + attach-javadocs + + jar + + + + + public + ${project.build.sourceEncoding} + ${project.build.sourceEncoding} + ${project.build.sourceEncoding} + + http://docs.oracle.com/javase/7/docs/api + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + verify + + sign + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.18 + + true + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.5.1 + + + ../assembly.xml + + + + + make-assembly + package + + single + + + + + + + + + src/main/java + + **/*.xml + **/*.properties + **/*.pem + **/*.p12 + **/*.pfx + + + + src/main/resources + + **/*.xml + **/*.properties + + + + + + + release + + + + org.apache.maven.plugins + maven-source-plugin + + + org.apache.maven.plugins + maven-javadoc-plugin + + + org.apache.maven.plugins + maven-gpg-plugin + + + + + + + + + junit + junit + 4.8.2 + test + + + + + + oss-snapshot + https://oss.sonatype.org/content/repositories/snapshots/ + + + oss-release + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + \ No newline at end of file diff --git a/script/assembly.xml b/script/assembly.xml new file mode 100644 index 00000000..f0843723 --- /dev/null +++ b/script/assembly.xml @@ -0,0 +1,35 @@ + + + bin + + zip + + + + true + /lib + + + + + src/main/script + / + + *.sh + *.bat + + + + target/classes + + *.txt + *.properties + *.xml + + /conf + + + \ No newline at end of file diff --git a/script/deploy.xml b/script/deploy.xml new file mode 100644 index 00000000..f6fe14d3 --- /dev/null +++ b/script/deploy.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + ${host}:删除${server.dir}/${zip.name}... + + + + + + + ${host}:上传${app.dir}/${zip.name}... + + + + + + + ${host}:停止${server.name}服务,删除${server.dir}/${server.name}... + + + + + + + ${host}:启动${server.dir}/${server.name}... + + + + + + + app.dir = ${app.dir} + file.zip = ${app.dir}/${zip.name} + + + + + \ No newline at end of file diff --git a/script/startup.sh b/script/startup.sh new file mode 100644 index 00000000..cd164eb0 --- /dev/null +++ b/script/startup.sh @@ -0,0 +1,144 @@ +# Jar执行脚本 + +ulimit -n 110000 +#Jdk home +JAVA_HOME="/usr/local/java" + +#Executing user +RUNNING_USER=root + +#App home +APP_HOME="/path/to/java/app" + +#Main class +APP_MAINCLASS=xx.xxx.mainClass.fullName + +#classpath +CLASSPATH=$APP_HOME/classes +for i in "$APP_HOME"/lib/*.jar; do + CLASSPATH="$CLASSPATH":"$i" +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" + checkpid + if [ $psid -ne 0 ]; then + echo "(pid=$psid) [OK]" + else + echo "[Failed]" + fi + fi +} + +################################### +#stop +################################### +stop() { + checkpid + + if [ $psid -ne 0 ]; then + echo -n "Stopping $APP_MAINCLASS ...(pid=$psid) " + su - $RUNNING_USER -c "kill -9 $psid" + if [ $? -eq 0 ]; then + echo "[OK]" + else + echo "[Failed]" + fi + + checkpid + if [ $psid -ne 0 ]; then + stop + fi + else + echo "================================" + echo "warn: $APP_MAINCLASS is not running" + 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 +################################### +info() { + echo "System Information:" + echo "****************************" + echo `head -n 1 /etc/issue` + echo `uname -a` + echo + echo "JAVA_HOME=$JAVA_HOME" + echo `$JAVA_HOME/bin/java -version` + echo + echo "APP_HOME=$APP_HOME" + echo "APP_MAINCLASS=$APP_MAINCLASS" + echo "****************************" +} + +################################### +#access only 1 argument:{start|stop|restart|status|info} +################################### +case "$1" in + 'start') + start + ;; + 'stop') + stop + ;; + 'restart') + stop + start + ;; + 'status') + status + ;; + 'info') + info + ;; + *) + echo "Usage: $0 {start|stop|restart|status|info}" + exit 1 +esac +exit 0 diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/weixin/error.xml b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/weixin/error.xml index 5ef5a4a5..aa4ed292 100644 --- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/weixin/error.xml +++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/weixin/error.xml @@ -682,6 +682,10 @@ 45027 mpnews每天只能发送100次 + + 45032 + 作者名字长度超过限制 + 46001 不存在媒体数据 diff --git a/weixin4j-server/README.md b/weixin4j-server/README.md index 5d1ef4a8..ae366cc3 100644 --- a/weixin4j-server/README.md +++ b/weixin4j-server/README.md @@ -1,20 +1,20 @@ -weixin4j-server -=============== - -[微信回调消息](http://mp.weixin.qq.com/wiki/1/6239b44c206cab9145b1d52c67e6c551.html)服务器 ----------------- -base on netty. - -功能列表 -------- -* `netty服务器` - -* `消息分发` - -* `消息拦截`(还需更多测试 - -[如何使用](https://github.com/foxinmy/weixin4j/wiki/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8Server) -------------- - -[更新LOG](./CHANGE.md) +weixin4j-server +=============== + +[微信回调消息](http://mp.weixin.qq.com/wiki/1/6239b44c206cab9145b1d52c67e6c551.html)服务器 +---------------- +based on netty. + +功能列表 +------- +* `netty服务器` + +* `消息分发` + +* `消息拦截`(还需更多测试 + +[如何使用](https://github.com/foxinmy/weixin4j/wiki/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8Server) +------------- + +[更新LOG](./CHANGE.md) ---------------------- \ No newline at end of file diff --git a/weixin4j-server/pom.xml b/weixin4j-server/pom.xml index d4a90fa6..322e0dd9 100644 --- a/weixin4j-server/pom.xml +++ b/weixin4j-server/pom.xml @@ -1,54 +1,54 @@ - - - 4.0.0 - - com.foxinmy - weixin4j - 1.6.8 - - weixin4j-server - 1.1.7 - weixin4j-server - https://github.com/foxinmy/weixin4j/tree/master/weixin4j-server - 微信消息netty服务器 - - - io.netty - netty-all - 4.0.23.Final - - - junit - junit - - - org.apache.httpcomponents - httpcore - 4.2.5 - test - - - org.apache.httpcomponents - httpclient - 4.2.5 - - - commons-codec - commons-codec - - - org.apache.httpcomponents - httpcore - - - test - - - org.springframework - spring-context - 4.2.0.RELEASE - test - - + + + 4.0.0 + + com.foxinmy + weixin4j + 1.6.8 + + weixin4j-server + 1.1.7 + weixin4j-server + https://github.com/foxinmy/weixin4j/tree/master/weixin4j-server + 微信消息netty服务器 + + + io.netty + netty-all + 4.0.23.Final + + + junit + junit + + + org.apache.httpcomponents + httpcore + 4.2.5 + test + + + org.apache.httpcomponents + httpclient + 4.2.5 + + + commons-codec + commons-codec + + + org.apache.httpcomponents + httpcore + + + test + + + org.springframework + spring-context + 4.2.0.RELEASE + true + + \ No newline at end of file