﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-华梦行</title><link>http://www.blogjava.net/huamengxing/</link><description>专注于java</description><language>zh-cn</language><lastBuildDate>Wed, 29 Apr 2026 02:38:16 GMT</lastBuildDate><pubDate>Wed, 29 Apr 2026 02:38:16 GMT</pubDate><ttl>60</ttl><item><title>数据输入校验C#</title><link>http://www.blogjava.net/huamengxing/archive/2020/06/13/435510.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Sat, 13 Jun 2020 02:46:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2020/06/13/435510.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/435510.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2020/06/13/435510.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/435510.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/435510.html</trackback:ping><description><![CDATA[<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //允许输入字母、点、回退键、数字<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (((int)e.KeyChar &gt;= (int)'a' &amp;&amp; (int)e.KeyChar &lt;= (int)'z') || (((int)e.KeyChar &gt; 48 &amp;&amp; (int)e.KeyChar &lt; 57) || (int)e.KeyChar == 8 || (int)e.KeyChar == 46))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.Handled = false;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else e.Handled = true; <br /><br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //允许输入字母、回退键、数字<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (((int)e.KeyChar &gt;= (int)'a' &amp;&amp; (int)e.KeyChar &lt;= (int)'z') || (((int)e.KeyChar &gt; 48 &amp;&amp; (int)e.KeyChar &lt; 57) || (int)e.KeyChar == 8))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.Handled = false;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else e.Handled = true;&nbsp;<br /><br /><br />//&nbsp;只能输入字母数字以及中文字<br />&nbsp; if ((e.KeyChar != '\b') &amp;&amp; (!Char.IsLetter(e.KeyChar)) &amp;&amp; (!char.IsDigit(e.KeyChar)))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.Handled = true;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />//只输入数字<br />&nbsp;if (e.KeyChar != 8 &amp;&amp; (!Char.IsDigit(e.KeyChar)))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.Handled = true;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />只能输入数字以及字母X<br /><br />&nbsp; if (e.KeyChar != 88 &amp;&amp; e.KeyChar != 8 &amp;&amp; (!Char.IsDigit(e.KeyChar)))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.Handled = true;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><img src ="http://www.blogjava.net/huamengxing/aggbug/435510.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2020-06-13 10:46 <a href="http://www.blogjava.net/huamengxing/archive/2020/06/13/435510.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>nlog安装</title><link>http://www.blogjava.net/huamengxing/archive/2020/01/06/435020.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Mon, 06 Jan 2020 08:10:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2020/01/06/435020.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/435020.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2020/01/06/435020.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/435020.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/435020.html</trackback:ping><description><![CDATA[<span style='text-decoration: none; white-space: pre-wrap; word-spacing: 0px; text-transform: none; word-break: break-all; float: none; color: rgb(255,255,255); text-align: left; font: 400 1em/1.5 Consolas,Menlo,Monaco,"Courier New",monospace; orphans: 2; display: inline !important; letter-spacing: normal; background-color: rgb(0,36,64); text-indent: 0px; overflow-wrap: break-word; -webkit-text-stroke-width: 0px'>Install-Package NLog.Config -Version 3.2.1<br /><br /><br /><br />Install-Package NLog -Version 3.2.1</span><img src ="http://www.blogjava.net/huamengxing/aggbug/435020.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2020-01-06 16:10 <a href="http://www.blogjava.net/huamengxing/archive/2020/01/06/435020.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>mysql5.7以上版本在常会报关于only_full_group_by的错误，可以在sql_mode中关闭他，网上查找的解</title><link>http://www.blogjava.net/huamengxing/archive/2019/09/15/434627.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Sun, 15 Sep 2019 14:02:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2019/09/15/434627.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/434627.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2019/09/15/434627.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/434627.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/434627.html</trackback:ping><description><![CDATA[<a href="https://blog.csdn.net/ieayoio/article/details/79543899">
<ul style="list-style-type: none; box-sizing: border-box; font-size: 16px; word-wrap: break-word; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; font-variant: normal; white-space: normal; word-spacing: 0px; text-transform: none; font-weight: normal; color: ; outline-width: 0px; padding-bottom: 0px; font-style: normal; padding-top: 0px; outline-style: none; padding-left: 0px; widows: 1; margin: 0px 0px 24px; letter-spacing: normal; outline-color: invert; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><li style="list-style-type: disc; box-sizing: border-box; word-wrap: break-word; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; outline-width: 0px; padding-bottom: 0px; padding-top: 0px; outline-style: none; padding-left: 0px; margin: 8px 0px 0px 32px; outline-color: invert; padding-right: 0px"><span style="white-space: normal; word-spacing: 0px; text-transform: none; float: none; color: rgb(77,77,77); font: 16px/26px 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; widows: 1; display: inline !important; letter-spacing: normal; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px">mysql5.7以上版本在常会报关于</span><code style="box-sizing: border-box; word-wrap: break-word; white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(199,37,78); outline-width: 0px; padding-bottom: 2px; padding-top: 2px; font: 14px/22px 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; outline-style: none; padding-left: 4px; widows: 1; letter-spacing: normal; outline-color: invert; padding-right: 4px; background-color: rgb(249,242,244); text-indent: 0px; -webkit-text-stroke-width: 0px; border-radius: 2px">only_full_group_by</code><span style="white-space: normal; word-spacing: 0px; text-transform: none; float: none; color: rgb(77,77,77); font: 16px/26px 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; widows: 1; display: inline !important; letter-spacing: normal; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px">的错误，可以在sql_mode中关闭他，网上查找的解</span></li><li style="list-style-type: disc; box-sizing: border-box; word-wrap: break-word; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; outline-width: 0px; padding-bottom: 0px; padding-top: 0px; outline-style: none; padding-left: 0px; margin: 8px 0px 0px 32px; outline-color: invert; padding-right: 0px"></li><li style="list-style-type: disc; box-sizing: border-box; word-wrap: break-word; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; outline-width: 0px; padding-bottom: 0px; padding-top: 0px; outline-style: none; padding-left: 0px; margin: 8px 0px 0px 32px; outline-color: invert; padding-right: 0px"></li><li style="list-style-type: disc; box-sizing: border-box; word-wrap: break-word; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; outline-width: 0px; padding-bottom: 0px; padding-top: 0px; outline-style: none; padding-left: 0px; margin: 8px 0px 0px 32px; outline-color: invert; padding-right: 0px">在[mysqld]中添加代码</li></ul><pre class="prettyprint" style="box-sizing: border-box; word-wrap: break-word; border-top: medium none; border-right: medium none; word-spacing: 0px; overflow-x: auto; overflow-y: hidden; border-bottom: medium none; position: relative; text-transform: none; color: rgb(0,0,0); outline-width: 0px; padding-bottom: 6px; padding-top: 8px; font: 14px/22px 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; outline-style: none; padding-left: 56px; border-left: medium none; widows: 1; margin: 0px 0px 24px; letter-spacing: normal; outline-color: invert; padding-right: 16px; background-color: rgb(246,248,250); text-indent: 0px; -webkit-text-stroke-width: 0px"><code onclick="mdcp.signin(event)" class=" hljs bash" style="box-sizing: border-box; font-size: 14px; word-wrap: break-word; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; white-space: pre; min-width: 94%; overflow-x: auto; color: rgb(79,79,79) !important; outline-width: 0px; padding-bottom: 8px; padding-top: 8px; outline-style: none; padding-left: 8px; display: block; outline-color: invert; line-height: 22px; padding-right: 8px; background-color: rgb(246,248,250); border-radius: 4px">sql_mode =<span class="hljs-string" style="box-sizing: border-box; word-wrap: break-word; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; color: rgb(0,153,0) !important; outline-width: 0px; outline-style: none; outline-color: invert">'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'</span></code></pre><pre class="prettyprint" style="box-sizing: border-box; word-wrap: break-word; border-top: medium none; border-right: medium none; word-spacing: 0px; overflow-x: auto; overflow-y: hidden; border-bottom: medium none; position: relative; text-transform: none; color: rgb(0,0,0); outline-width: 0px; padding-bottom: 6px; padding-top: 8px; font: 14px/22px 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; outline-style: none; padding-left: 56px; border-left: medium none; widows: 1; margin: 0px 0px 24px; letter-spacing: normal; outline-color: invert; padding-right: 16px; background-color: rgb(246,248,250); text-indent: 0px; -webkit-text-stroke-width: 0px"><p style="box-sizing: border-box; word-wrap: break-word; white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(77,77,77); outline-width: 0px; padding-bottom: 0px; padding-top: 0px; font: 16px/26px 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; outline-style: none; padding-left: 0px; widows: 1; margin: 0px 0px 16px; letter-spacing: normal; outline-color: invert; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px">重启mysql</p><pre class="prettyprint" style="box-sizing: border-box; word-wrap: break-word; border-top: medium none; border-right: medium none; word-spacing: 0px; overflow-x: auto; overflow-y: hidden; border-bottom: medium none; position: relative; text-transform: none; color: rgb(0,0,0); outline-width: 0px; padding-bottom: 6px; padding-top: 8px; font: 14px/22px 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; outline-style: none; padding-left: 56px; border-left: medium none; widows: 1; margin: 0px 0px 24px; letter-spacing: normal; outline-color: invert; padding-right: 16px; background-color: rgb(246,248,250); text-indent: 0px; -webkit-text-stroke-width: 0px"><code onclick="mdcp.signin(event)" class=" hljs bash" style="box-sizing: border-box; font-size: 14px; word-wrap: break-word; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; white-space: pre; min-width: 94%; overflow-x: auto; color: rgb(79,79,79) !important; outline-width: 0px; padding-bottom: 8px; padding-top: 8px; outline-style: none; padding-left: 8px; display: block; outline-color: invert; line-height: 22px; padding-right: 8px; background-color: rgb(246,248,250); border-radius: 4px"><span class="hljs-built_in" style="box-sizing: border-box; word-wrap: break-word; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; color: rgb(79,79,79) !important; outline-width: 0px; outline-style: none; outline-color: invert">sudo</span> service mysql restart</code></pre><p style="box-sizing: border-box; word-wrap: break-word; white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(77,77,77); outline-width: 0px; padding-bottom: 0px; padding-top: 0px; font: 16px/26px 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; outline-style: none; padding-left: 0px; widows: 1; margin: 0px 0px 16px; letter-spacing: normal; outline-color: invert; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><span style="white-space: normal; word-spacing: 0px; text-transform: none; float: none; color: rgb(77,77,77); font: 16px/26px 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; widows: 1; display: inline !important; letter-spacing: normal; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px">mysql5.7以上版本在常会报关于</span><code style="box-sizing: border-box; word-wrap: break-word; white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(199,37,78); outline-width: 0px; padding-bottom: 2px; padding-top: 2px; font: 14px/22px 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; outline-style: none; padding-left: 4px; widows: 1; letter-spacing: normal; outline-color: invert; padding-right: 4px; background-color: rgb(249,242,244); text-indent: 0px; -webkit-text-stroke-width: 0px; border-radius: 2px">only_full_group_by</code><span style="white-space: normal; word-spacing: 0px; text-transform: none; float: none; color: rgb(77,77,77); font: 16px/26px 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; widows: 1; display: inline !important; letter-spacing: normal; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px">的错误，可以在sql_mode中关闭他，网上查找的解</span><br />查看参数是否存在</p><pre class="prettyprint" style="box-sizing: border-box; word-wrap: break-word; border-top: medium none; border-right: medium none; word-spacing: 0px; overflow-x: auto; overflow-y: hidden; border-bottom: medium none; position: relative; text-transform: none; color: rgb(0,0,0); outline-width: 0px; padding-bottom: 6px; padding-top: 8px; font: 14px/22px 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; outline-style: none; padding-left: 56px; border-left: medium none; widows: 1; margin: 0px 0px 24px; letter-spacing: normal; outline-color: invert; padding-right: 16px; background-color: rgb(246,248,250); text-indent: 0px; -webkit-text-stroke-width: 0px"><code onclick="mdcp.signin(event)" class=" hljs asciidoc" style="box-sizing: border-box; font-size: 14px; word-wrap: break-word; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; white-space: pre; min-width: 94%; overflow-x: auto; color: rgb(79,79,79) !important; outline-width: 0px; padding-bottom: 8px; padding-top: 8px; outline-style: none; padding-left: 8px; display: block; outline-color: invert; line-height: 22px; padding-right: 8px; background-color: rgb(246,248,250); border-radius: 4px"><span class="hljs-header" style="box-sizing: border-box; word-wrap: break-word; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; color: rgb(0,153,0) !important; outline-width: 0px; outline-style: none; outline-color: invert">mysql&gt; SELECT @@sql_mode;
+------------------------------------------------------------------------------------------------------------------------+</span>
<span class="hljs-header" style="box-sizing: border-box; word-wrap: break-word; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; color: rgb(0,153,0) !important; outline-width: 0px; outline-style: none; outline-color: invert">| @@sql_mode                                                                                                             |
+------------------------------------------------------------------------------------------------------------------------+</span>
<span class="hljs-header" style="box-sizing: border-box; word-wrap: break-word; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; color: rgb(0,153,0) !important; outline-width: 0px; outline-style: none; outline-color: invert">| STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+------------------------------------------------------------------------------------------------------------------------+</span>
1 row in set (0.00 sec)

<span class="hljs-header" style="box-sizing: border-box; word-wrap: break-word; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; color: rgb(0,153,0) !important; outline-width: 0px; outline-style: none; outline-color: invert">mysql&gt; SELECT @@GLOBAL.sql_mode;
+------------------------------------------------------------------------------------------------------------------------+</span>
<span class="hljs-header" style="box-sizing: border-box; word-wrap: break-word; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; color: rgb(0,153,0) !important; outline-width: 0px; outline-style: none; outline-color: invert">| @@GLOBAL.sql_mode                                                                                                      |
+------------------------------------------------------------------------------------------------------------------------+</span>
<span class="hljs-header" style="box-sizing: border-box; word-wrap: break-word; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; color: rgb(0,153,0) !important; outline-width: 0px; outline-style: none; outline-color: invert">| STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+------------------------------------------------------------------------------------------------------------------------+</span>
1 row in set (0.00 sec)</code></pre></pre></a><img src ="http://www.blogjava.net/huamengxing/aggbug/434627.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2019-09-15 22:02 <a href="http://www.blogjava.net/huamengxing/archive/2019/09/15/434627.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>mysql zip 安装5.7</title><link>http://www.blogjava.net/huamengxing/archive/2019/09/14/434622.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Sat, 14 Sep 2019 14:51:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2019/09/14/434622.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/434622.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2019/09/14/434622.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/434622.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/434622.html</trackback:ping><description><![CDATA[<p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(51,51,51); padding-bottom: 0px; padding-top: 0px; font: 14px/25px Verdana, Arial, Helvetica, sans-serif; padding-left: 0px; widows: 1; margin: 10px auto; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><span style="font-family: 'Microsoft YaHei'; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-right: 0px">MYSQL_HOME&nbsp; &nbsp; &nbsp;解压路径 &nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="color: rgb(51,102,255); padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-right: 0px">C:\DevelopTool\MySQL\mysql-5.7.25-winx64&nbsp; &nbsp;&nbsp;</span></span></p>
<p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(51,51,51); padding-bottom: 0px; padding-top: 0px; font: 14px/25px Verdana, Arial, Helvetica, sans-serif; padding-left: 0px; widows: 1; margin: 10px auto; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><span style="font-family: 'Microsoft YaHei'; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-right: 0px"><img style="max-width: 800px; border-top: medium none; height: auto; border-right: medium none; border-bottom: medium none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: medium none; margin: 0px; padding-right: 0px" alt="" src="https://img2018.cnblogs.com/blog/1633237/201909/1633237-20190908223218082-1823549475.png" width="798" height="210" /></span></p>
<p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(51,51,51); padding-bottom: 0px; padding-top: 0px; font: 14px/25px Verdana, Arial, Helvetica, sans-serif; padding-left: 0px; widows: 1; margin: 10px auto; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><span style="font-family: 'Microsoft YaHei'; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-right: 0px">&nbsp;</span></p>
<p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(51,51,51); padding-bottom: 0px; padding-top: 0px; font: 14px/25px Verdana, Arial, Helvetica, sans-serif; padding-left: 0px; widows: 1; margin: 10px auto; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><span style="font-family: 'Microsoft YaHei'; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-right: 0px">&nbsp;</span></p>
<p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(51,51,51); padding-bottom: 0px; padding-top: 0px; font: 14px/25px Verdana, Arial, Helvetica, sans-serif; padding-left: 0px; widows: 1; margin: 10px auto; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><span style="font-family: 'Microsoft YaHei'; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-right: 0px">&nbsp;Path&nbsp; &nbsp; &nbsp;<span style="color: rgb(51,102,255); padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-right: 0px">%MYSQL_HOME%\bin</span></span></p><br /><br />&gt;mysqld --initialize --user=mysql --console<br /><span style="white-space: normal; word-spacing: 0px; text-transform: none; float: none; color: rgb(0,0,255); font: 14px/25px 'Microsoft YaHei'; widows: 1; display: inline !important; letter-spacing: normal; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px">mysqld -install&nbsp;<br />
<p style="box-sizing: border-box; word-wrap: break-word; white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(77,77,77); outline-width: 0px; padding-bottom: 0px; padding-top: 0px; font: 16px/26px 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; outline-style: none; padding-left: 0px; widows: 1; margin: 0px 0px 16px; letter-spacing: normal; outline-color: invert; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px">先启动服务：</p><pre style="box-sizing: border-box; word-wrap: break-word; word-spacing: 0px; position: relative; text-transform: none; color: rgb(0,0,0); outline-width: 0px; padding-bottom: 0px; padding-top: 0px; font: 14px/22px 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; outline-style: none; padding-left: 0px; widows: 1; margin: 1.2em 0px 24px; letter-spacing: normal; outline-color: invert; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><code onclick="mdcp.signin(event)" style="box-sizing: border-box; font-size: 14px; word-wrap: break-word; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; white-space: pre; min-width: 94%; overflow-x: auto; color: rgb(171,178,191); outline-width: 0px; padding-bottom: 0.5em; padding-top: 0.5em; outline-style: none; padding-left: 0.5em; display: block; outline-color: invert; line-height: 22px; padding-right: 0.5em; background-color: rgb(40,44,52); border-radius: 4px">net start MySQL【或者是MySQL57】</code></pre><br />修改密码<br /><span style="white-space: normal; word-spacing: 0px; text-transform: none; float: none; color: rgb(75,75,75); text-align: left; font: 13px/19px verdana, Arial, helvetica, sans-seriff; widows: 1; display: inline !important; letter-spacing: normal; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px">mysqladmin -uroot -p123456 password 123<span class="Apple-converted-space">&nbsp;<br /><br /></span></span><br /><span style="white-space: pre; word-spacing: 0px; text-transform: none; float: none; color: rgb(171,178,191); font: 14px/22px 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; widows: 1; display: inline !important; letter-spacing: normal; background-color: rgb(40,44,52); text-indent: 0px; -webkit-text-stroke-width: 0px">sc delete 服务名例如： sc delete mysql</span></span><br /><br /><br /><a href="https://www.cnblogs.com/july7/p/11489029.html">https://www.cnblogs.com/july7/p/11489029.html</a> <br /><br />远程访问<br /><pre class="prism-token token  language-javascript" style="box-sizing: border-box; overflow: auto; word-wrap: normal; white-space: pre; word-spacing: 0px; text-transform: none; word-break: normal; color: rgb(51,51,51); padding-bottom: 16px; text-align: left; padding-top: 16px; font: 14px/1.45 Consolas, 'Liberation Mono', Menlo, Courier, monospace; padding-left: 16px; widows: 1; margin: 24px 0px; letter-spacing: normal; padding-right: 16px; background-color: rgb(247,247,247); text-indent: 0px; -webkit-text-stroke-width: 0px; border-radius: 3px; font-stretch: normal; tab-size: 2">use mysql<span class="token punctuation" style="box-sizing: border-box; color: rgb(153,153,153)">;</span>
GRANT ALL ON <span class="token operator" style="box-sizing: border-box;background: none transparent scroll repeat 0% 0%; color: rgb(166,127,89)">*</span><span class="token punctuation" style="box-sizing: border-box; color: rgb(153,153,153)">.</span><span class="token operator" style="box-sizing: border-box;background: none transparent scroll repeat 0% 0%; color: rgb(166,127,89)">*</span> TO root@<span class="token string" style="box-sizing: border-box; color: rgb(102,153,0)">'%'</span> IDENTIFIED BY <span class="token string" style="box-sizing: border-box; color: rgb(102,153,0)">'密码'</span> WITH GRANT OPTION<span class="token punctuation" style="box-sizing: border-box; color: rgb(153,153,153)">;</span>
flush privileges<span class="token punctuation" style="box-sizing: border-box; color: rgb(153,153,153)">;</span></pre><img src ="http://www.blogjava.net/huamengxing/aggbug/434622.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2019-09-14 22:51 <a href="http://www.blogjava.net/huamengxing/archive/2019/09/14/434622.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>postman不能启动的问题</title><link>http://www.blogjava.net/huamengxing/archive/2019/05/18/433802.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Sat, 18 May 2019 03:11:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2019/05/18/433802.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/433802.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2019/05/18/433802.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/433802.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/433802.html</trackback:ping><description><![CDATA[ 需要添加一个环境变量POSTMAN_DISABLE_GPU = true。

<img src ="http://www.blogjava.net/huamengxing/aggbug/433802.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2019-05-18 11:11 <a href="http://www.blogjava.net/huamengxing/archive/2019/05/18/433802.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>REST API URI设计</title><link>http://www.blogjava.net/huamengxing/archive/2017/06/26/432624.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Mon, 26 Jun 2017 01:50:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2017/06/26/432624.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/432624.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2017/06/26/432624.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/432624.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/432624.html</trackback:ping><description><![CDATA[<p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">在了解REST API URI设计的规则之前，让我们快速浏览一些我们将要讨论的术语。</p><h2>URIs</h2><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">REST API使用统一资源标识符（URI）来寻址资源。在当今互联网上，充斥着各种各样的URI设计规则，既有像<a href="http://api.example.com/louvre/leonardo-da-vinci/mona-lisa" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">//api.example.com/louvre/leonardo-da-vinci/mona-lisa</a>这样能够清楚的传达API资源模型的文章，也有很难理解的文章，例如：<a href="http://api.example.com/68dd0-a9d3-11e0-9f1c-0800200c9a66" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">//api.example.com/68dd0-a9d3-11e0-9f1c-0800200c9a66</a>&nbsp;；Tim Berners-Lee在他的&#8220;Axioms of Web Architecture&#8221;一文中将URI的不透明度总结成一句话：</p><blockquote style="box-sizing: border-box; padding: 10px 20px; margin-right: 0px; margin-left: 0px; border-left-width: 5px; border-left-color: rgba(128, 128, 128, 0.0745098); background-color: #f7f7f7; font-family: 'microsoft yahei', arial; line-height: 27px;"><p style="box-sizing: border-box; margin: 0px;">唯一可以使用标识符的是引用对象。在不取消引用时，就不应该查看URI字符串的内容以获取其他信息。&nbsp;<br style="box-sizing: border-box;" />&#8212;&#8212;<a href="http://www.w3.org/DesignIssues/Axioms.html" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">蒂姆&#183;伯纳斯 - 李</a></p></blockquote><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">客户端必须遵循Web的链接范例，将URI视为不透明标识符。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">REST API设计人员应该在考虑将REST API资源模型传达给潜在的客户端开发者的前提下，创造URI。在这篇文章中，我将尝试为REST API URI 引入一套<a href="http://www.restcase.com/" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">设计规则</a>。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">先跳过规则，URI的通用语法也适用与本文中的URI。<a href="https://www.ietf.org/rfc/rfc3986.txt" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">RFC 3986</a>定义了通用URI语法，如下所示：</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;"><span style="box-sizing: border-box; font-weight: 700;">URI = scheme &#8220;://&#8221; authority &#8220;/&#8221; path [ &#8220;?&#8221; query ][ &#8220;#&#8221; fragment ]</span></p><h2>规则1：URI结尾不应包含（/）</h2><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">这是作为URI路径中处理中最重要的规则之一，正斜杠（/）不会增加语义值，且可能导致混淆。REST API不允许一个尾部的斜杠，不应该将它们包含在提供给客户端的链接的结尾处。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">许多Web组件和框架将平等对待以下两个URI：&nbsp;<br style="box-sizing: border-box;" /><a href="http://api.canvas.com/shapes/" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">http://api.canvas.com/shapes/&nbsp;</a><br style="box-sizing: border-box;" /><a href="http://api.canvas.com/shapes" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">http://api.canvas.com/shapes</a></p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;"><span style="box-sizing: border-box; font-weight: 700;">但是，实际上URI中的每个字符都会计入资源的唯一身份的识别中。</span></p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">两个不同的URI映射到两个不同的资源。如果URI不同，那么资源也是如此，反之亦然。因此，REST API必须生成和传递精确的URI，不能容忍任何的客户端尝试不精确的资源定位。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">有些API碰到这种情况，可能设计为让客户端重定向到相应没有尾斜杠的URI（也有可能会返回301 - 用来资源重定向）。</p><h2>规则2：正斜杠分隔符（/）必须用来指示层级关系</h2><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">URI的路径中的正斜杠（/）字符用于指示资源之间的层次关系。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">例如：&nbsp;<br style="box-sizing: border-box;" /><a href="http://api.canvas.com/shapes/polygons/quadrilaterals/squares" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">(http://api.canvas.com/shapes/polygons/quadrilaterals/squares</a>&nbsp;；</p><h2>规则3：应使用连字符（ - ）来提高URI的可读性</h2><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">为了使您的URI容易让人们理解，请使用连字符（ - ）字符来提高长路径中名称的可读性。在路径中，应该使用连字符代空格连接两个单词 。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">例如：&nbsp;<br style="box-sizing: border-box;" /><a href="http://api.example.com/blogs/guy-levin/posts/this-is-my-first-post" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">http://api.example.com/blogs/guy-levin/posts/this-is-my-first-post</a></p><h2>规则4：不得在URI中使用下划线（_）</h2><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">一些文本查看器为了区分强调URI，常常会在URI下加上下划线。这样下划线（_）字符可能被文本查看器中默认的下划线部分地遮蔽或完全隐藏。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;"><span style="box-sizing: border-box; font-weight: 700;">为避免这种混淆，请使用连字符（ - ）而不是下划线</span></p><h2>规则5：URI路径中首选小写字母</h2><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">方便时，URI路径中首选小写字母，因为大写字母有时会导致一些问题。RFC 3986将URI定义为区分大小写，但scheme 和 host components除外。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">例如：&nbsp;<br style="box-sizing: border-box;" /><a href="http://api.example.com/my-folder/my-doc" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">http://api.example.com/my-folder/my-doc</a></p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;"><a href="http://api.example.com/my-folder/my-doc" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">HTTP://API.EXAMPLE.COM/my-folder/my-doc</a>&nbsp;<br style="box-sizing: border-box;" />这个URI很好。URI格式规范（RFC 3986）认为该URI与URI＃1相同。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;"><a href="http://api.example.com/My-Folder/my-doc" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">http://api.example.com/My-Folder/my-doc</a>&nbsp;<br style="box-sizing: border-box;" />而这个URI与URI 1和2不同，这可能会导致不必要的混淆。</p><h2>规则6：文件扩展名不应包含在URI中</h2><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">在Web上，（.）字符通常用于分隔URI的文件名和扩展名。&nbsp;<br style="box-sizing: border-box;" />REST API不应在URI中包含人造文件扩展名，来指示邮件实体的格式。相反，他们应该依赖通过Content-Type中的header传递media type，来确定如何处理正文的内容。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;"><a href="http://api.college.com/students/3248234/courses/2005/fall.json" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">http://api.college.com/students/3248234/courses/2005/fall.json&nbsp;</a><br style="box-sizing: border-box;" /><a href="http://api.college.com/students/3248234/courses/2005/fall" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">http://api.college.com/students/3248234/courses/2005/fall</a></p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">如上所示：不应使用文件扩展名来表示格式。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">应鼓励REST API客户端使用HTTP提供的格式选择机制Accept request header。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">为了是链接和调试更简单，REST API应该支持通过查询参数来支持媒体类型的选择。</p><h2>规则7：端点名称是单数还是复数？</h2><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">keep-it-simple的原则在这里同样适用。虽然一些&#8221;语法学家&#8221;会告诉你使用复数来描述资源的单个实例是错误的，但实际上为了保持URI格式的一致性建议使用复数形式。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">本着API提供商更容易实施和API使用者更容易操作的原则，可以不必纠结一些奇怪的复数（person/people，goose/geese）。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">但是应该怎么处理层级关系呢？如果一个关系只能存在于另一个资源中，RESTful原则就会提供有用的指导。我们来看一下这个例子。学生有一些课程。这些课程在逻辑上映射到学生终端，如下所示：</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;"><a href="http://api.college.com/students/3248234/courses" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">http://api.college.com/students/3248234/courses</a>&nbsp;- 检索id为3248234的学生学习的所有课程的清单。&nbsp;<br style="box-sizing: border-box;" /><a href="http://api.college.com/students/3248234/courses/physics" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">http://api.college.com/students/3248234/courses/physics</a>&nbsp;-检索该学生的物理课程</p><h2>结论</h2><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">当你在<a href="http://www.apibldr.com/" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">设计REST API</a>服务时，您必须注意这些由URI定义的资源。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">正在构建的服务中的每个资源将至少有一个URI标识它。这个URI最好是有意义的，且能充分描述资源。URI应遵循可预测的层次结构，用来提高其可理解性，可用性：可预测的意义在于它们是一致的，它的层次结构在数据关系上是有意义的。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">RESTful API是为使用者编写的。URI的名称和结构应该能够向使用者传达更清晰的含义。通过遵循上述规则，您将创建一个更清晰的的REST API与更友好的客户端。这些并不是REST的规则或约束，仅仅是API的增强和补充。</p><p style="box-sizing: border-box; margin: 0px 0px 20px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">我也建议你来看看<a href="http://blog.restcase.com/5-basic-rest-api-design-guidelines/" style="box-sizing: border-box; background-color: transparent; color: #337ab7; text-decoration: none;">http://blog.restcase.com/5-basic-rest-api-design-guidelines/</a>这篇文章。</p><p style="box-sizing: border-box; margin: 0px; color: #333333; font-family: 'microsoft yahei', arial; font-size: 16px; line-height: 27px; text-align: justify; background-color: #ffffff;">最后，望大家牢记：你在为你的客户端设计API URI，而不仅仅是为你的数据。</p><img src ="http://www.blogjava.net/huamengxing/aggbug/432624.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2017-06-26 09:50 <a href="http://www.blogjava.net/huamengxing/archive/2017/06/26/432624.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>加载文件的方式</title><link>http://www.blogjava.net/huamengxing/archive/2017/06/19/432615.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Mon, 19 Jun 2017 06:45:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2017/06/19/432615.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/432615.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2017/06/19/432615.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/432615.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/432615.html</trackback:ping><description><![CDATA[<p style="margin-top: 0pt; margin-bottom: 0pt; direction: ltr; unicode-bidi: embed; vertical-align: baseline;"><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:zh-CN;font-weight:bold">* </span><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">this.getClass</span><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">().</span><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">getClassLoader</span><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">().</span><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">getResourceAsStream</span><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">("</span><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">testVariables.bpmn</span><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">")</span></p>  <p style="margin-top: 0pt; margin-bottom: 0pt; direction: ltr; unicode-bidi: embed; vertical-align: baseline;"><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size:14.0pt; font-family:宋体;color:#FF3300;language: zh-CN;font-weight:bold">从</span><u><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">classpath</span></u><span style="font-size:14.0pt;font-family:宋体;color:#FF3300;language:zh-CN;font-weight:bold">根目录下加载指定名称的文件</span></p>  <p style="margin-top: 0pt; margin-bottom: 0pt; direction: ltr; unicode-bidi: embed; vertical-align: baseline;"><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:zh-CN;font-weight:bold">&nbsp;* </span><span style="font-size:14.0pt; font-family:Verdana;color:#FF3300;language: en-US;font-weight:bold">this.getClass</span><span style="font-size:14.0pt; font-family:Verdana;color:#FF3300;language: en-US;font-weight:bold">().</span><span style="font-size:14.0pt;font-family: Verdana;color:#FF3300;language:en-US;font-weight:bold">getResourceAsStream</span><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">("</span><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">testVariables.bpmn</span><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">")&nbsp;&nbsp;&nbsp; </span></p>  <p style="margin-top: 0pt; margin-bottom: 0pt; direction: ltr; unicode-bidi: embed; vertical-align: baseline;"><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:zh-CN;font-weight:bold">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 从当前包下加载指定名称的文件</span></p>  <p style="margin-top: 0pt; margin-bottom: 0pt; direction: ltr; unicode-bidi: embed; vertical-align: baseline;"><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:zh-CN;font-weight:bold">&nbsp;* </span><span style="font-size:14.0pt; font-family:Verdana;color:#FF3300;language: en-US;font-weight:bold">this.getClass</span><span style="font-size:14.0pt; font-family:Verdana;color:#FF3300;language: en-US;font-weight:bold">().</span><span style="font-size:14.0pt;font-family: Verdana;color:#FF3300;language:en-US;font-weight:bold">getResourceAsStream</span><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">("/</span><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">testVariables.bpmn</span><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">")&nbsp; </span></p>  <p style="margin-top: 0pt; margin-bottom: 0pt; direction: ltr; unicode-bidi: embed; vertical-align: baseline;"><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:zh-CN;font-weight:bold">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 从</span><u><span style="font-size:14.0pt;font-family:Verdana;color:#FF3300;language:en-US;font-weight:bold">classpath</span></u><span style="font-size:14.0pt;font-family:宋体;color:#FF3300;language:zh-CN;font-weight:bold">根目录下加载指定名称的文件</span></p><img src ="http://www.blogjava.net/huamengxing/aggbug/432615.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2017-06-19 14:45 <a href="http://www.blogjava.net/huamengxing/archive/2017/06/19/432615.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>restful</title><link>http://www.blogjava.net/huamengxing/archive/2017/05/26/432551.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Fri, 26 May 2017 00:01:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2017/05/26/432551.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/432551.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2017/05/26/432551.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/432551.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/432551.html</trackback:ping><description><![CDATA[<pre style="background-color: #ffffff; font-family: 'Lucida Sans Typewriter'; font-size: 12pt;"><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">package</span>&nbsp;org.gdharley.activiti.integration.rest;<br /><br /><span style="color: #0000FF; ">import</span>&nbsp;com.fasterxml.jackson.annotation.JsonProperty;<br /><span style="color: #0000FF; ">import</span>&nbsp;com.fasterxml.jackson.databind.JsonNode;<br /><span style="color: #0000FF; ">import</span>&nbsp;com.fasterxml.jackson.databind.ObjectMapper;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.activiti.engine.ActivitiException;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.activiti.engine.delegate.DelegateExecution;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.activiti.engine.delegate.Expression;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.activiti.engine.delegate.JavaDelegate;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.commons.lang3.StringUtils;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.http.HttpResponse;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.http.NameValuePair;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.http.client.methods.*;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.http.client.utils.URIBuilder;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.http.client.utils.URLEncodedUtils;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.http.conn.ssl.SSLConnectionSocketFactory;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.http.conn.ssl.SSLContextBuilder;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.http.conn.ssl.TrustSelfSignedStrategy;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.http.entity.StringEntity;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.http.impl.client.CloseableHttpClient;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.http.impl.client.HttpClientBuilder;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.http.message.BasicNameValuePair;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.http.protocol.HTTP;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.http.util.EntityUtils;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.slf4j.Logger;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.slf4j.LoggerFactory;<br /><span style="color: #0000FF; ">import</span>&nbsp;org.springframework.http.HttpMethod;<br /><br /><span style="color: #0000FF; ">import</span>&nbsp;java.io.IOException;<br /><span style="color: #0000FF; ">import</span>&nbsp;java.net.URI;<br /><span style="color: #0000FF; ">import</span>&nbsp;java.net.URISyntaxException;<br /><span style="color: #0000FF; ">import</span>&nbsp;java.util.List;<br /><br /><br /><span style="color: #008000; ">/**</span><span style="color: #008000; "><br />&nbsp;*&nbsp;Created&nbsp;by&nbsp;gharley&nbsp;on&nbsp;5/2/17.<br />&nbsp;</span><span style="color: #008000; ">*/</span><br /><span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">class</span>&nbsp;SimpleRestDelegate&nbsp;<span style="color: #0000FF; ">implements</span>&nbsp;JavaDelegate&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">private</span>&nbsp;<span style="color: #0000FF; ">static</span>&nbsp;<span style="color: #0000FF; ">final</span>&nbsp;Logger&nbsp;logger&nbsp;=&nbsp;LoggerFactory.getLogger(SimpleRestDelegate.<span style="color: #0000FF; ">class</span>);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;Expression&nbsp;endpointUrl;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;Expression&nbsp;httpMethod;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;Expression&nbsp;isSecure;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;Expression&nbsp;payload;<br /><br /><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;&nbsp;&nbsp;&nbsp;一个Content-Type是application/json的请求，具体看起来是这样的：<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;&nbsp;&nbsp;&nbsp;POST&nbsp;/some-path&nbsp;HTTP/1.1<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;&nbsp;&nbsp;&nbsp;Content-Type:&nbsp;application/json<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; "><br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;"foo"&nbsp;:&nbsp;"bar",&nbsp;"name"&nbsp;:&nbsp;"John"&nbsp;}<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; "><br /></span><span style="color: #008000; ">//</span><span style="color: #008000; "><br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;"foo"&nbsp;:&nbsp;"bar",&nbsp;"name"&nbsp;:&nbsp;"John"&nbsp;}&nbsp;就是这个请求的payload</span><span style="color: #008000; "><br /></span><br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;Expression&nbsp;headers;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;Expression&nbsp;responseMapping;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;ObjectMapper&nbsp;objectMapper&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ObjectMapper();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;Create&nbsp;a&nbsp;mixin&nbsp;to&nbsp;force&nbsp;the&nbsp;BasicNameValuePair&nbsp;constructor</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;<span style="color: #0000FF; ">static</span>&nbsp;<span style="color: #0000FF; ">abstract</span>&nbsp;<span style="color: #0000FF; ">class</span>&nbsp;BasicNameValuePairMixIn&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">private</span>&nbsp;BasicNameValuePairMixIn(@JsonProperty("name")&nbsp;String&nbsp;name,&nbsp;@JsonProperty("value")&nbsp;String&nbsp;value)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;execute(DelegateExecution&nbsp;execution)&nbsp;<span style="color: #0000FF; ">throws</span>&nbsp;Exception&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logger.info("Started&nbsp;Generic&nbsp;REST&nbsp;call&nbsp;delegate");<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(endpointUrl&nbsp;==&nbsp;<span style="color: #0000FF; ">null</span>&nbsp;||&nbsp;httpMethod&nbsp;==&nbsp;<span style="color: #0000FF; ">null</span>)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">throw</span>&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;IllegalArgumentException("An&nbsp;endpoint&nbsp;URL&nbsp;and&nbsp;http&nbsp;method&nbsp;are&nbsp;required");<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;restUrl&nbsp;=&nbsp;getExpressionAsString(endpointUrl,&nbsp;execution);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;payloadStr&nbsp;=&nbsp;getExpressionAsString(payload,&nbsp;execution);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;headersJSON&nbsp;=&nbsp;getExpressionAsString(headers,&nbsp;execution);&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;[{"name":"headerName",&nbsp;"value":"headerValue"}]</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;method&nbsp;=&nbsp;getExpressionAsString(httpMethod,&nbsp;execution);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;rMapping&nbsp;=&nbsp;getExpressionAsString(responseMapping,&nbsp;execution);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;secure&nbsp;=&nbsp;getExpressionAsString(isSecure,&nbsp;execution);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;scheme&nbsp;=&nbsp;secure&nbsp;==&nbsp;"true"&nbsp;?&nbsp;"https"&nbsp;:&nbsp;"http";<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;validate&nbsp;URI&nbsp;and&nbsp;create&nbsp;create&nbsp;request</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;URI&nbsp;restEndpointURI&nbsp;=&nbsp;composeURI(restUrl,&nbsp;execution);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logger.info("Using&nbsp;Generic&nbsp;REST&nbsp;URI&nbsp;"&nbsp;+&nbsp;restEndpointURI.toString());<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HttpRequestBase&nbsp;httpRequest&nbsp;=&nbsp;createHttpRequest(restEndpointURI,&nbsp;scheme,&nbsp;method,&nbsp;headersJSON,&nbsp;payloadStr,&nbsp;rMapping);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;create&nbsp;http&nbsp;client</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CloseableHttpClient&nbsp;httpClient&nbsp;=&nbsp;createHttpClient(httpRequest,&nbsp;scheme,&nbsp;execution);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;execute&nbsp;request</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HttpResponse&nbsp;response&nbsp;=&nbsp;executeHttpRequest(httpClient,&nbsp;httpRequest);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;map&nbsp;response&nbsp;to&nbsp;process&nbsp;instance&nbsp;variables</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(responseMapping&nbsp;!=&nbsp;<span style="color: #0000FF; ">null</span>)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mapResponse(response,&nbsp;rMapping,&nbsp;execution);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logger.info("Ended&nbsp;Generic&nbsp;REST&nbsp;call&nbsp;delegate");<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;URI&nbsp;composeURI(String&nbsp;restUrl,&nbsp;DelegateExecution&nbsp;execution)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">throws</span>&nbsp;URISyntaxException&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;URIBuilder&nbsp;uriBuilder&nbsp;=&nbsp;<span style="color: #0000FF; ">null</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uriBuilder&nbsp;=&nbsp;encodePath(restUrl,&nbsp;uriBuilder);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;uriBuilder.build();<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;URIBuilder&nbsp;encodePath(String&nbsp;restUrl,&nbsp;URIBuilder&nbsp;uriBuilder)&nbsp;<span style="color: #0000FF; ">throws</span>&nbsp;URISyntaxException&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(StringUtils.isNotEmpty(restUrl))&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;check&nbsp;if&nbsp;there&nbsp;are&nbsp;URL&nbsp;params</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(restUrl.indexOf('?')&nbsp;&gt;&nbsp;-1)&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List&lt;NameValuePair&gt;&nbsp;params&nbsp;=&nbsp;URLEncodedUtils.parse(<span style="color: #0000FF; ">new</span>&nbsp;URI(restUrl),&nbsp;"UTF-8");<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(params&nbsp;!=&nbsp;<span style="color: #0000FF; ">null</span>&nbsp;&amp;&amp;&nbsp;!params.isEmpty())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;restUrl&nbsp;=&nbsp;restUrl.substring(0,&nbsp;restUrl.indexOf('?'));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uriBuilder&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;URIBuilder(restUrl);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uriBuilder.addParameters(params);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">else</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uriBuilder&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;URIBuilder(restUrl);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;uriBuilder;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;HttpRequestBase&nbsp;createHttpRequest(URI&nbsp;restEndpointURI,&nbsp;String&nbsp;scheme,&nbsp;String&nbsp;httpMethod,&nbsp;String&nbsp;headers,&nbsp;String&nbsp;payload,&nbsp;String&nbsp;responseMapping)&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(StringUtils.isEmpty(httpMethod))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">throw</span>&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ActivitiException("no&nbsp;HTTP&nbsp;method&nbsp;provided");<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(restEndpointURI&nbsp;==&nbsp;<span style="color: #0000FF; ">null</span>)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">throw</span>&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ActivitiException("no&nbsp;REST&nbsp;endpoint&nbsp;URI&nbsp;provided");<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HttpRequestBase&nbsp;httpRequest&nbsp;=&nbsp;<span style="color: #0000FF; ">null</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HttpMethod&nbsp;parsedMethod&nbsp;=&nbsp;HttpMethod.valueOf(httpMethod.toUpperCase());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;StringEntity&nbsp;input;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;URIBuilder&nbsp;builder&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;URIBuilder(restEndpointURI);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">switch</span>&nbsp;(parsedMethod)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">case</span>&nbsp;GET:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">try</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpRequest&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;HttpGet(builder.build());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpRequest&nbsp;=&nbsp;addHeadersToRequest(httpRequest,&nbsp;headers);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">catch</span>&nbsp;(URISyntaxException&nbsp;use)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">throw</span>&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ActivitiException("Error&nbsp;while&nbsp;building&nbsp;GET&nbsp;request",&nbsp;use);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">break</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">case</span>&nbsp;POST:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">try</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpRequest&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;HttpPost(builder.build());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;input&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;StringEntity(payload);<br /><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;input.setContentType(new&nbsp;BasicHeader(HTTP.CONTENT_TYPE,&nbsp;"application/json"));</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((HttpPost)&nbsp;httpRequest).setEntity(input);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpRequest&nbsp;=&nbsp;addHeadersToRequest(httpRequest,&nbsp;headers);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">break</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">catch</span>&nbsp;(Exception&nbsp;e)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">throw</span>&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ActivitiException("Error&nbsp;while&nbsp;building&nbsp;POST&nbsp;request",&nbsp;e);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">case</span>&nbsp;PUT:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">try</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpRequest&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;HttpPut(builder.build());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;input&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;StringEntity(payload);<br /><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;input.setContentType(new&nbsp;BasicHeader(HTTP.CONTENT_TYPE,&nbsp;"application/json"));</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((HttpPut)&nbsp;httpRequest).setEntity(input);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpRequest&nbsp;=&nbsp;addHeadersToRequest(httpRequest,&nbsp;headers);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">break</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">catch</span>&nbsp;(Exception&nbsp;e)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">throw</span>&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ActivitiException("Error&nbsp;while&nbsp;building&nbsp;PUT&nbsp;request",&nbsp;e);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">case</span>&nbsp;DELETE:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">try</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpRequest&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;HttpDelete(builder.build());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpRequest&nbsp;=&nbsp;addHeadersToRequest(httpRequest,&nbsp;headers);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">catch</span>&nbsp;(URISyntaxException&nbsp;use)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">throw</span>&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ActivitiException("Error&nbsp;while&nbsp;building&nbsp;DELETE&nbsp;request",&nbsp;use);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">break</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">default</span>:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">throw</span>&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ActivitiException("unknown&nbsp;HTTP&nbsp;method&nbsp;provided");<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;httpRequest;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;CloseableHttpClient&nbsp;createHttpClient(HttpRequestBase&nbsp;request,&nbsp;String&nbsp;scheme,&nbsp;DelegateExecution&nbsp;execution)&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SSLConnectionSocketFactory&nbsp;sslsf&nbsp;=&nbsp;<span style="color: #0000FF; ">null</span>;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;Allow&nbsp;self&nbsp;signed&nbsp;certificates&nbsp;and&nbsp;hostname&nbsp;mismatches.</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(StringUtils.equalsIgnoreCase(scheme,&nbsp;"https"))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">try</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SSLContextBuilder&nbsp;builder&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;SSLContextBuilder();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;builder.loadTrustMaterial(<span style="color: #0000FF; ">null</span>,&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;TrustSelfSignedStrategy());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sslsf&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;SSLConnectionSocketFactory(builder.build(),&nbsp;SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">catch</span>&nbsp;(Exception&nbsp;e)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logger.warn("Could&nbsp;not&nbsp;configure&nbsp;HTTP&nbsp;client&nbsp;to&nbsp;use&nbsp;SSL",&nbsp;e);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HttpClientBuilder&nbsp;httpClientBuilder&nbsp;=&nbsp;HttpClientBuilder.create();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(sslsf&nbsp;!=&nbsp;<span style="color: #0000FF; ">null</span>)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpClientBuilder.setSSLSocketFactory(sslsf);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;httpClientBuilder.build();<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;HttpResponse&nbsp;executeHttpRequest(CloseableHttpClient&nbsp;httpClient,&nbsp;HttpRequestBase&nbsp;httpRequest)&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CloseableHttpResponse&nbsp;response&nbsp;=&nbsp;<span style="color: #0000FF; ">null</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">try</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;response&nbsp;=&nbsp;httpClient.execute(httpRequest);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">catch</span>&nbsp;(IOException&nbsp;e)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">throw</span>&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ActivitiException("error&nbsp;while&nbsp;executing&nbsp;http&nbsp;request:&nbsp;"&nbsp;+&nbsp;httpRequest.getURI(),&nbsp;e);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(response.getStatusLine().getStatusCode()&nbsp;&gt;=&nbsp;400)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">throw</span>&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ActivitiException("error&nbsp;while&nbsp;executing&nbsp;http&nbsp;request&nbsp;"&nbsp;+&nbsp;httpRequest.getURI()&nbsp;+&nbsp;"&nbsp;with&nbsp;status&nbsp;code:&nbsp;"<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;response.getStatusLine().getStatusCode());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;response;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;mapResponse(HttpResponse&nbsp;response,&nbsp;String&nbsp;responseMapping,&nbsp;DelegateExecution&nbsp;execution)&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(responseMapping&nbsp;==&nbsp;<span style="color: #0000FF; ">null</span>&nbsp;||&nbsp;responseMapping.trim().length()&nbsp;==&nbsp;0)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JsonNode&nbsp;jsonNode&nbsp;=&nbsp;<span style="color: #0000FF; ">null</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">try</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;jsonString&nbsp;=&nbsp;EntityUtils.toString(response.getEntity());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jsonNode&nbsp;=&nbsp;objectMapper.readTree(jsonString);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">catch</span>&nbsp;(Exception&nbsp;e)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">throw</span>&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ActivitiException("error&nbsp;while&nbsp;parsing&nbsp;response",&nbsp;e);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(jsonNode&nbsp;==&nbsp;<span style="color: #0000FF; ">null</span>)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">throw</span>&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ActivitiException("didn't&nbsp;expect&nbsp;an&nbsp;empty&nbsp;response&nbsp;body");<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;execution.setVariable(responseMapping,&nbsp;jsonNode.toString());<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;HttpRequestBase&nbsp;addHeadersToRequest(HttpRequestBase&nbsp;httpRequest,&nbsp;String&nbsp;headerJSON)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Boolean&nbsp;contentTypeDetected&nbsp;=&nbsp;<span style="color: #0000FF; ">false</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(headerJSON&nbsp;!=&nbsp;<span style="color: #0000FF; ">null</span>)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;Convert&nbsp;JSON&nbsp;to&nbsp;array</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">try</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;configuration&nbsp;for&nbsp;Jackson/fasterxml</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objectMapper.addMixInAnnotations(BasicNameValuePair.<span style="color: #0000FF; ">class</span>,&nbsp;BasicNameValuePairMixIn.<span style="color: #0000FF; ">class</span>);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NameValuePair[]&nbsp;headers&nbsp;=&nbsp;objectMapper.readValue(headerJSON,&nbsp;BasicNameValuePair[].<span style="color: #0000FF; ">class</span>);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">for</span>&nbsp;(NameValuePair&nbsp;header&nbsp;:&nbsp;headers)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpRequest.addHeader(header.getName(),&nbsp;header.getValue());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(header.getName().equals(HTTP.CONTENT_TYPE))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;contentTypeDetected&nbsp;=&nbsp;<span style="color: #0000FF; ">true</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">catch</span>&nbsp;(Exception&nbsp;e)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">throw</span>&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ActivitiException("Unable&nbsp;to&nbsp;parse&nbsp;JSON&nbsp;header&nbsp;array",&nbsp;e);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;Now&nbsp;add&nbsp;content&nbsp;type&nbsp;if&nbsp;necessary</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(!contentTypeDetected)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;httpRequest.addHeader(HTTP.CONTENT_TYPE,&nbsp;"application/json");<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;httpRequest;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">/**</span><span style="color: #008000; "><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span style="color: #808080; ">@return</span><span style="color: #008000; ">&nbsp;string&nbsp;value&nbsp;of&nbsp;expression.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span style="color: #808080; ">@throws</span><span style="color: #008000; ">&nbsp;{</span><span style="color: #808080; ">@link</span><span style="color: #008000; ">&nbsp;IllegalArgumentException}&nbsp;when&nbsp;the&nbsp;expression&nbsp;resolves&nbsp;to&nbsp;a&nbsp;value&nbsp;which&nbsp;is&nbsp;not&nbsp;a&nbsp;string<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;if&nbsp;the&nbsp;value&nbsp;is&nbsp;null.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; ">*/</span><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">protected</span>&nbsp;String&nbsp;getExpressionAsString(Expression&nbsp;expression,&nbsp;DelegateExecution&nbsp;execution)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(expression&nbsp;==&nbsp;<span style="color: #0000FF; ">null</span>)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;<span style="color: #0000FF; ">null</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">else</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object&nbsp;value&nbsp;=&nbsp;expression.getValue(execution);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(value&nbsp;<span style="color: #0000FF; ">instanceof</span>&nbsp;String)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;(String)&nbsp;value;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">else</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">throw</span>&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;IllegalArgumentException("Expression&nbsp;does&nbsp;not&nbsp;resolve&nbsp;to&nbsp;a&nbsp;string&nbsp;or&nbsp;is&nbsp;null:&nbsp;"&nbsp;+&nbsp;expression.getExpressionText());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}</div></pre><img src ="http://www.blogjava.net/huamengxing/aggbug/432551.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2017-05-26 08:01 <a href="http://www.blogjava.net/huamengxing/archive/2017/05/26/432551.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>activiti系统表结构</title><link>http://www.blogjava.net/huamengxing/archive/2017/05/16/432532.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Tue, 16 May 2017 08:31:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2017/05/16/432532.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/432532.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2017/05/16/432532.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/432532.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/432532.html</trackback:ping><description><![CDATA[<div><h2>1、概述</h2><p>activiti系统一共有23个表，包括流程定义表、一般数据信息表、流程运行实例表、流程历史记录表、用户用户组表。</p><h2>2、Activiti 流程定义表</h2><p>流程定义表，流程定义表也可以叫做是静态资源库，静态资源包括图片、定义规则等。它有部署信息表、流程模型表、流程定义表</p><p>1、ACT_RE_DEPLOYMENT（部署信息表）</p><p>包括：部署流程名称、类型、部署时间</p><p>2、ACT_RE_MODEL（模型表）</p><p>名称,key、类型、创建时间、最后修改时间、版本、数据源信息、部署ID、编辑源值ID、编辑源额外值ID（外键ACT_GE_BYTEARRAY ）</p><p>3、ACT_RE_PROCDEF（流程定义表）&nbsp;</p><p>包括流程定义、类型、流程名称、流程key、版本号、部署ID、资源名称、图片资源名称、描述信息、是否从key启动、暂停状态。</p><h2>3、Activiti 运行实例表</h2><p>运行实例表记录流程流转过程中产生的数据，一般数据分为两个部分流程数据、业务数据。流程数据是指activiti流程引擎流转过程中的数据，包括流程执行实例数据接、任务数据、执行任务人员信息、变量信息。业务数据则是流程过程中保存的表单数据，例如：如请假的请假单数据、报销单数据、审批意见信息等，此部分数据一般需要自己建数据表进行保存，在之前的jbpm4中没有保存业务数据。</p><p>1、ACT_RU_EVENT_SUBSCR（事件子脚本）作用未知</p><p>事件名称（EVENT_NAME_）、事件类型(EVENT_TYPE_)、流程执行ID(EXECUTION_ID_)、流程实例ID(PROC_INST_ID_)、活动ID(ACTIVITY_ID_)、配置信息(CONFIGURATION_)、创建时间（CREATED_）</p><p>2、ACT_RU_EXECUTION（执行中流程执行）核心我的代办任务查询表</p><p>流程实例ID（PROC_INST_ID_），业务key（BUSINESS_KEY_）、父执行流程（PARENT_ID_）、流程定义Id（外键PROC_DEF_ID_）、实例id（ACT_ID_）、激活状态（IS_ACTIVE_）、并发状态（is_concurrent）、is_scope、is_evnet_scope、暂停状态（suspension_state）、缓存结束状态（cached_end_state）</p><p>3、ACT_RU_IDENTITYLINK（身份联系）</p><p>用户组ＩＤ（GROUP_ID_）、用户组类型(TYPE_)、用户ID(USER_ID_)、任务Id（外键：TASK_ID_）、流程实例ID（外键：PROC_INST_ID_）、流程定义Id（外键:PROC_DEF_ID_）</p><p>4、ACT_RU_JOB(运行中的任务)</p><p>5、ACT_RU_TASK（执行中实时任务）代办任务查询表</p><p>实例id（外键EXECUTION_ID_）、流程实例ID（外键PROC_INST_ID_）、流程定义ID（PROC_DEF_ID_）、任务名称（NAME_）、父节任务ID（PARENT_TASK_ID_）</p><p>、任务描述（DESCRIPTION_）、任务定义key（TASK_DEF_KEY_）、所属人（OWNER_）、代理人员 (ASSIGNEE_)、代理团（DELEGATION_）、优先权（PRIORITY_）、创建时间（CREATE_TIME_）、执行时间（DUE_DATE_）、暂停状态（SUSPENSION_STATE_）</p><p>6、ACT_RU_VARIABLE（实时变量）</p><p>变量名称（NAME_）、编码类型(TYPE_)、执行实例ID(EXECUTION_ID_)、流程实例Id(PROC_INST_ID_)、任务id(TASK_ID_)、字节组ID（BYTEARRAY_ID_）、DOUBLE_、LONG_、TEXT_、TEXT2_</p><h2>3、流程历史记录</h2><p>流程历史信息表，activiti历史记录表包括节点信息表、附件信息表、历史审批记录表、理想详细信息表、历史身份信息表、流程实例历史表、任务历史表、历史变量表。（节点信息表、附件信息表、历史审批记录表、理想详细信息表、历史身份信息表）这些表目前还未知是如何用的。（流程实例历史表、任务历史表、历史变量）三个表可以查询我已完成任务、任务追踪等。</p><p>1、ACT_HI_ACTINST（活动实例信息）</p><p>流程定义ID（PROC_DEF_ID_）、流程实例ID（PROC_INST_ID_）、流程执行ID（EXECUTION_ID_）、活动ID（ACT_ID_）、活动名称（TASK_ID_）、活动类型（ACT_TYPE_）、任务ID、（TASK_ID_）、请求流程实例ID（CALL_PROC_INST_ID_）、代理人员（ASSIGNEE_）、开始时间（START_TIME_）、结束时间(END_TIME_)、时长（DURATION_）</p><p>2、ACT_HI_ATTACHMENT（附件信息）</p><p>用户id（USER_ID_）、名称（NAME_）、描述（DESCRIPTION_）、类型（TYPE_）、任务Id（TASK_ID_）、流程实例ID（PROC_INST_ID_）、连接（URL_）、内容Id（CONTENT_ID_）</p><p>3、ACT_HI_COMMENT（历史审批信息）</p><p>类型（TYPE_）、时间（TIME_）、用户Id（USER_ID_）、任务Id（TASK_ID_）、流程实例Id（PROC_INST_ID_）、活动（ACTION_）、消息（MESSAGE_）、全部消息（FULL_MSG_）</p><p>4、ACT_HI_DETAIL（历史详细信息）</p><p>数据类型（TYPE_）、创建时间(TIME_)、名称(NAME_)、流程实例ID（PROC_INST_ID_）、执行实例Id(EXECUTION_ID_)、任务Id(TASK_ID_)、活动实例Id(ACT_INST_ID_)、变量类型(VAR_TYPE_)、字节数组Id、DOUBLE_、LONG_、值（TEXT_）、值2（TEXT2_）</p><p>5、ACT_HI_IDENTITYLINK（历史身份信息）</p><p>任务Id（TASK_ID_）、流程实例Id（PROC_INST_ID_）、userId（USER_ID_）、用户组类型Type（TYPE_）、用户组ID（GROUP_ID_）</p><p>6、ACT_HI_PROCINST（历史流程实例信息）核心表</p><p>流程实例ID（PROC_INST_ID_）、业务Key（BUSINESS_KEY_）、流程定义Id（PROC_DEF_ID_）、开始时间（START_TIME_）、结束时间（END_TIME_）、时长（DURATION_）、发起人员Id（START_USER_ID_）、开始节点（START_ACT_ID_）、结束节点（END_ACT_ID_）、超级流程实例Id（SUPER_PROCESS_INSTANCE_ID_）、删除理由（DELETE_REASON_）</p><p>7、ACT_HI_TASKINST（历史任务流程实例信息）核心表</p><p>流程实例ID（PROC_INST_ID_）、任务定义Key（BUSINESS_KEY_）、流程定义Id（PROC_DEF_ID_）、执行ID（EXECUTION_ID_）、名称（NAME_）、父任务iD（PARENT_TASK_ID_）、描述（DESCRIPTION_）、所属人（OWNER_）、代理人（ASSIGNEE_）、开始时间（START_TIME_）、结束时间（END_TIME_）、时长（DURATION_）、删除理由（DELETE_REASON__）、优先级（PRIORITY_）、应完成时间（DUE_DATE_）、表单key（FORM_KEY_）</p><p>8、ACT_HI_VARINST（历史变量信息）</p><p>流程实例ID（PROC_INST_ID_）、执行ID（EXECUTION_ID_）、任务Id、名称（NAME_）、变量（TASK_ID_）、类型（VAR_TYPE_）、字节数组ID（BYTEARRAY_ID_）、DOUBLE_、LONG_、TEXT_、TEXT2_</p><h2>4、一般数据</h2><p>1、ACT_GE_BYTEARRAY（字节数据表）</p><p>名称（NAME_）、部署Id（DEPLOYMENT_ID_）、字节数据（BYTES_）、发生的（GENERATED_）</p><p>2、ACT_GE_PROPERTY（一般属性表）</p><p>名称（NAMe_）、值(VALUe_)</p><h2>5、用户用户组表</h2><p>Activit 的用户用户组表，包括用户信息、用户组信息、用户与用户组间的关系、用户信息与用户之间的关系。在实际开发中未采用，用的实际系统中用户。</p><p>1、ACT_ID_GROUP（用户组表）</p><p>名称（NAME_）、类型(TYPE_)</p><p>2、ACT_ID_USER（用户表）</p><p>姓(FIRST_)、名称(LAST_)、邮件(EMAIL_)、密码(PWD_)、头像Id (PICTURE_ID_)</p><p>3、ACT_ID_INFO（用户信息表）</p><p>用户Id(USER_ID_)、类型(TYPE_)、formINPut名称(KEY_)、值(VALUE_)、密码(PASSWORD_)、父节点(PARENT_ID_)</p><p>4、ACT_ID_MEMBERSHIP（用户用户组关联表）</p><p>用户Id(user_ID_)、用户组Id（group_Id）</p><p>Activiti表结构分析完成，花了5个小时，还有很多问题不明白。后续慢慢开发过程中再理一次表之间关系吧，初步想法在系统中需要扩建表，把业务数据和流程数据分开。</p></div><img src ="http://www.blogjava.net/huamengxing/aggbug/432532.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2017-05-16 16:31 <a href="http://www.blogjava.net/huamengxing/archive/2017/05/16/432532.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti工作流引擎数据库表结构</title><link>http://www.blogjava.net/huamengxing/archive/2017/05/15/432529.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Mon, 15 May 2017 14:23:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2017/05/15/432529.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/432529.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2017/05/15/432529.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/432529.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/432529.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Activiti工作流引擎数据库表结构数据库表的命名Acitiviti数据库中表的命名都是以ACT_开头的。第二部分是一个两个字符用例表的标识。此用例大体与服务API是匹配的。l&nbsp; ACT_RE_*:&#8217;RE&#8217;表示repository。带此前缀的表包含的是静态信息，如，流程定义，流程的资源（图片，规则等）。l&nbsp; ACT_RU_*:&#821...&nbsp;&nbsp;<a href='http://www.blogjava.net/huamengxing/archive/2017/05/15/432529.html'>阅读全文</a><img src ="http://www.blogjava.net/huamengxing/aggbug/432529.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2017-05-15 22:23 <a href="http://www.blogjava.net/huamengxing/archive/2017/05/15/432529.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jpa 字段不要映射</title><link>http://www.blogjava.net/huamengxing/archive/2017/05/10/432515.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Wed, 10 May 2017 08:59:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2017/05/10/432515.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/432515.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2017/05/10/432515.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/432515.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/432515.html</trackback:ping><description><![CDATA[ @Transient 
可选 
@Transient表示该属性并非一个到数据库表的字段的映射,ORM框架将忽略该属性. 
如果一个属性并非数据库表的字段映射,就务必将其标示为@Transient,否则,ORM框架默认其注解为@Basic 
示例: 
//根据birth计算出age属性 
@Transient 
public int getAge() { 
return getYear(new Date()) - getYear(birth); 

} 

注意是加在get方法上的
<img src ="http://www.blogjava.net/huamengxing/aggbug/432515.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2017-05-10 16:59 <a href="http://www.blogjava.net/huamengxing/archive/2017/05/10/432515.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SNMP 相关</title><link>http://www.blogjava.net/huamengxing/archive/2017/03/22/432395.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Wed, 22 Mar 2017 07:28:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2017/03/22/432395.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/432395.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2017/03/22/432395.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/432395.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/432395.html</trackback:ping><description><![CDATA[<div>Snmpwalk &#8211;v 2 &#8211;c public 192.168.20.114 1.3.6.1.2.1.2.2.1.3</div><div></div><div></div><div></div><div></div><div>snmpget -r:127.0.0.1 -o:.1.3.6.1.2.1.25.3.3.1.2</div><div></div><div></div><div></div><div>E:\&gt;snmpget -r:127.0.0.1 -o:.1.3.6.1.2.1.1.1.0</div><div>SnmpGet v1.01 - Copyright (C) 2009 SnmpSoft Company</div><div>[ More useful network tools on http://www.snmpsoft.com ]</div><div></div><div>OID=.1.3.6.1.2.1.1.1.0</div><div>Type=OctetString</div><div>Value=Hardware: Intel64 Family 6 Model 60 Stepping 3 AT/AT COMPATIBLE - Software</div><div>: Windows Version 6.1 (Build 7601 Multiprocessor Free)</div><div></div><div></div><div></div><div>snmpwalk -v:2c -c:public -r:127.0.0.1</div><img src ="http://www.blogjava.net/huamengxing/aggbug/432395.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2017-03-22 15:28 <a href="http://www.blogjava.net/huamengxing/archive/2017/03/22/432395.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Druid 介绍</title><link>http://www.blogjava.net/huamengxing/archive/2017/03/21/432392.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Mon, 20 Mar 2017 16:11:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2017/03/21/432392.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/432392.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2017/03/21/432392.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/432392.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/432392.html</trackback:ping><description><![CDATA[<p>Druid是什么？ </p>
<p style="font-size: 10pt; font-weight: normal; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 10px 0px; line-height: 13pt; padding-right: 0px">Druid是一个JDBC组件，它包括四个部分：</p><p style="font-size: 10pt; font-weight: normal; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 10px 0px; line-height: 13pt; padding-right: 0px"></p><div>http://download.csdn.net/download/feelnature/1580901<br /><div>http://tomcat.apache.org/tomcat-8.5-doc/monitoring.html#Enabling_JMX_Remote<br /><br /><div>http://download.csdn.net/detail/qq_21163257/9695557</div></div></div><div></div><p>&nbsp;</p>
<ul style="list-style-type: disc; font-size: 10pt; line-height: 13pt"><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div><u>DruidDriver</u> 代理Driver，能够提供基于Filter－Chain模式的插件体系。</div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div><u>DruidDataSource</u> 高效可管理的数据库连接池。</div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div><u>SQLParser</u></div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>扩展组件</div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div><span style="color: #333333">Binary: <u>http://code.alibabatech.com/mvn/releases/com/alibaba/druid/0.1.2/druid-0.1.2.jar</u></span></div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div><span style="color: #333333"></span><span style="color: #333333">Source: <u>http://code.alibabatech.com/mvn/releases/com/alibaba/druid/0.1.2/druid-0.1.2-sources.jar</u></span></div></li></ul>
<h3 style="font-size: 1.4em; font-weight: bold; color: #000000; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 1.5em 0px 0.5em; line-height: normal; padding-right: 0px"><u></u><u></u><u></u>Druid可以做什么？</h3>
<ul style="list-style-type: disc; font-size: 10pt; line-height: 13pt"><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>可以监控数据库访问性能，Druid内置提供了一个功能强大的<u>StatFilter</u>插件，能够详细统计SQL的执行性能，这对于线上分析数据库访问性能有帮助。</div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>替换DBCP和C3P0。Druid提供了一个高效、功能强大、可扩展性好的数据库连接池。</div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>数据库密码加密。直接把数据库密码写在配置文件中，这是不好的行为，容易导致安全问题。DruidDruiver和DruidDataSource都支持PasswordCallback。</div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>SQL执行日志，Druid提供了不同的LogFilter，能够支持Common-Logging、Log4j和JdkLog，你可以按需要选择相应的LogFilter，监控你应用的数据库访问情况。</div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>扩展JDBC，如果你要对JDBC层有编程的需求，可以通过Druid提供的Filter机制，很方便编写JDBC层的扩展插件。</div></li></ul><span style="font-size: 16px"><span style="font-size: 13px; line-height: 17px">
<div></div></span></span><span style="font-size: 16px"><span style="font-size: 13px; line-height: 17px"><span style="font-size: 13px; font-family: Helvetica,Arial,sans-serif; color: #333333; line-height: 17px"></span></span></span>
<p style="font-size: 10pt; font-weight: normal; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 10px 0px; line-height: 13pt; padding-right: 0px">DruidDriver，是一个ProxyJdbcDriver，它提供了Filter-Chain模式的扩展机制，使得在Jdbc扩展编程特别方便。</p>
<p style="font-size: 10pt; font-weight: normal; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 10px 0px; line-height: 13pt; padding-right: 0px">Druid提供了一些内置的扩展机制，包括<u>Stat</u>、<u>Log</u>、<u>Trace</u>、HA等扩展。</p>
<p style="font-size: 10pt; font-weight: normal; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 10px 0px; line-height: 13pt; padding-right: 0px"><br /></p>
<p style="font-size: 10pt; font-weight: normal; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 10px 0px; line-height: 13pt; padding-right: 0px"><span style="font-size: 13px; font-family: Helvetica,Arial,sans-serif; color: #333333; line-height: 17px"></span></p>
<p style="font-size: 10pt; font-weight: normal; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 10px 0px; line-height: 13pt; padding-right: 0px">DruidDataSource是一个数据库连接池的实现，它的设计目标是提供一个当前最好的数据库连接池，在性能、扩展性等方面取得最合适的平衡，取代DBCP、C3P0等连接池。</p>
<ul style="list-style-type: disc; font-size: 10pt; line-height: 13pt"><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>高性能。测试数据表明，Druid比DBCP、C3P0、BoneCP的性能都好很多。具体请看<u>测试数据</u></div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>可管理性，DruidDataSource本身提供了很多监控属性，具体看<u>这里</u>。DruidDataSource支持StatFilter，具体配置看 <u>这里</u></div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>可扩展性，提供基于Filter-Chain模式的扩展机制。具体自定义扩展的例子看<u>这里</u>。</div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>替换DBCP，配置和DBCP兼容，可以方便替换DBCP。</div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>适合大规模应用。结合Alibaba使用数据库连接池的经验，避免一些已知问题，例如数据库不可用恢复之后产生的连接风暴问题等。</div></li></ul>
<h3 style="font-size: 1.4em; font-weight: bold; color: #000000; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 1.5em 0px 0.5em; line-height: normal; padding-right: 0px"><u></u><u></u><u></u>设计</h3>
<p style="font-size: 10pt; font-weight: normal; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 10px 0px; line-height: 13pt; padding-right: 0px">这是DruidDataSource的设计图示： <br class="atl-forced-newline" /><u>http://code.alibabatech.com/svn/druid/trunk/doc/druid-pool.txt</u> <br class="atl-forced-newline" />如果发现有乱码，请选择utf-8的编码方式查看。</p>
<div></div>
<p style="font-size: 10pt; font-weight: normal; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 10px 0px; line-height: 13pt; padding-right: 0px"><span style="font-size: 13px; font-family: Helvetica,Arial,sans-serif; color: #333333; line-height: 17px"></span></p>
<p style="font-size: 10pt; font-weight: normal; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 10px 0px; line-height: 13pt; padding-right: 0px">Druid提供一个手工编写的高性能的方便扩展的SQL Parser。将会支持MySQL、Oracle等流行关系数据库的SQL Parser。</p>
<p style="font-size: 10pt; font-weight: normal; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 10px 0px; line-height: 13pt; padding-right: 0px">Parser组件包括如下几个部分：</p>
<ul style="list-style-type: disc; font-size: 10pt; line-height: 13pt"><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>Lexer 词法解析</div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>Parser，Parser包括ExprParser，各种StatementParser。</div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>AST, Abstract Syntax Tree。ParserParse出来的结果就是AST。</div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>Visitor。对AST做各种处理，比如FormatOutput，遍历等等。</div></li></ul>
<div></div>
<p style="font-size: 10pt; font-weight: normal; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 10px 0px; line-height: 13pt; padding-right: 0px"><span style="font-size: 13px; font-family: Helvetica,Arial,sans-serif; color: #333333; line-height: 17px"></span></p>
<h3 style="font-size: 1.4em; font-weight: bold; color: #000000; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 1.5em 0px 0.5em; line-height: normal; padding-right: 0px"><u></u><u></u>简介</h3>
<p>&nbsp;</p>
<p style="font-size: 10pt; font-weight: normal; color: #333333; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 10px 0px; line-height: 13pt; padding-right: 0px">Druid提供了强大的监控功能，能够监控连接池行为和SQL执行情况，让你能够详细了解应用的数据库访问行为。</p>
<h3 style="font-size: 1.4em; font-weight: bold; color: #000000; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 1.5em 0px 0.5em; line-height: normal; padding-right: 0px"><u></u><u></u><u></u>监控对象</h3>
<ul style="list-style-type: disc; font-size: 10pt; line-height: 13pt"><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>Druid的统计信息定义代码实现在com/alibaba/druid/stat下。所有的Stat都全局静态变量的方式保存，这样做使得外部获取监控信息更容易。</div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>获取Druid监控信息的入口是com.alibaba.druid.stat.JdbcStatManager</div></li><li style="font-size: 10pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; line-height: 13pt; padding-right: 0px">
<div>Druid的监控统计信息都是通过StatFilter来实现的，如果你需要数据源进行监控，那你需要启用StatFilter</div></li></ul><span style="font-size: 13px; font-family: Helvetica,Arial,sans-serif; color: #333333; line-height: 17px"></span>
<div class="wiki-content" style="font-size: 10pt; line-height: 13pt">&nbsp;</div><img src ="http://www.blogjava.net/huamengxing/aggbug/432392.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2017-03-21 00:11 <a href="http://www.blogjava.net/huamengxing/archive/2017/03/21/432392.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>spring 相关网站介绍</title><link>http://www.blogjava.net/huamengxing/archive/2017/03/19/432385.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Sun, 19 Mar 2017 14:39:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2017/03/19/432385.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/432385.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2017/03/19/432385.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/432385.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/432385.html</trackback:ping><description><![CDATA[http://repo.spring.io/release/org/springframework/spring/4.3.6.RELEASE/
<br />

http://spring.io/tools/sts

http://www.loveweir.com/posts/view/19 <br /> 
https://github.com/rahulyewale/springmvcjpa 
<br />http://download.csdn.net/download/jiuqiyuliang/8640621 <br />

http://blog.csdn.net/suzunshou/article/details/49949005
<br />https://repo1.maven.org/maven2/org/mybatis/mybatis/ <br />

http://blog.csdn.net/jiuqiyuliang/article/details/45132493/ <br />

https://github.com/mybatis/generator/releases<img src ="http://www.blogjava.net/huamengxing/aggbug/432385.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2017-03-19 22:39 <a href="http://www.blogjava.net/huamengxing/archive/2017/03/19/432385.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>mysql导入乱码</title><link>http://www.blogjava.net/huamengxing/archive/2016/07/21/431269.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Thu, 21 Jul 2016 05:33:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2016/07/21/431269.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/431269.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2016/07/21/431269.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/431269.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/431269.html</trackback:ping><description><![CDATA[<div>今天从windows上导出一个sql执行文件，再倒入到unbutn中，结果出现乱码，折腾7-8分钟，&nbsp;</div><div>解决方式&nbsp;</div><div>在导出mysql sql执行文件的时候，指定一下编码格式：&nbsp;</div><div></div><div>复制代码 代码如下:</div><div></div><div></div><div>mysqldump -uroot -p --default-character-set=utf8 mo（dbname） &gt; E://xxxx.sql&nbsp;</div><div></div><div></div><div>导入的时候OK了&nbsp;</div><div>执行如下&nbsp;</div><div></div><div>复制代码 代码如下:</div><div></div><div></div><div>mysql -u root -p --default-character-set=utf8&nbsp;</div><div>use dbname&nbsp;</div><div>source /root/newsdata.sql&nbsp;</div><img src ="http://www.blogjava.net/huamengxing/aggbug/431269.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2016-07-21 13:33 <a href="http://www.blogjava.net/huamengxing/archive/2016/07/21/431269.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>yum 源更新</title><link>http://www.blogjava.net/huamengxing/archive/2016/06/27/431029.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Mon, 27 Jun 2016 09:42:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2016/06/27/431029.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/431029.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2016/06/27/431029.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/431029.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/431029.html</trackback:ping><description><![CDATA[<h1></h1><div></div><div>CentOS</div><div></div><div></div><div>1、备份</div><div></div><div>mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup&nbsp;</div><div></div><div>2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/</div><div></div><div></div><div></div><div>CentOS 5</div><div>&nbsp;wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo &nbsp;</div><div></div><div></div><div></div><div>CentOS 6</div><div>&nbsp;wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo &nbsp;</div><div></div><div></div><div></div><div>CentOS 7</div><div>&nbsp;wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo &nbsp;</div><div></div><div>3、之后运行yum makecache生成缓存</div><div></div><div>相关链接</div><div>##官方主页: http://www.centos.org/</div><div>##邮件列表: http://www.centos.org/modules/tinycontent/index.php?id=16</div><div>##论坛: http://www.centos.org/modules/newbb/</div><div>##文档: http://www.centos.org/docs/</div><div>##Wiki: http://wiki.centos.org/</div><div></div><div><ul><li><a href="http://wiki.centos.org/"></a></li></ul></div><img src ="http://www.blogjava.net/huamengxing/aggbug/431029.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2016-06-27 17:42 <a href="http://www.blogjava.net/huamengxing/archive/2016/06/27/431029.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>输入数据进行正态化</title><link>http://www.blogjava.net/huamengxing/archive/2016/05/11/430448.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Wed, 11 May 2016 10:27:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2016/05/11/430448.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/430448.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2016/05/11/430448.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/430448.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/430448.html</trackback:ping><description><![CDATA[<div><h3>对输入数据进行正态化</h3></div><div><p>&nbsp;</p><p>为了使神经网络有效，我们必须对数据进行正态化。这是激活函数的正确计算所需要的。正态化是一种数学处理，将数据转换为 0..1 或 -1..1 的范围。正态化后的数据可以进行去正态化，即转换回原来的范围。<br /></p></div><div>要将神经网络输出解码为人类可读的形式，需要对数据进行去正态化。谢天谢地，负责标准化和去标准化，因此不需要实施它。如果您对它的工作原理感到好奇，您可以分析以下代码： &nbsp;<br /><br /><br />public static double INPUT_LOW = -20;</div><div>&nbsp; &nbsp; public static double INPUT_HIGH = 20;</div><div>&nbsp; &nbsp; public static double OUTPUT_HIGH = 1;</div><div>&nbsp; &nbsp; public static double OUTPUT_LOW = -1;</div><div></div><div>&nbsp; &nbsp; public static double normalize(final double value) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return ((value - INPUT_LOW) / (INPUT_HIGH - INPUT_LOW))</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * (OUTPUT_HIGH - OUTPUT_LOW) + OUTPUT_LOW;</div><div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; // return ((10f + 20f) / (40f)) * (2f) + OUTPUT_LOW;</div><div>&nbsp; &nbsp; }</div><div></div><div>&nbsp; &nbsp; public static double deNormalize(final double data) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; double result = ((INPUT_LOW - INPUT_HIGH) * data - OUTPUT_HIGH</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * INPUT_LOW + INPUT_HIGH * OUTPUT_LOW)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; / (OUTPUT_LOW - OUTPUT_HIGH);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return result;</div><div>&nbsp; &nbsp; }<br /><br /><div>x=-5:.01:5;</div><div>&nbsp; &nbsp;plot(x,tanh(x)),grid on;</div></div><img src ="http://www.blogjava.net/huamengxing/aggbug/430448.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2016-05-11 18:27 <a href="http://www.blogjava.net/huamengxing/archive/2016/05/11/430448.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cron4j使用说明</title><link>http://www.blogjava.net/huamengxing/archive/2016/05/07/430392.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Sat, 07 May 2016 07:39:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2016/05/07/430392.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/430392.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2016/05/07/430392.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/430392.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/430392.html</trackback:ping><description><![CDATA[<h2>1. Quickstart</h2><p>The cron4j main entity is the <strong><em>scheduler</em></strong>. With a <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html"><em>it.sauronsoftware.cron4j.Scheduler</em></a> instance you can execute <em>tasks</em> at fixed moments, during all the year. A scheduler can execute a task once a minute, once every five minutes, Friday at 10:00, on February the 16th at 12:30 but only if it is Saturday, and so on.</p><p>The use of the cron4j scheduler is a four steps operation:</p><ol><li>Create your <em>Scheduler</em> instance.</li><li>Schedule your actions. To schedule an action you have to tell	the scheduler <em>what</em> it has to do and <em>when</em>. You can	specify <em>what</em> using a <em>java.lang.Runnable</em> or a <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Task.html"><em>it.sauronsoftware.cron4j.Task</em></a>	instance, and you can specify <em>when</em> using a scheduling pattern,	which can be represented with a string or with a <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/SchedulingPattern.html"><em>it.sauronsoftware.cron4j.SchedulingPattern</em></a>	instance.</li><li>Starts the scheduler.</li><li>Stops the scheduler, when you don't need it anymore.</li></ol><p>Consider this simple example:</p><pre>import it.sauronsoftware.cron4j.Scheduler;  public class Quickstart {  	public static void main(String[] args) { 		// Creates a Scheduler instance. 		Scheduler s = new Scheduler(); 		// Schedule a once-a-minute task. 		s.schedule("* * * * *", new Runnable() { 			public void run() { 				System.out.println("Another minute ticked away..."); 			} 		}); 		// Starts the scheduler. 		s.start(); 		// Will run for ten minutes. 		try { 			Thread.sleep(1000L * 60L * 10L); 		} catch (InterruptedException e) { 			; 		} 		// Stops the scheduler. 		s.stop(); 	}  }</pre><p>This example runs for ten minutes. At every minute change it will print the sad (but true) message "Another minute ticked away...".</p><p>Some other key concepts:</p><ul><li>You can schedule how many tasks you want.</li><li>You can schedule a task when you want, also after the	scheduler has been started.</li><li>You can change the scheduling pattern of an already scheduled	task, also while the scheduler is running (<em>reschedule</em>	operation).</li><li>You can remove a previously scheduled task, also while the	scheduler is running (<em>deschedule</em> operation).</li><li>You can start and stop a scheduler how many times you want.</li><li>You can schedule from a file.</li><li>You can schedule from any source you want.</li><li>You can supply listeners to the scheduler in order to receive	events about the executed task.</li><li>You can control any ongoing task.</li><li>You can manually launch a task, without using a scheduling	pattern.</li><li>You can change the scheduler working Time Zone.</li><li>You can validate your scheduling patterns before using them	with the scheduler.</li><li>You can predict when a scheduling pattern will cause a task	execution.</li></ul><p><a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#pIndex">Back to index</a></p><a name="p02" id="p02" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(&quot;/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif&quot;); background-repeat: no-repeat;"></a> <h2>2. Scheduling patterns</h2><p>A UNIX crontab-like pattern is a string split in five space separated parts. Each part is intended as:</p><ol><li><strong>Minutes sub-pattern</strong>. During which minutes of	the hour should the task been launched? The values range is from 0 to	59.</li><li><strong>Hours sub-pattern</strong>. During which hours of the	day should the task been launched? The values range is from 0 to 23.</li><li><strong>Days of month sub-pattern</strong>. During which days	of the month should the task been launched? The values range is from 1	to 31. The special value "L" can be used to recognize the	last day of month.</li><li><strong>Months sub-pattern</strong>. During which months of	the year should the task been launched? The values range is from 1	(January) to 12 (December), otherwise this sub-pattern allows the	aliases "jan", "feb", "mar",	"apr", "may", "jun", "jul",	"aug", "sep", "oct", "nov" and	"dec".</li><li><strong>Days of week sub-pattern</strong>. During which days	of the week should the task been launched? The values range is from 0	(Sunday) to 6 (Saturday), otherwise this sub-pattern allows the aliases	"sun", "mon", "tue", "wed",	"thu", "fri" and "sat".</li></ol><p>The star wildcard character is also admitted, indicating "every minute of the hour", "every hour of the day", "every day of the month", "every month of the year" and "every day of the week", according to the sub-pattern in which it is used.</p><p>Once the scheduler is started, a task will be launched when the five parts in its scheduling pattern will be true at the same time.</p><p>Scheduling patterns can be represented with <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/SchedulingPattern.html"><em>it.sauronsoftware.cron4j.SchedulingPattern</em></a> instances. Invalid scheduling patterns are cause of <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/InvalidPatternException.html"><em>it.sauronsoftware.cron4j.InvalidPatternException</em></a>s. The <em>SchedulingPattern</em> class offers also a static <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/SchedulingPattern.html#validate(java.lang.String)"><em>validate(String)</em></a> method, that can be used to validate a string before using it as a scheduling pattern.</p><p>Some examples:</p><p><strong>5 * * * *</strong><br /> This pattern causes a task to be launched once every hour, at the begin of the fifth minute (00:05, 01:05, 02:05 etc.).</p><p><strong>* * * * *</strong><br /> This pattern causes a task to be launched every minute.</p><p><strong>* 12 * * Mon</strong><br /> This pattern causes a task to be launched every minute during the 12th hour of Monday.</p><p><strong>* 12 16 * Mon</strong><br /> This pattern causes a task to be launched every minute during the 12th hour of Monday, 16th, but only if the day is the 16th of the month.</p><p>Every sub-pattern can contain two or more comma separated values.</p><p><strong>59 11 * * 1,2,3,4,5</strong><br /> This pattern causes a task to be launched at 11:59AM on Monday, Tuesday, Wednesday, Thursday and Friday.</p><p>Values intervals are admitted and defined using the minus character.</p><p><strong>59 11 * * 1-5</strong><br /> This pattern is equivalent to the previous one.</p><p>The slash character can be used to identify step values within a range. It can be used both in the form <em>*/c</em> and <em>a-b/c</em>. The subpattern is matched every <em>c</em> values of the range <em>0,maxvalue</em> or  <em>a-b</em>.</p><p><strong>*/5 * * * *</strong><br /> This pattern causes a task to be launched every 5 minutes (0:00, 0:05, 0:10, 0:15 and so on).</p><p><strong>3-18/5 * * * *</strong><br /> This pattern causes a task to be launched every 5 minutes starting from the third minute of the hour, up to the 18th (0:03, 0:08, 0:13, 0:18, 1:03, 1:08 and so on).</p><p><strong>*/15 9-17 * * *</strong><br /> This pattern causes a task to be launched every 15 minutes between the 9th and 17th hour of the day (9:00, 9:15, 9:30, 9:45 and so on... note that the last execution will be at 17:45).</p><p>All the fresh described syntax rules can be used together.</p><p><strong>* 12 10-16/2 * *</strong><br /> This pattern causes a task to be launched every minute during the 12th hour of the day, but only if the day is the 10th, the 12th, the 14th or the 16th of the month.</p><p><strong>* 12 1-15,17,20-25 * *</strong><br /> This pattern causes a task to be launched every minute during the 12th hour of the day, but the day of the month must be between the 1st and the 15th, the 20th and the 25, or at least it must be the 17th.</p><p>Finally cron4j lets you combine more scheduling patterns into one, with the pipe character:</p><p><strong>0 5 * * *|8 10 * * *|22 17 * * *</strong><br /> This pattern causes a task to be launched every day at 05:00, 10:08 and 17:22.</p><p><a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#pIndex">Back to index</a></p><a name="p03" id="p03" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(&quot;/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif&quot;); background-repeat: no-repeat;"></a> <h2>3. How to schedule, reschedule and deschedule a task</h2><p>The simplest manner to build a task is to implement the well-known <em>java.lang.Runnable</em> interface. Once the task is ready, it can be scheduled with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html"><em>it.sauronsoftware.cron4j.Scheduler</em></a>.<a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#schedule(java.lang.String,%20java.lang.Runnable)"><em>schedule(String, Runnable)</em></a> method. This method throws an <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/InvalidPatternException.html"><em>it.sauronsoftware.cron4j.InvalidPatternException</em></a> when the supplied string does not represent a valid scheduling pattern.</p><p>Another way to build a task is to extend the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Task.html"><em>it.sauronsoftware.cron4j.Task</em></a> abstract class, which is more powerful and let the developer access some other cron4j features. This is better discussed in the "<a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#p06">Building your own task</a>" paragraph. <em>Task</em> instances can be scheduled with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#schedule(java.lang.String,%20it.sauronsoftware.cron4j.Task)"><em>schedule(String, Task)</em></a> and the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#schedule(it.sauronsoftware.cron4j.SchedulingPattern,%20it.sauronsoftware.cron4j.Task)"><em>schedule(SchedulingPattern, Task)</em></a> methods.</p><p>Scheduling methods available in the scheduler always return an ID used to recognize and retrieve the scheduled operation. This ID can be used later to reschedule the task (changing its scheduling pattern) with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#reschedule(java.lang.String,%20java.lang.String)"><em>reschedule(String, String)</em></a> or the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#reschedule(java.lang.String,%20it.sauronsoftware.cron4j.SchedulingPattern)"><em>reschedule(String, SchedulingPattern)</em></a> methods, and to deschedule the task (remove the task from the scheduler) with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#deschedule(java.lang.String)"><em>deschedule(String)</em></a> method.</p><p>The same ID can also be used to retrieve the scheduling pattern associated with a scheduled task, with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#getSchedulingPattern(java.lang.String)"><em>getSchedulingPattern(String)</em></a> method, or to retrieve the task itself, with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#getTask(java.lang.String)"><em>getTask(String)</em></a> method.</p><p><a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#pIndex">Back to index</a></p><a name="p04" id="p04" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(&quot;/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif&quot;); background-repeat: no-repeat;"></a> <h2>4. How to schedule a system process</h2><p>System processes can be easily scheduled using the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/ProcessTask.html">ProcessTask</a> class:</p><pre>ProcessTask task = new ProcessTask("C:\\Windows\\System32\\notepad.exe"); Scheduler scheduler = new Scheduler(); scheduler.schedule("* * * * *", task); scheduler.start(); // ... </pre><p>Arguments for the process can be supplied by using a string array instead of a single command string:</p><pre>String[] command = { "C:\\Windows\\System32\\notepad.exe", "C:\\File.txt" }; ProcessTask task = new ProcessTask(command); // ...</pre><p>Environment variables for the process can be supplied using a second string array, whose elements have to be in the <em>NAME=VALUE</em> form:</p><pre>String[] command = { "C:\\tomcat\\bin\\catalina.bat", "start" }; String[] envs = { "CATALINA_HOME=C:\\tomcat", "JAVA_HOME=C:\\jdks\\jdk5" }; ProcessTask task = new ProcessTask(command, envs); // ...</pre><p>The default working directory for the process can be changed using a third parameter in the constructor:</p><pre>String[] command = { "C:\\tomcat\\bin\\catalina.bat", "start" }; String[] envs = { "CATALINA_HOME=C:\\tomcat", "JAVA_HOME=C:\\jdks\\jdk5" }; File directory = "C:\\MyDirectory"; ProcessTask task = new ProcessTask(command, envs, directory); // ...</pre><p>If you want to change the default working directory but you have not any environment variable, the <em>envs</em> parameter of the constructor can be set to <em>null</em>:</p><pre>ProcessTask task = new ProcessTask(command, null, directory);</pre><p>When <em>envs</em> is <em>null</em> the process inherits every environment variable of the current JVM:</p><p>Environment variables and the working directory can also be set by calling the <em><a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/ProcessTask.html#setEnvs(java.lang.String[])">setEnvs(String[])</a></em> and <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/ProcessTask.html#setDirectory(java.io.File)"><em>setDirectory(java.io.File)</em></a> methods.</p><p>The process standard output and standard error channels can be redirected to files by using the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/ProcessTask.html#setStdoutFile(java.io.File)"><em>setStdoutFile(java.io.File)</em></a> and <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/ProcessTask.html#setStderrFile(java.io.File)"><em>setStderrFile(java.io.File)</em></a> methods:</p><pre>ProcessTask task = new ProcessTask(command, envs, directory); task.setStdoutFile(new File("out.txt")); task.setStderrFile(new File("err.txt"));</pre><p>In a siminal manner, the standard input channel can be read from an existing file, calling the <em><a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/ProcessTask.html#setStdinFile(java.io.File)">setStdinFile(java.io.File)</a></em> method:</p><pre>ProcessTask task = new ProcessTask(command, envs, directory); task.setStdinFile(new File("in.txt"));</pre><a name="p05" id="p05" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(&quot;/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif&quot;); background-repeat: no-repeat;"></a> <h2>5. How to schedule processes from a file</h2><p>The cron4j scheduler can also schedule a set of processes from a file.</p><p>You have to prepare a file, very similar to the ones used by the UNIX crontab, and register it in the scheduler calling the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#scheduleFile(java.io.File)"><em>scheduleFile(File)</em></a> method. The file can be descheduled by calling the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#descheduleFile(java.io.File)"><em>descheduleFile(File)</em></a> method. Scheduled files can be retrieved by calling the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#getScheduledFiles()"><em>getScheduledFiles()</em></a> method.</p><p>Scheduled files are parsed every minute. The scheduler will launch every process declared in the file whose scheduling pattern matches the current system time.</p><p>Syntax rules for cron4j scheduling files are reported in the "<a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#p13">Cron parser</a>" paragraph.</p><p><a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#pIndex">Back to index</a></p><a name="p06" id="p06" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(&quot;/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif&quot;); background-repeat: no-repeat;"></a> <h2>6. Building your own task</h2><p>A <em>java.lang.Runnable</em> object is the simplest task ever possible, but to gain control you need to extend the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Task.html"><em>it.sauronsoftware.cron4j.Task</em></a> class. In the plainest form, implementing <em>Runnable</em> or extending <em>Task</em> are very similar operations: while the first requires a <em>run()</em> method, the latter requires the implementation of <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Task.html#execute(it.sauronsoftware.cron4j.TaskExecutionContext)"><em>execute(TaskExecutionContext)</em></a>. The <em>execute(TaskExecutionContext)</em> method provides a <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutionContext.html"><em>it.sauronsoftware.cron4j.TaskExecutionContext</em></a> instance, which the <em>Runnable.run()</em> method does not provide. The context can be used in the following ways:</p><ul><li><p>A task can communicate with its executor, by notifying its	internal state with a textual description. This is called <em>status	tracking</em>. If you are interested in supporting status tracking in your	task, you have to override the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Task.html#supportsStatusTracking()"><em>supportsStatusTracking()</em></a>	method, which should return <em>true</em>. Once this has been done,	within the <em>execute(TaskExecutionContext)</em> method you are	enabled to call the context <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutionContext.html#setStatusMessage(java.lang.String)"><em>setStatusMessage(String)</em></a>	method. This will propagate your task status message to its executor.	The status message, through the executor, can be retrieved by an	external user (see the "<a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#p09">Executors</a>"	paragraph).</p></li><li><p>A task can communicate with its executor, by notifying its	completeness level with a numeric value. This is called <em>completeness	tracking</em>. If you are interested in supporting completeness tracking in	your task, you have to override the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Task.html#supportsCompletenessTracking()"><em>supportsCompletenessTracking()</em></a>	method, which should return <em>true</em>. Once this has been done,	within the <em>execute(TaskExecutionContext)</em> method you are	enabled to call the context <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutionContext.html#setCompleteness(double)"><em>setCompleteness(double)</em></a>	method, with a value between 0 and 1. This will propagate your task	completeness level to its executor. The completeness level, through the	executor, can be retrieved by an external user (see the "<a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#p09">Executors</a>" paragraph).</p></li><li><p>A task can be optionally paused. If you are interested in	supporting pausing and resuming in your task, you have to override the	 <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Task.html#canBePaused()"><em>canBePaused()</em></a>	method, which should return <em>true</em>. Once this has been done,	within the <em>execute(TaskExecutionContext)</em> method you have to	periodically call the context <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutionContext.html#pauseIfRequested()"><em>pauseIfRequested()</em></a>	method. This will pause the task execution until it will be resumed (or	stopped) by an external user (see the "<a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#p09">Executors</a>"	paragraph).</p></li><li><p>A task can be optionally stopped. If you are interested in	supporting stopping in your task, you have to override the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Task.html#canBeStopped()"><em>canBeStopped()</em></a>	method, which should return <em>true</em>. Once this has been done,	within the <em>execute(TaskExecutionContext)</em> method you have to	periodically call the context <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutionContext.html#isStopped()"><em>isStopped()</em></a>	method. This will return <em>true</em> when the execution has be	demanded to be stopped by an external user (see the "<a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#p09">Executors</a>" paragraph). Then it's your	responsibility to handle the event, by letting your task gently stop	its ongoing activities.</p></li><li><p>Through the context, the task can retrieve the scheduler,	calling <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutionContext.html#getScheduler()"><em>getScheduler()</em></a>.</p></li><li><p>Through the context, the task can retrieve its executor, calling	 <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutionContext.html#getTaskExecutor()"><em>getTaskExecutor()</em></a>.</p></li></ul><p>A custom task can be <a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#p03">scheduled</a>, <a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#p10">launched immediately</a> or returned by a <a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#p07">task collector</a>.</p><p><a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#pIndex">Back to index</a></p><a name="p07" id="p07" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(&quot;/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif&quot;); background-repeat: no-repeat;"></a> <h2>7. Building your own collector</h2><p>You can build and plug within the scheduler your own task source, via the <em>task collector</em> API.</p><p>The cron4j scheduler supports the registration of one or more <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskCollector.html"><em>it.sauronsoftware.cron4j.TaskCollector</em></a> instances, with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#addTaskCollector(it.sauronsoftware.cron4j.TaskCollector)"><em>addTaskCollector(TaskCollector)</em></a> method. Registered collectors can be retrieved with the scheduler <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#getTaskCollectors()"><em>getTaskCollectors()</em></a> method. A previously registered collector can be removed from the scheduler with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#removeTaskCollector(it.sauronsoftware.cron4j.TaskCollector)"><em>removeTaskCollector(TaskCollector)</em></a> method. Collectors can be added, queried or removed at every moment, also when the scheduler is started and it is running.</p><p>Each registered task collector is queried by the scheduler once a minute. The scheduler calls the collector <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskCollector.html#getTasks()"><em>getTasks()</em></a> method. The implementation must return a <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskTable.html"><em>it.sauronsoftware.cron4j.TaskTable</em></a> instance. A <em>TaskTable</em> is a table that associates tasks and scheduling patterns. The scheduler, once the table has been retrieved, will examine the reported entries, and it will execute every task whose scheduling pattern matches the current system time.</p><p>A custom collector can be used to tie the scheduler with an external task source, i.e. a database or a XML file, which can be managed and changed in its contents also at run time.</p><p><a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#pIndex">Back to index</a></p><a name="p08" id="p08" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(&quot;/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif&quot;); background-repeat: no-repeat;"></a> <h2>8. Building your own scheduler listener</h2><p>The <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/SchedulerListener.html"><em>it.sauronsoftware.cron4j.SchedulerListener</em></a> API can be used to listen to scheduler events.</p><p>The <em>SchedulerListener</em> interface requires the implementation of the following methods:</p><ul><li><p><a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/SchedulerListener.html#taskLaunching(it.sauronsoftware.cron4j.TaskExecutor)"><em>taskLaunching(TaskExecutor)</em></a><br />	This one is called every time a task is launched by the scheduler.</p></li><li><p><a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/SchedulerListener.html#taskSucceeded(it.sauronsoftware.cron4j.TaskExecutor)"><em>taskSucceeded(TaskExecutor)</em></a><br />	This one is called every time a task execution has been successfully	completed.</p></li><li><p><a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/SchedulerListener.html#taskFailed(it.sauronsoftware.cron4j.TaskExecutor,%20java.lang.Throwable)"><em>taskFailed(TaskExecutor,	Throwable)</em></a><br />	This one is called every time a task execution fails due to an uncaught	exception.</p></li></ul><p>See the "<a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#p09">Executors</a>" paragraph for more info about task executors.</p><p>Once your <em>SchedulerListener</em> instance is ready, you can register it on a <em>Scheduler</em> object by calling its <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#addSchedulerListener(it.sauronsoftware.cron4j.SchedulerListener)"><em>addSchedulerListener(SchedulerListener)</em></a> method. Already registered listeners can be removed by calling the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#removeSchedulerListener(it.sauronsoftware.cron4j.SchedulerListener)"><em>removeSchedulerListener(SchedulerListener)</em></a> method. The scheduler can also give back any registered listener, with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#getSchedulerListeners()"><em>getSchedulerListeners()</em></a> method.</p><p><em>SchedulerListener</em>s can be added and removed at every moment, also while the scheduler is running.</p><p><a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#pIndex">Back to index</a></p><a name="p09" id="p09" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(&quot;/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif&quot;); background-repeat: no-repeat;"></a> <h2>9. Executors</h2><p>The scheduler, once it has been started and it is running, can be queried to give back its <em>executors</em>. An executor is similar to a thread. Executors is used by the scheduler to execute tasks.</p><p>By calling the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html"><em>Scheduler</em></a>.<a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#getExecutingTasks()"><em>getExecutingTasks()</em></a> method you can obtain the currently ongoing executors.</p><p>You can also obtain an executor through a <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/SchedulerListener.html"><em>SchedulerListener</em></a> instance (see the "<a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#p08">Building your own scheduler listener</a>" paragraph).</p><p>Each executor, represented by a <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html"><em>it.sauronsoftware.cron4j.TaskExecutor</em></a> instance, performs a different task execution.</p><p>The task can be retrieved with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#getTask()"><em>getTask()</em></a> method.</p><p>The executor status can be checked with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#isAlive()"><em>isAlive()</em></a> method: it returns <em>true</em> if the executor is currently running.</p><p>If the executor is running, the current thread can be paused until the execution will be completed, calling the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#join()"><em>join()</em></a> method.</p><p>The <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#supportsStatusTracking()"><em>supportsStatusTracking()</em></a> method returns <em>true</em> if the currently executing task supports <em>status tracking</em>. It means that the task communicates to the executor its status, represented by a string. The current status message can be retrieved by calling the executor <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#getStatusMessage()"><em>getStatusMessage()</em></a> method.</p><p>The <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#supportsCompletenessTracking()"><em>supportsCompletenessTracking()</em></a> method returns <em>true</em> if the currently executing task supports <em>completeness tracking</em>. It means that the task communicates to the executor its own completeness level. The current completeness level can be retrieved by calling the executor <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#getCompleteness()"><em>getCompleteness()</em></a> method. Returned values are between 0 (task just started and still nothing done) and 1 (task completed).</p><p>The <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#canBePaused()"><em>canBePaused()</em></a> method returns <em>true</em> if the currently executing task supports <em>execution pausing</em>. It means that the task execution can be paused by calling the executor <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#pause()"><em>pause()</em></a> method. The pause status of the executor can be checked with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#isPaused()"><em>isPaused()</em></a> method. A paused executor can be resumed by calling its <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#resume()"><em>resume()</em></a> method.</p><p>The <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#canBeStopped()"><em>canBeStopped()</em></a> method returns <em>true</em> if the currently executing task supports <em>execution interruption</em>. It means that the task execution can be stopped by calling the executor <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#stop()"><em>stop()</em></a> method. The interruption status of the executor can be checked with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#isStopped()"><em>isStopped()</em></a> method. Stopped executors cannot be resumed.</p><p>The <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#getStartTime()"><em>getStartTime()</em></a> method returns a time stamp reporting the start time of the executor, or a value less than 0 if the executor has not been yet started.</p><p>The <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#getScheduler()"><em>getScheduler()</em></a> method returns the scheduler which is the owner of the executor.</p><p>The <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#getGuid()"><em>getGuid()</em></a> method returns a textual GUID for the executor.</p><p>Executors offer also an event-driven API, through the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutorListener.html"><em>it.sauronsoftware.cron4j.TaskExecutorListener</em></a> class. A <em>TaskExecutorListener</em> can be added to a <em>TaskExecutor</em> with its <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#addTaskExecutorListener(it.sauronsoftware.cron4j.TaskExecutorListener)"><em>addTaskExecutorListener(TaskExecutorListener)</em></a> method. Listeners can be removed with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#removeTaskExecutorListener(it.sauronsoftware.cron4j.TaskExecutorListener)"><em>removeTaskExecutorListener(TaskExecutorListener)</em></a> method, and they can also be retrieved with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#getTaskExecutorListeners()"><em>getTaskExecutorListeners()</em></a> method. A <em>TaskExecutorListener</em> must implement the following methods:</p><ul><li><p><a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#executionPausing(it.sauronsoftware.cron4j.TaskExecutor)"><em>executionPausing(TaskExecutor)</em></a><br />	Called when the executor is requested to pause the ongoing task. The	given parameter represents the source <em>TaskExecutor</em> instance.</p></li><li><p><a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#executionResuming(it.sauronsoftware.cron4j.TaskExecutor)"><em>executionResuming(TaskExecutor)</em></a><br />	Called when the executor is requested to resume the execution of the	previously paused task. The given parameter represents the source <em>TaskExecutor</em>	instance.</p></li><li><p><a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#executionStopping(it.sauronsoftware.cron4j.TaskExecutor)"><em>executionStopping(TaskExecutor)</em></a><br />	Called when the executor is requested to stop the task execution. The	given parameter represents the source <em>TaskExecutor</em> instance.</p></li><li><p><a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#executionTerminated(it.sauronsoftware.cron4j.TaskExecutor,%20java.lang.Throwable)"><em>executionTerminated(TaskExecutor,	Throwable)</em></a><br />	Called when the executor has completed the task execution. The first	parameter represents the source <em>TaskExecutor</em> instance, while	the second is the optional exception that has caused the task to be	terminated. If the task has been completed successfully, the given	value is <em>null</em>.</p></li><li><p><a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#statusMessageChanged(it.sauronsoftware.cron4j.TaskExecutor,%20java.lang.String)"><em>statusMessageChanged(TaskExecutor,	String)</em></a><br />	Called every time the execution status message changes. The first	parameter represents the source <em>TaskExecutor</em> instance, while	the second is the new message issued by the task.</p></li><li><p><a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html#completenessValueChanged(it.sauronsoftware.cron4j.TaskExecutor,%20double)"><em>completenessValueChanged(TaskExecutor,	double)</em></a><br />	Called every time the execution completeness value changes. The first	parameter represents the source <em>TaskExecutor</em> instance, while	the second is the new completeness value (between 0 and 1) issued by	the task.</p></li></ul><p><a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#pIndex">Back to index</a></p><a name="p10" id="p10" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(&quot;/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif&quot;); background-repeat: no-repeat;"></a> <h2>10. Manual task launch</h2><p>If the scheduler is started and running, it is possible to manually launch a task, without scheduling it with a pattern. The method is <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html"><em>Scheduler</em></a>.<a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#launch(it.sauronsoftware.cron4j.Task)"><em>launch(Task)</em></a>. The task will be immediately launched, and a <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskExecutor.html"><em>TaskExecutor</em></a> instace is returned to the caller. The returned object can be used to control the task execution (see the "<a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#p09">Executors</a>" paragraph).</p><p><a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#pIndex">Back to index</a></p><a name="p11" id="p11" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(&quot;/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif&quot;); background-repeat: no-repeat;"></a> <h2>11. Working with Time Zones</h2><p>Scheduler instances, by default, work with the system default Time Zone. I.e. a scheduling pattern whose value is <em>0 2 * * *</em> will activate its task at 02:00 AM according to the default system Time Zone. The scheduler can be requested to work with a different Time Zone, which is not the system default one. Call <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html"><em>Scheduler</em></a>.<a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#setTimeZone(java.util.TimeZone)"><em>setTimeZone(TimeZone)</em></a> and <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html"><em>Scheduler</em></a>.<a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#getTimeZone()"><em>getTimeZone()</em></a> to control this feature.</p><p>Once the default Time Zone has been changed, system current time is adapted to the supplied zone before comparing it with registered scheduling patterns. The result is that any supplied scheduling pattern is treated according to the specified Time Zone. Suppose this situation:</p><ul><li>System time: 10:00</li><li>System time zone: GMT+1</li><li>Scheduler time zone: GMT+3</li></ul><p>The scheduler, before comparing system time with patterns, translates 10:00 from GMT+1 to GMT+3. It means that 10:00 becomes 12:00. The resulted time is then used by the scheduler to activate tasks. So, in the given configuration at the given moment, any task scheduled as <em>0 12 * * *</em> will be executed, while any <em>0 10 * * *</em> will not.</p><p><a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#pIndex">Back to index</a></p><a name="p12" id="p12" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(&quot;/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif&quot;); background-repeat: no-repeat;"></a> <h2>12. Daemon threads</h2><p>The Java Virtual Machine exits when the only threads running are all daemon threads. The cron4j scheduler can be configured to spawn only daemon threads. To control this feature call the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html"><em>Scheduler</em></a>.<a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#setDaemon(boolean)"><em>setDaemon(boolean)</em></a> method. This method must be called before the scheduler is started. Default value is <em>false</em>. To check the scheduler current daemon status call the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html"><em>Scheduler</em></a>.<a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#isDaemon()"><em>isDaemon()</em></a> method.</p><p><a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#pIndex">Back to index</a></p><a name="p13" id="p13" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(&quot;/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif&quot;); background-repeat: no-repeat;"></a> <h2>13. Predictor</h2><p>The <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Predictor.html"><em>it.sauronsoftware.cron4j.Predictor</em></a> class is able to predict when a scheduling pattern will be matched.</p><p>Suppose you want to know when the scheduler will execute a task scheduled with the pattern <em>0 3 * jan-jun,sep-dec mon-fri</em>. You can predict the next <em>n</em> execution of the task using a Predictor instance:</p><pre>String pattern = "0 3 * jan-jun,sep-dec mon-fri"; Predictor p = new Predictor(pattern); for (int i = 0; i &lt; n; i++) { 	System.out.println(p.nextMatchingDate()); }</pre><p><a href="http://www.sauronsoftware.it/projects/cron4j/manual.php#pIndex">Back to index</a></p><a name="p14" id="p14" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(&quot;/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif&quot;); background-repeat: no-repeat;"></a> <h2>14. Cron parser</h2><p>The <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/CronParser.html"><em>it.sauronsoftware.cron4j.CronParser</em></a> class can be used to parse crontab-like formatted file and character streams.</p><p>If you want to schedule a list of tasks declared in a crontab-like file you don't need the <em>CronParser</em>, since you can do it by adding the file to the scheduler, with the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html"><em>Scheduler</em></a>.<a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/Scheduler.html#scheduleFile(File)"><em>scheduleFile(File)</em></a> method.</p><p>Consider to use the <em>CronParser</em> if the <em>Scheduler.scheduleFile(File)</em> method is not enough for you. In example, you may need to fetch the task list from a remote source which is not representable as a <em>java.io.File</em> object (a document on a remote server, a DBMS result set and so on). To solve the problem you can implement your own <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/TaskCollector.html"><em>it.sauronsoftware.cron4j.TaskCollector</em></a>, getting the advantage of the <em>CronParser</em> to easily parse any crontab-like content.</p><p>You can parse a whole file/stream, but you can also parse a single line.</p><p>A line can be empty, can contain a comment or it can be a scheduling line.</p><p>A line containing no characters or a line with only space characters is considered an empty line.</p><p>A line whose first non-space character is a number sign (#) is considered a comment.</p><p>Empty lines and comment lines are ignored by the parser.</p><p>Any other kind of line is parsed as a scheduling line.</p><p>A valid scheduling line respects the following structure:</p><pre>scheduling-pattern [options] command [args]</pre><ul><li><em>scheduling-pattern</em> is a valid scheduling pattern,	according with the definition given by the <a href="http://www.sauronsoftware.it/projects/cron4j/api/it/sauronsoftware/cron4j/SchedulingPattern.html"><em>it.sauronsoftware.cron4j.SchedulingPattern</em></a>	class.</li><li><em>options</em> is a list of optional information used by	cron4j to prepare the task execution environment. See below for a more	detailed description.</li><li><em>command</em> is a system valid command, such an executable	call.</li><li><em>args</em> is a list of optional arguments for the command.</li></ul><p>After the scheduling pattern item, other tokens in each line are space separated or delimited with double quotation marks (").</p><p>Double quotation marks delimited items can take advantage of the following escape sequences:</p><ul><li>\" - quotation mark</li><li>\\ - back slash</li><li>\/ - slash</li><li>\b - back space</li><li>\f - form feed</li><li>\n - new line</li><li>\r - carriage return</li><li>\t - horizontal tab</li><li>\u<em>four-hex-digits</em> - the character at the given	Unicode index</li></ul><p>The <em>options</em> token collection can include one or more of the following elements:</p><ul><li>IN:<em>file-path</em> - Redirects the command standard input	channel to the specified file.</li><li>OUT:<em>file-path</em> - Redirects the command standard output	channel to the specified file.</li><li>ERR:<em>file-path</em> - Redirects the command standard error	channel to the specified file.</li><li>ENV:<em>name</em>=<em>value</em> - Defines an environment	variable in the scope of the command.</li><li>DIR:<em>directory-path</em> - Sets the path of the working	directory for the command. This feature is not supported if the	executing JVM is less than 1.3.</li></ul><p>It is also possible to schedule the invocation of a method of a Java class in the scope of the parser ClassLoader. The method has to be static and it must accept an array of strings as its sole argument. To invoke a method of this kind the syntax is:</p><pre>scheduling-pattern java:className#methodName [args]</pre><p>The <em>#methodName</em> part can be omitted: in this case the <em>main(String[])</em> method will be assumed.</p><p>Please note that static methods are invoked within the scheduler same JVM, without spawning any external process. Thus IN, OUT, ERR, ENV and DIR options can't be applied.</p><p>Invalid scheduling lines are discarded without blocking the parsing procedure, but an error message is sent to the application standard error channel.</p><p>Valid examples:</p><pre>0 5 * * * sol.exe 0,30 * * * * OUT:C:\ping.txt ping 10.9.43.55 0,30 4 * * * "OUT:C:\Documents and Settings\Carlo\ping.txt" ping 10.9.43.55 0 3 * * * ENV:JAVA_HOME=C:\jdks\1.4.2_15 DIR:C:\myproject OUT:C:\myproject\build.log C:\myproject\build.bat "Nightly Build" 0 4 * * * java:mypackage.MyClass#startApplication myOption1 myOption2</pre><img src ="http://www.blogjava.net/huamengxing/aggbug/430392.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2016-05-07 15:39 <a href="http://www.blogjava.net/huamengxing/archive/2016/05/07/430392.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>阿里云Linux安装软件镜像源</title><link>http://www.blogjava.net/huamengxing/archive/2016/04/30/430316.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Sat, 30 Apr 2016 13:11:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2016/04/30/430316.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/430316.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2016/04/30/430316.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/430316.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/430316.html</trackback:ping><description><![CDATA[<p style="padding: 0px; margin-top: 0px; margin-right: 0px; margin-left: 0px; border: 0px; text-align: justify; word-wrap: break-word; word-break: break-all; text-indent: 2em; color: #444444; font-family: 'Microsoft YaHei', 微软雅黑, Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif; line-height: 22px; background-color: #ffffff;"><span style="padding: 0px; margin: 0px; text-indent: 2em;">阿里云Linux安装软件镜像源</span></p><p style="padding: 0px; margin-top: 0px; margin-right: 0px; margin-left: 0px; border: 0px; text-align: justify; word-wrap: break-word; word-break: break-all; text-indent: 2em; color: #444444; font-family: 'Microsoft YaHei', 微软雅黑, Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif; line-height: 22px; background-color: #ffffff;">阿里云是最近新出的一个镜像源。得益与阿里云的高速发展，这么大的需求，肯定会推出自己的镜像源。<br style="padding: 0px; margin: 0px;" />阿里云Linux安装镜像源地址：http://mirrors.aliyun.com/</p><p style="padding: 0px; margin-top: 0px; margin-right: 0px; margin-left: 0px; border: 0px; text-align: justify; word-wrap: break-word; word-break: break-all; text-indent: 2em; color: #444444; font-family: 'Microsoft YaHei', 微软雅黑, Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif; line-height: 22px; background-color: #ffffff;">CentOS系统更换软件安装源<br style="padding: 0px; margin: 0px;" />第一步：备份你的原镜像文件，以免出错后可以恢复。</p><p style="padding: 0px; margin-top: 0px; margin-right: 0px; margin-left: 0px; border: 0px; text-align: justify; word-wrap: break-word; word-break: break-all; text-indent: 2em; color: #444444; font-family: 'Microsoft YaHei', 微软雅黑, Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif; line-height: 22px; background-color: #ffffff;">mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup<br style="padding: 0px; margin: 0px;" />第二步：下载新的CentOS-Base.repo 到/etc/yum.repos.d/<br style="padding: 0px; margin: 0px;" />CentOS 5</p><p style="padding: 0px; margin-top: 0px; margin-right: 0px; margin-left: 0px; border: 0px; text-align: justify; word-wrap: break-word; word-break: break-all; text-indent: 2em; color: #444444; font-family: 'Microsoft YaHei', 微软雅黑, Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif; line-height: 22px; background-color: #ffffff;">wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo<br style="padding: 0px; margin: 0px;" />CentOS 6</p><p style="padding: 0px; margin-top: 0px; margin-right: 0px; margin-left: 0px; border: 0px; text-align: justify; word-wrap: break-word; word-break: break-all; text-indent: 2em; color: #444444; font-family: 'Microsoft YaHei', 微软雅黑, Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif; line-height: 22px; background-color: #ffffff;">wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo<br style="padding: 0px; margin: 0px;" />第三步：运行yum makecache生成缓存</p><p style="padding: 0px; margin-top: 0px; margin-right: 0px; margin-left: 0px; border: 0px; text-align: justify; word-wrap: break-word; word-break: break-all; text-indent: 2em; color: #444444; font-family: 'Microsoft YaHei', 微软雅黑, Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif; line-height: 22px; background-color: #ffffff;">yum clean all</p><p style="padding: 0px; margin-top: 0px; margin-right: 0px; margin-left: 0px; border: 0px; text-align: justify; word-wrap: break-word; word-break: break-all; text-indent: 2em; color: #444444; font-family: 'Microsoft YaHei', 微软雅黑, Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif; line-height: 22px; background-color: #ffffff;">yum makecache</p><img src ="http://www.blogjava.net/huamengxing/aggbug/430316.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2016-04-30 21:11 <a href="http://www.blogjava.net/huamengxing/archive/2016/04/30/430316.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>服务器初始安装</title><link>http://www.blogjava.net/huamengxing/archive/2016/03/23/429781.html</link><dc:creator>华梦行</dc:creator><author>华梦行</author><pubDate>Wed, 23 Mar 2016 07:15:00 GMT</pubDate><guid>http://www.blogjava.net/huamengxing/archive/2016/03/23/429781.html</guid><wfw:comment>http://www.blogjava.net/huamengxing/comments/429781.html</wfw:comment><comments>http://www.blogjava.net/huamengxing/archive/2016/03/23/429781.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/huamengxing/comments/commentRss/429781.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/huamengxing/services/trackbacks/429781.html</trackback:ping><description><![CDATA[<div>&nbsp;yum -y update</div><div></div><div></div><div></div><div></div><div>centos6 mysql5.5 yum安装</div><div></div><div>&nbsp;&nbsp;</div><div></div><div>&nbsp;</div><div>默认使用centos yum安装的mysql不是5.5版本的，我们需要增加两个新的repo</div><div></div><div>rpm -Uvh http://mirror.steadfast.net/epel/6/i386/epel-release-6-8.noarch.rpm</div><div></div><div>rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm</div><div></div><div>centos6下php php-fpm的yum安装</div><div></div><div>查看一下是不是有mysql 5.5了</div><div></div><div>yum --enablerepo=remi,remi-test list mysql mysql-server</div><div></div><div>安装mysql5.5</div><div></div><div>yum --enablerepo=remi,remi-test install mysql mysql-server</div><div></div><div>启动mysql5.5</div><div></div><div>/etc/init.d/mysqld start</div><div></div><div>设置开机启动</div><div></div><div>chkconfig --levels 345 mysqld on</div><div></div><div>要启用MySQL 安全设置请输入以下命令</div><div></div><div>/usr/bin/mysql_secure_installation<br /><br /><br /><p>CentOS/RHEL 7.x:</p><div><table><tbody><tr><td><pre>rpm <span style="color: #660033;">-Uvh</span> https:<span style="font-weight: bold;">//</span>dl.fedoraproject.org<span style="font-weight: bold;">/</span>pub<span style="font-weight: bold;">/</span>epel<span style="font-weight: bold;">/</span>epel-release-latest-7.noarch.rpm rpm <span style="color: #660033;">-Uvh</span> https:<span style="font-weight: bold;">//</span>mirror.webtatic.com<span style="font-weight: bold;">/</span>yum<span style="font-weight: bold;">/</span>el7<span style="font-weight: bold;">/</span>webtatic-release.rpm</pre></td></tr></tbody></table></div><p>CentOS/RHEL 6.x:</p><div><table><tbody><tr><td><pre>rpm <span style="color: #660033;">-Uvh</span> https:<span style="font-weight: bold;">//</span>dl.fedoraproject.org<span style="font-weight: bold;">/</span>pub<span style="font-weight: bold;">/</span>epel<span style="font-weight: bold;">/</span>epel-release-latest-6.noarch.rpm rpm <span style="color: #660033;">-Uvh</span> https:<span style="font-weight: bold;">//</span>mirror.webtatic.com<span style="font-weight: bold;">/</span>yum<span style="font-weight: bold;">/</span>el6<span style="font-weight: bold;">/</span>latest.rpm</pre></td></tr></tbody></table></div><p>CentOS/RHEL 5.x:</p><div><table><tbody><tr><td><pre>rpm <span style="color: #660033;">-Uvh</span> https:<span style="font-weight: bold;">//</span>dl.fedoraproject.org<span style="font-weight: bold;">/</span>pub<span style="font-weight: bold;">/</span>epel<span style="font-weight: bold;">/</span>epel-release-latest-5.noarch.rpm rpm <span style="color: #660033;">-Uvh</span> http:<span style="font-weight: bold;">//</span>mirror.webtatic.com<span style="font-weight: bold;">/</span>yum<span style="font-weight: bold;">/</span>el5<span style="font-weight: bold;">/</span>latest.rpm</pre></td></tr></tbody></table></div><p>Now you can install PHP 5.5&#8217;s mod_php SAPI (along with an opcode cache) by doing:</p><div><table><tbody><tr><td><pre><span style="color: #c20cb9; font-weight: bold;">yum install</span> php55w php55w-opcache</pre></td></tr></tbody></table></div><p>You can alternatively install PHP 5.5&#8217;s php-fpm SAPI (along with an opcode cache by doing:</p><br /><br /><br /><br /></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div>&nbsp; rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm</div><div>&nbsp;&nbsp;<br /><br /><div></div></div><div>rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm</div><div>rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm</div><div>如果想删除上面安装的包，重新安装</div><div>rpm -qa | grep webstatic</div><div>rpm -e &nbsp;上面搜索到的包即可</div><div></div><div>3.运行yum install</div><div>&nbsp; yum install php55w php55w-cli php55w-common php55w-gd php55w-ldap php55w-mbstring php55w-mcrypt php55w-mysql php55w-pdo&nbsp;php55w-xml</div><div></div><div>yum install php56w php56w-cli php56w-common php56w-gd php56w-ldap php56w-mbstring php56w-mcrypt php56w-mysql php56w-pdo&nbsp;php56w-xml<br /><br />php 另外一种方式<br />&nbsp;Remi官方网站：http://rpms.famillecollet.com/<div></div><div>添加Remi源，不管32位还是64位的系统，运行下面命令：</div><div></div><div>rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm</div><div></div><div>&nbsp;Remi源默认是没有启用的，我们来启用Remi源，修改 /etc/yum.repos.d/remi.repo 文件，把文件内的 enabled=0 改为 enabled=1 ，注意：改文件内有2个 enabled=0 我们修改 [remi]下面的，不要修改[remi-test]下面的。</div><div></div><div>&nbsp;到这里yum源的配置结束，下面安装软件就简单了。安装时候有询问y/n的时候都是y</div><div></div><div>安装php,php-fpm以及php扩展：</div><div></div><div>yum install php php-fpm php-bcmatch php-gd php-mbstring php-mcrypt php-mysql php-pdo &nbsp;&nbsp;php-dom<br /><br /><br />wget https://files.phpmyadmin.net/phpMyAdmin/4.0.10.15/phpMyAdmin-4.0.10.15-english.zip<br /></div></div><div>&nbsp;</div><img src ="http://www.blogjava.net/huamengxing/aggbug/429781.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/huamengxing/" target="_blank">华梦行</a> 2016-03-23 15:15 <a href="http://www.blogjava.net/huamengxing/archive/2016/03/23/429781.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>