日韩亚洲变态另类中文,久久亚洲色一区二区三区,亚洲综合色成在线播放http://m.tkk7.com/linugb118/Javazh-cnWed, 14 May 2025 22:33:27 GMTWed, 14 May 2025 22:33:27 GMT60Javascript端加密java服務(wù)端解密http://m.tkk7.com/linugb118/archive/2014/05/09/413459.htmllinugb118linugb118Fri, 09 May 2014 02:07:00 GMThttp://m.tkk7.com/linugb118/archive/2014/05/09/413459.htmlhttp://m.tkk7.com/linugb118/comments/413459.htmlhttp://m.tkk7.com/linugb118/archive/2014/05/09/413459.html#Feedback1http://m.tkk7.com/linugb118/comments/commentRss/413459.htmlhttp://m.tkk7.com/linugb118/services/trackbacks/413459.html                                   Javascript端加密java服務(wù)端解密

 

通常我們會(huì)通過htts來保證傳輸安全,但如果我們不用https,如何通過javascript來保證瀏覽器端發(fā)送的參數(shù)進(jìn)行加密,并且通過RSA算法來處理。

 

這里我們可以利用jquery的一個(gè)加密插件jcryption來處理,可以參考

http://jcryption.org/#examples

現(xiàn)在版本是3.0 但是沒有java端的實(shí)現(xiàn),下次有時(shí)間再研究。現(xiàn)在這個(gè)用的是1.1的版本

這個(gè)可以在

http://linkwithweb.googlecode.com/svn/trunk/Utilities/jCryptionTutorial 獲取

 

不過他的服務(wù)端有個(gè)缺陷我修改了。

接來大致介紹如下:

 

1.     首先服務(wù)端有產(chǎn)生publicKeyservlet

package com.gsh.oauth.auth.servlet;

 

import java.io.IOException;

import java.security.KeyPair;

 

import javax.servlet.ServletException;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

 

import com.gsh.oauth.auth.util.JCryptionUtil;

 

/**

 * Servlet implementation class EncryptionServlet

 */

public class EncryptionServlet extends HttpServlet {

       private static final long serialVersionUID = 1L;

 

       /**

        * Default constructor.

        */

       public EncryptionServlet() {

               // TODO Auto-generated constructor stub

       }

 

       /**

        * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)

        */

       protected void service(HttpServletRequest request,

                      HttpServletResponse response) throws ServletException, IOException {

               int KEY_SIZE = 1024;

               if (request.getParameter("generateKeypair") != null) {

 

                      JCryptionUtil jCryptionUtil = new JCryptionUtil();

 

                      KeyPair keys = null;

                      //if (request.getSession().getAttribute("keys") == null) { //這里注釋掉 否則第二次請(qǐng)求會(huì)500

                             keys = jCryptionUtil.generateKeypair(KEY_SIZE);

                             request.getSession().setAttribute("keys", keys);

                      //}

 

                      StringBuffer output = new StringBuffer();

 

                      String e = JCryptionUtil.getPublicKeyExponent(keys);

                      String n = JCryptionUtil.getPublicKeyModulus(keys);

                      String md = String.valueOf(JCryptionUtil.getMaxDigits(KEY_SIZE));

 

                      output.append("{\"e\":\"");

                      output.append(e);/Files/linugb118/bcprov-jdk15-1.46.jar.zip

                      output.append("\",\"n\":\"");

                      output.append(n);

                      output.append("\",\"maxdigits\":\"");

                      output.append(md);

                      output.append("\"}");

 

                      output.toString();

                      response.getOutputStream().print(

                                    output.toString().replaceAll("\r", "").replaceAll("\n", "")

                                                   .trim());

               } else {

                      response.getOutputStream().print(String.valueOf(false));

               }

       }

 

}

 

2. Client例子

<html>

<head>

<title>Login form</title>

</head>

<meta http-equiv="Content-Type"

    content="text/html; charset=utf-8">

 

<script src="../js/jquery-1.4.2.min.js" type="text/javascript"></script>

<script src="../js/jquery-ui-1.8.2.custom.min.js"

    type="text/javascript"></script>

<script type="text/javascript"

    src="../js/security/jquery.jcryption-1.1.min.js"></script>   

   

<script type="text/javascript">

    $(document).ready(function() {

        var $statusText = $('<span id="status"></span>').hide();

        $("#status_container").append($statusText);

        $("#lf").jCryption({

            getKeysURL:"/gsh/oauth/encryption?generateKeypair=true",

                                        beforeEncryption : function() {

                                            $statusText

                                                   .text("Test Code")

                                                   .show();

                                            return true;

                                        },

                                        encryptionFinished : function(

                                               encryptedString,

                                               objectLength) {

                                            $statusText

                                                   .text(encryptedString);

                                            return true;

                                        }

                                    });

                  });

</script>

<body>

 

<form id="lf" action="/gsh/oauth/authorization"

    method="post">

<fieldset><legend>login</legend>

<div>

<div>client_id:<br>

<input type="text" size="45" name="client_id" value=""></div>

<div>redirect_uri:<br>

<input type="text" size="45" name="redirect_uri" value=""></div>

</div>

<div>loginid:<br>

<input type="text" size="45" name="loginid" value=""></div>

</div>

<div>password:<br>

<input type="password" size="45" name="password" value=""></div>

</div>

<div>

<p><input type="submit" /><span id="status_container"></span></p>

</div>

</fieldset>

</form>

</body>

</html>

 

上面看代碼可以看出 他通過/gsh/oauth/encryption?generateKeypair=true來先請(qǐng)求獲取public 然后通過jcryption進(jìn)行加密 然后post到服務(wù)端。Encryption就是上面的EncryptionServlet

通過瀏覽器工具可以看到表單里面的數(shù)據(jù)加密為

 

jCryption=95f1589502288050e08b4bd8b1a360341cf616d9054531b85a6ef85783c1723b46686ec454ee81f1304fa2370ce24c4d9c06f84d47aa4bdf99310ae12b514db19bfcc325f3a39a584c23b1546550f4e0635c12486f2fd84dec137e1c61cfa775dfa3057a1f0154712aaba0af0cc61810282780f15bed909c24a184e66ab39f2e

3. 目標(biāo)servletauthorization)的解密

 

public class Authorization extends HttpServlet {

 

    protected void doGet(HttpServletRequest httpServletRequest,

           HttpServletResponse httpServletResponse) throws ServletException,

           IOException {

      

PrintWriter out = httpServletResponse.getWriter();

       

        KeyPair keys = (KeyPair) httpServletRequest.getSession().getAttribute("keys");

        String encrypted = httpServletRequest.getParameter("epCryption");

       

        String client_id = null;

    String redirect_uri = null;

    String loginid = null;

    String password = null;

 

       try {

               String data = JCryptionUtil.decrypt(encrypted, keys);

               httpServletRequest.getSession().removeAttribute("keys");

               Map params = JCryptionUtil.parse(data, "UTF-8");

               client_id = (String) params.get("client_id");

               redirect_uri = (String) params.get("redirect_uri");

               loginid = (String) params.get("loginid");

               password = (String) params.get("password");

 

           } catch (Throwable e) {

               e.printStackTrace();

           }

}

 

    }

 

上面至少片段,需要相關(guān)的jsjava問題,請(qǐng)?jiān)?/span>svn上面獲取。另外還需要bcprov-jdk15-1.46.jar

可以在http://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15/1.46

獲取。

 

 

 

 



linugb118 2014-05-09 10:07 發(fā)表評(píng)論
]]>
cas3 設(shè)置獨(dú)立登錄頁面http://m.tkk7.com/linugb118/archive/2013/05/28/399886.htmllinugb118linugb118Tue, 28 May 2013 09:12:00 GMThttp://m.tkk7.com/linugb118/archive/2013/05/28/399886.htmlhttp://m.tkk7.com/linugb118/comments/399886.htmlhttp://m.tkk7.com/linugb118/archive/2013/05/28/399886.html#Feedback0http://m.tkk7.com/linugb118/comments/commentRss/399886.htmlhttp://m.tkk7.com/linugb118/services/trackbacks/399886.html在使用cas3的時(shí)候,往往有這樣的需求,希望每個(gè)應(yīng)用有個(gè)獨(dú)立的登錄頁面
這塊cas 官方文檔有一些說明
https://wiki.jasig.org/display/CAS/Using+CAS+without+the+Login+Screen
首先從官方的角度,不建議使用多個(gè)登錄頁面,這樣對(duì)安全會(huì)形成短板。但是
用戶需求之上,如果我們要實(shí)現(xiàn),有下面幾種方式
1.通過參數(shù)來判斷css來改變布局甚至一些圖片,典型cas里面的default-view中
casLoginView.jsp 里面就有這樣的描述,通過描述可以看出他通過不同css來區(qū)分
weblogin和mobilelogin。
比如片段
<c:if
test="${not empty requestScope['isMobile'] and not empty mobileCss}">
<meta name="viewport"
content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<!--<link type="text/css" rel="stylesheet" media="screen" href="<c:url value="/css/fss-framework-1.1.2.css" />" />
             <link type="text/css" rel="stylesheet" href="<c:url value="/css/fss-mobile-${requestScope['browserType']}-layout.css" />" />
             <link type="text/css" rel="stylesheet" href="${mobileCss}" />-->
</c:if>
2.cas服務(wù)端(或者各種應(yīng)用中)建立一個(gè)獨(dú)立的form頁面
參考:https://wiki.jasig.org/display/CAS/Using+CAS+from+external+link+or+custom+external+form
比如:
在cas(或者各種的應(yīng)用頁面) web-inf/ 頁面添加testlogin.html
代碼:
<html>
<head />
<body>
    <form method="GET" action="http://192.168.2.109:8080/cas/login">
        <p>Username : <input type="text" name="username" /></p>
        <p>Password : <input type="password" name="password" /></p>
        <p>Remember me : <input type="checkbox" name="rememberMe" value="true" /></p>
        <p><input type="submit" value="Login !" /></p>
        <input type="hidden" name="auto" value="true" />
        <input type="hidden" name="service" value="http://localhost/user/checklogintocas.php" />
    </form>
</body>
</html>
casLoginView.jsp
實(shí)現(xiàn)自動(dòng)提交功能:
...
<%@ page contentType="text/html; charset=UTF-8" %>
<%
String auto = request.getParameter("auto");
if (auto != null && auto.equals("true")) {
%>
<html>
    <head>
        <script language="javascript">
            function doAutoLogin() {
                document.forms[0].submit();
            }
        </script>
    </head>
    <body onload="doAutoLogin();">
        <form id="credentials" method="POST" action="<%= request.getContextPath() %>/login?service=<%= request.getParameter("service") %>"> 
            <input type="hidden" name="lt" value="${loginTicket}" />
            <input type="hidden" name="execution" value="${flowExecutionKey}" />
            <input type="hidden" name="_eventId" value="submit" />
            <input type="hidden" name="username" value="<%= request.getParameter("username") %>" />
            <input type="hidden" name="password" value="<%= request.getParameter("password") %>" />
            <% if ("true".equals(request.getParameter("rememberMe"))) {%>
                <input type="hidden" name="rememberMe" value="true" />
            <% } %>
             
            <input type="submit" value="Submit" style="visibility: hidden;" />
        </form>
    </body>
</html>
<%
} else {
%>
<jsp:directive.include file="includes/top.jsp" />
...
<jsp:directive.include file="includes/bottom.jsp" />
<%
}
%>

3.第三種方法 其實(shí)是第二種方法的啟發(fā),直接把用if-else 把多個(gè)頁面組合在一起,通過參數(shù)來判斷顯示。(最好能可以支持多套casLoginView.jsp 不過研究下來好像比較難,也許cas開發(fā)者也是為了怕再次開放的人用太多靈活的多套casLoginView.jsp 頁面跳來跳去把項(xiàng)目搞混吧。)


linugb118 2013-05-28 17:12 發(fā)表評(píng)論
]]>
php的memcached客戶端memcachedhttp://m.tkk7.com/linugb118/archive/2013/03/22/396853.htmllinugb118linugb118Fri, 22 Mar 2013 06:19:00 GMThttp://m.tkk7.com/linugb118/archive/2013/03/22/396853.htmlhttp://m.tkk7.com/linugb118/comments/396853.htmlhttp://m.tkk7.com/linugb118/archive/2013/03/22/396853.html#Feedback0http://m.tkk7.com/linugb118/comments/commentRss/396853.htmlhttp://m.tkk7.com/linugb118/services/trackbacks/396853.html

【轉(zhuǎn)】php的memcached客戶端memcached

Tags:  ,  , 
文章作者:Enjoy 轉(zhuǎn)載請(qǐng)注明原文鏈接。
之前在安裝memcache時(shí)有提到memcached客戶端是叫memcache,其實(shí)還有一個(gè)基于libmemcached的客戶端叫memcached,據(jù)說性能更好,功能也更多。

memcache的官方主頁:http://pecl.php.net/package/memcache
memcached的官方主頁:http://pecl.php.net/package/memcached

以下是我安裝Memcached版本的PHP模塊的過程記錄:

wgethttp://download.tangent.org/libmemcached-0.48.tar.gz
tar zxf libmemcached-0.48.tar.gz
cd libmemcached-0.48
./configure --prefix=/usr/local/libmemcached --with-memcached
make
make install

wget http://pecl.php.net/get/memcached-1.0.2.tgz
tar zxf memcached-1.0.2.tgz
cd memcached-1.0.2
/usr/local/webserver/php/bin/phpize 
./configure --enable-memcached --with-php-config=/usr/local/webserver/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached
make
make install

在php.ini中加入
extension=memcached.so
完成

另:
在安裝libmemcached時(shí),如果只用./configure,可能會(huì)提示:
checking for memcached… no
configure: error: “could not find memcached binary”

兩者使用起來幾乎一模一樣。

    $mem = new Memcache;
    $mem->addServer($memcachehost, '11211');    
    $mem->addServer($memcachehost, '11212');
    $mem->set('hx','9enjoy');
    echo $mem->get('hx');


    $md = new Memcached;
    $servers = array(
        array($memcachehost, '11211'),
        array($memcachehost, '11212')
    );
    $md->addServers($servers);
    $md->set('hx','9enjoy');
    echo $md->get('hx');


memcached的方法比memcache多不少,比如getMulti,getByKey,addServers等。
memcached沒有memcache的connect方法,目前也還不支持長連接。
memcached 支持 Binary Protocol,而 memcache 不支持,意味著 memcached 會(huì)有更高的性能。
Memcache是原生實(shí)現(xiàn)的,支持OO和非OO兩套接口并存,memcached是使用libmemcached,只支持OO接口。
更詳細(xì)的區(qū)別:http://code.google.com/p/memcached/wiki/PHPClientComparison


memcached服務(wù)端是集中式的緩存系統(tǒng),分布式實(shí)現(xiàn)方法是由客戶端決定的。
memcached的分布算法一般有兩種選擇:
1、根據(jù)hash(key)的結(jié)果,模連接數(shù)的余數(shù)決定存儲(chǔ)到哪個(gè)節(jié)點(diǎn),也就是hash(key)% sessions.size(),這個(gè)算法簡單快速,表現(xiàn)良好。然而這個(gè)算法有個(gè)缺點(diǎn),就是在memcached節(jié)點(diǎn)增加或者刪除的時(shí)候,原有的緩存數(shù)據(jù)將大規(guī)模失效,命中率大受影響,如果節(jié)點(diǎn)數(shù)多,緩存數(shù)據(jù)多,重建緩存的代價(jià)太高,因此有了第二個(gè)算法。
2、Consistent Hashing,一致性哈希算法,他的查找節(jié)點(diǎn)過程如下:
    首先求出memcached服務(wù)器(節(jié)點(diǎn))的哈希值,并將其配置到0~232的圓(continuum)上。然后用同樣的方法求出存儲(chǔ)數(shù)據(jù)的鍵的哈希值,并映射到圓上。然后從數(shù)據(jù)映射到的位置開始順時(shí)針查找,將數(shù)據(jù)保存到找到的第一個(gè)服務(wù)器上。如果超過2的32次方后仍然找不到服務(wù)器,就會(huì)保存到第一臺(tái)memcached服務(wù)器上。

memcache在沒有任何配置的情況下,是使用第一種方法。memcached要實(shí)現(xiàn)第一種方法,似乎是使用(未確認(rèn)):
$md->setOption(Memcached::OPT_HASH, Memcached::HASH_CRC);   

第二種一致性哈希算法:

memcache在php.ini中加
Memcache.hash_strategy =consistent
Memcache.hash_function =crc32


memcached在程序中加(未確認(rèn))
$md->setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);
$md->setOption(Memcached::OPT_HASH, Memcached::HASH_CRC);   

$mem->setOption(Memcached::OPT_DISTRIBUTION,Memcached::DISTRIBUTION_CONSISTENT);
$mem->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE,true);

一些參考文檔:
memcached分布測(cè)試報(bào)告(一致性哈希情況下的散列函數(shù)選擇):http://www.iteye.com/topic/346682
php模塊memcache和memcached區(qū)別:http://hi.baidu.com/dong_love_yan/blog/item/afbe1e12d22e7512203f2e21.html
PHP模塊:Memcached > Memcache:http://hi.baidu.com/thinkinginlamp/blog/item/717cd42a11f6e491023bf67a.html


20110509@@UPDATE:
如果安裝libmemcached有如下出錯(cuò)提示:
make[2]: *** [clients/ms_conn.o] Error 1
make[2]: Leaving directory `/www/soft/libmemcached-0.48'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/www/soft/libmemcached-0.48'
make: *** [all] Error 2

可在configure時(shí)增加--disable-64bit CFLAGS="-O3 -march=i686"
即:./configure --prefix=/usr/local/libmemcached --with-memcached --disable-64bit CFLAGS="-O3 -march=i686"


linugb118 2013-03-22 14:19 發(fā)表評(píng)論
]]>
綠色mysql安裝問題http://m.tkk7.com/linugb118/archive/2013/03/21/396790.htmllinugb118linugb118Thu, 21 Mar 2013 02:36:00 GMThttp://m.tkk7.com/linugb118/archive/2013/03/21/396790.htmlhttp://m.tkk7.com/linugb118/comments/396790.htmlhttp://m.tkk7.com/linugb118/archive/2013/03/21/396790.html#Feedback0http://m.tkk7.com/linugb118/comments/commentRss/396790.htmlhttp://m.tkk7.com/linugb118/services/trackbacks/396790.html
2. 安裝服務(wù)時(shí)候指定的ini路徑需要注意,應(yīng)該指定你現(xiàn)在mysql目錄現(xiàn)有的ini文件
如mysqld --install mysql --defaults-file="C:\MySQL5\my.ini"





linugb118 2013-03-21 10:36 發(fā)表評(píng)論
]]>
Mulestudio 運(yùn)行demo出錯(cuò)http://m.tkk7.com/linugb118/archive/2012/10/18/389833.htmllinugb118linugb118Thu, 18 Oct 2012 09:22:00 GMThttp://m.tkk7.com/linugb118/archive/2012/10/18/389833.htmlhttp://m.tkk7.com/linugb118/comments/389833.htmlhttp://m.tkk7.com/linugb118/archive/2012/10/18/389833.html#Feedback0http://m.tkk7.com/linugb118/comments/commentRss/389833.htmlhttp://m.tkk7.com/linugb118/services/trackbacks/389833.html現(xiàn)象:
 執(zhí)行demo,比如helloexample ,點(diǎn)擊“run as mule application”,彈出框“Could not find the main class.Program will exit”
控制臺(tái)出現(xiàn):
java.lang.NoClassDefFoundError: org/mule/tooling/server/application/ApplicationDeployer
Exception in thread "main" 

解決方法:
 是因?yàn)閖dk 有問題,在mule官網(wǎng)上要求

Before installing Mule Studio, ensure that the host machine has one of the following Java Development Kit versions installed on it:

  • Standard Edition 1.6.0_26 (also known as JDK SE 6 Update 26) or more recent
  • Enterprise Edition 1.6u3 (JDK EE 6 Update 3) or more recent
  • Any version (SE or EE) of JDK 7
    在java build path--》libraries 選擇jre system library 為jdk1.7就可以。


linugb118 2012-10-18 17:22 發(fā)表評(píng)論
]]>
開始serviceMix http://m.tkk7.com/linugb118/archive/2012/06/11/380512.htmllinugb118linugb118Mon, 11 Jun 2012 09:10:00 GMThttp://m.tkk7.com/linugb118/archive/2012/06/11/380512.htmlhttp://m.tkk7.com/linugb118/comments/380512.htmlhttp://m.tkk7.com/linugb118/archive/2012/06/11/380512.html#Feedback0http://m.tkk7.com/linugb118/comments/commentRss/380512.htmlhttp://m.tkk7.com/linugb118/services/trackbacks/380512.html1.     serviceMix 特點(diǎn):

支持的協(xié)議有:

FileFTPHttp/sjmssmtpsoaptcpxmpp

與其他引擎的支持:

Apache Camelapache cxfapache odedroolsos workflowpojosquartzscriptingsaxon Xquery and xsltws-notification

支持的安全:

JAAS,WS-Security

web 容器的集成

JBoss,Geronimo,jetty,tomcat,weblogic,websphere

 

2.     eclipse IDE tooling for serviceMix

http://eclipse.org/stp

http://spagic.com

http://sopera.de/en/products/sopera-servicemixtools

 

3.     安裝:

  1. 官方下載http://servicemix.apache.org/downloads.html.并解壓
  2. 進(jìn)入bin目錄執(zhí)行servicemix.bat或者shell script
  3. Sericemixosgi結(jié)構(gòu)的,

通過osgi:list 命令可以查看所有有效的osgi bundles

通過osgi:list | grep camel 命令 查看camel相關(guān)的bundles

通過log:display命令 來顯示日志

通過log:display-exception  顯示最近的異常日志

通過log:set DEBUG  設(shè)置日志的級(jí)別

通過log:display | grep DEBUG 顯示只是debug級(jí)別的日志

          通過features:list 來查看所有的特性,并從而可以分析當(dāng)前特性是否安裝

          若沒有安裝 可以通過 features:install來安裝,比如:features:install webconsole

4.     Camel 集成

先查看是否存在camel相關(guān)features,沒有則按照相應(yīng)的bundles

接下來我們做一個(gè)例子:分別設(shè)置兩個(gè)目錄inputoutput,在input放入文件后則被傳送到output中。而這個(gè)過程就是通過serviceMix調(diào)用camel router來完成

  1. Blueprint xml file

下面是一個(gè)配置的router文件描述,你可以通過自己寫文件,當(dāng)然最好還是用可視化工具,后面我們?cè)倩〞r(shí)間聊聊這東東,這個(gè)時(shí)候就繞不開Enterprise Integration pattern 又是標(biāo)準(zhǔn),老外厲害。

 我們這里直接先貼上文件:

<?xml version="1.0" encoding="UTF-8"?>

<blueprint

    xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

    xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

 

    <camelContext xmlns="http://camel.apache.org/schema/blueprint">

        <route>

            <from uri="file:bgao/input" />

            <log message="happy day!!!" />

            <to uri="file:bgao/output" />

        </route>

    </camelContext>

</blueprint>

并命名為firstCamelRouter.xml

 

  1. 配置到serviceMix

將文件放入到serviceMixdeploy中,這個(gè)時(shí)候后再serviceMix目錄下發(fā)現(xiàn)bgao的目錄并下面有個(gè)input文件夾,這時(shí)候如果在input文件夾放入一個(gè)文件,這bgao目錄下會(huì)出現(xiàn)output目錄并且將input目錄的文件移到output上。通過log:display  可以查看到當(dāng)前這個(gè)動(dòng)作的日志。

 

通過karaf@root> osgi:list | grep xml

[  43] [Active     ] [GracePeriod ] [       ] [   60] activemq-broker.xml (0.0.0

)

[ 129] [Active     ] [            ] [       ] [   60] Apache ServiceMix :: Bundl

es :: xmlsec (1.4.5.1)

[ 138] [Active     ] [            ] [       ] [   60] Apache ServiceMix :: Bundl

es :: xmlbeans (2.4.0.4)

[ 142] [Active     ] [            ] [       ] [   60] Apache ServiceMix :: Bundl

es :: xmlresolver (1.2.0.3)

[ 163] [Active     ] [Created     ] [       ] [   60] firstCamelRouter.xml (0.0.

0)

得到當(dāng)前ID163;通過osgi:stop 163或者  osgi:start 163 來啟動(dòng)或者關(guān)閉當(dāng)前bundle

 

5.     ActiveMQ集成

先查看是否存在camel相關(guān)features, 沒有則按照相應(yīng)的bundles

我們做一個(gè)例子:

對(duì)兩個(gè)文件進(jìn)行文件移動(dòng),同時(shí)對(duì)MQ隊(duì)列產(chǎn)生一個(gè)event 消息并捕獲消息打出到日志。

第一個(gè)文件:firstMq.xml

<?xml version="1.0" encoding="UTF-8"?>

<blueprint

    xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

    xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

 

    <camelContext xmlns="http://camel.apache.org/schema/blueprint">

        <route>

            <from uri="file:bgao/mq/input" />

            <to uri="file:bgao/mq/output" />         

                <setBody>

                <simple>

                File Move Event (${file:name},${date:now:hh:MM:ss.SSS})

                </simple>

                </setBody>

                <to uri="activemq://event" />

        </route>         

    </camelContext>

</blueprint>

這時(shí)候,文件已經(jīng)移到output,現(xiàn)在是event message都在隊(duì)列里面,但還沒有人去處理他,現(xiàn)在通過secondeMq里處理她。

設(shè)置第二個(gè)文件 secondMq.xml 放入deloy文件夾中

<?xml version="1.0" encoding="UTF-8"?>

<blueprint

    xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

    xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

 

    <camelContext xmlns="http://camel.apache.org/schema/blueprint">

        <route>

        <from uri="activemq://event" />

            <from uri="file:bgao/mq/input" />

            <to uri="log:events" />         

        </route>         

    </camelContext>

</blueprint>

啟動(dòng)當(dāng)前這個(gè)bundle 然后打日志就發(fā)現(xiàn)有

2012-06-11 16:01:43,751 | INFO  | sConsumer[event] | events

      | ?                                   ? | 91 - org.apache.camel.camel-core

 - 2.8.4 | Exchange[ExchangePattern:InOnly, BodyType:String, Body:

                        File Move Event (address list20120130.xls,04:06:08.272)

                        ]

2012-06-11 16:01:43,751 | INFO  | sConsumer[event] | events

      | ?                                   ? | 91 - org.apache.camel.camel-core

 - 2.8.4 | Exchange[ExchangePattern:InOnly, BodyType:String, Body:

                        File Move Event (jms-1_1-fr-spec.pdf,04:06:08.469)

                        ]

2012-06-11 16:01:43,752 | INFO  | sConsumer[event] | events

      | ?                                   ? | 91 - org.apache.camel.camel-core

 - 2.8.4 | Exchange[ExchangePattern:InOnly, BodyType:String, Body:

                        File Move Event (新建文本文檔 (3).txt,04:06:08.765)

 

6.     Webconsole

通過安裝features:install webconsole后,可以通過訪問http://localhost:8181/system/console

用戶名:smx

密碼:smx

當(dāng)前webconsole karaf框架提供的一個(gè)web頁面系統(tǒng)。



linugb118 2012-06-11 17:10 發(fā)表評(píng)論
]]>
為weblogic配置maven插件http://m.tkk7.com/linugb118/archive/2012/06/04/379908.htmllinugb118linugb118Mon, 04 Jun 2012 03:14:00 GMThttp://m.tkk7.com/linugb118/archive/2012/06/04/379908.htmlhttp://m.tkk7.com/linugb118/comments/379908.htmlhttp://m.tkk7.com/linugb118/archive/2012/06/04/379908.html#Feedback0http://m.tkk7.com/linugb118/comments/commentRss/379908.htmlhttp://m.tkk7.com/linugb118/services/trackbacks/379908.html從weblogic 10.3.4開始支持maven deploy部署
步驟如下:
1.構(gòu)建weblogic-maven-plugin jar
在D:\oracle\Middleware\wlserver_12.1\server\lib
找到 WebLogic JarBuilder Tool (wljarbuilder),執(zhí)行:
java -jar wljarbuilder.jar -profile weblogic-maven-plugin
2.將weblogic-maven-plugin jar中的pom.xml 解壓出放入到在
D:\oracle\Middleware\wlserver_12.1\server\lib
可以使用命令:
jar xvf D:/oracle/Middleware/wlserver_12.1/server/lib/weblogic-maven-plugin.jar 
META-INF/maven/com.oracle.weblogic/weblogic-maven-plugin/pom.xml
cp D:/oracle/Middleware/wlserver_12.1/server/lib/META-INF/maven/com.oracle.weblogic/
weblogic-maven-plugin/pom.xml D:/oracle/Middleware/wlserver_12.1/server/lib
3.安裝插件:
一種將weblogic-maven-plugin.jar 和pom.xml上傳到nexus的第三方庫中
另一種執(zhí)行mvn install:install-file -Dfile=weblogic-maven-plugin.jar -DpomFile=pom.xml
進(jìn)行安裝。這個(gè)時(shí)候在你的本地倉庫能到找.m2\repository\com\oracle\weblogic
4.在當(dāng)前需要上傳的應(yīng)用的pom中配置weblogic的相關(guān)配置
比如:
 <!--auto deploy war to weblogic by maven-->
   
   <plugin> 
 <groupId>com.oracle.weblogic</groupId>
 <artifactId>weblogic-maven-plugin</artifactId>
 <version>10.3.6.0</version>
      <configuration> 
          <adminurl>t3://192.168.2.141:9001</adminurl>
          <user>weblogic</user> 
          <password>123456</password> 
          <upload>true</upload> 
          <action>deploy</action> 
          <remote>false</remote> 
          <verbose>true</verbose> 
<source>target/demo.war</source> 
         <name>demo</name> 
      </configuration> 
      <!-- 
      <executions> 
         <execution> 
            <phase>install</phase> 
              <goals> 
                <goal>deploy</goal> 
              </goals> 
         </execution> 
       </executions> 
       --> 
  </plugin> 
   <!-- end-->
先打包生成demo.war,然后執(zhí)行>mvn com.oracle.weblogic:weblogic-maven-plugin:deploy
主要官方提供的命令是:mvn weblogic:deploy; 其實(shí)你敲這個(gè)命令你會(huì)發(fā)現(xiàn),他用的不是oracle的plugin
而是用的 org.codehaus.mojo的
此外如果需要提前命令,可以用help來查看,查看結(jié)果:
---
The following are the goals available currently in Maven
deploy
list-apps
redeploy
start-app
stop-app
undeploy
update-app
執(zhí)行成功后,回到weblogic的console臺(tái),你能發(fā)現(xiàn)你的war包,同時(shí)可以訪問看是否部署成功。
如果想直接一個(gè)命令部署怎么辦? 直接在mvn命令后面加上package
mvn package com.oracle.weblogic:weblogic-maven-plugin:deploy
但是他報(bào)錯(cuò):
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.oracle.weblogic:weblogic-maven-plugin:10.3.6.
0:deploy (default-cli) on project ep-easyui-webapp: weblogic.deploy.api.tools.de
ployer.DeployerException: Java heap space -> [Help 1]
[ERROR]
原因是jdk 內(nèi)存不夠
為mvn設(shè)置內(nèi)存,在maven.bat上加上
set MAVEN_OPTS=-Xdebug -Xnoagent -Xms256m -Xmx512m -Djava.compiler=NONE
這句話本身是@rem有。
然后直接
mvn package com.oracle.weblogic:weblogic-maven-plugin:deploy
就是能成功。
參考文獻(xiàn):
http://docs.oracle.com/cd/E24329_01/web.1211/e24443/maven_deployer.htm
主要10.3以后好像才有這個(gè)支持,另外12g和11g也有區(qū)別。


linugb118 2012-06-04 11:14 發(fā)表評(píng)論
]]>
mvn 打包問題2http://m.tkk7.com/linugb118/archive/2012/05/09/377675.htmllinugb118linugb118Wed, 09 May 2012 02:44:00 GMThttp://m.tkk7.com/linugb118/archive/2012/05/09/377675.htmlhttp://m.tkk7.com/linugb118/comments/377675.htmlhttp://m.tkk7.com/linugb118/archive/2012/05/09/377675.html#Feedback1http://m.tkk7.com/linugb118/comments/commentRss/377675.htmlhttp://m.tkk7.com/linugb118/services/trackbacks/377675.html調(diào)試maven時(shí)候,報(bào)錯(cuò)
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project ep-easyui-webapp: Could not resolve de
pendencies for project ep-easyui-webapp:ep-easyui-webapp:war:1.0-SNAPSHOT: The f
ollowing artifacts could not be resolved: javax.persistence:ejb:jar:3.0-public_r
eview, maven-plugins:maven-cobertura-plugin:plugin:1.3, maven-plugins:maven-find
bugs-plugin:plugin:1.3.1, persistence:persistence:jar:1: Failure to find javax.p
ersistence:ejb:jar:3.0-public_review in http://localhost:8081/nexus/content/grou
ps/EpPublic/ was cached in the local repository, resolution will not be reattemp
ted until the update interval of EpPublic has elapsed or updates are forced -> [
Help 1]
我在pom.xml 文件中添加
<dependency>
  <groupId>javax.persistence</groupId>
  <artifactId>ejb</artifactId>
  <version>3.0-public_review</version>
</dependency>
仍然抱這個(gè)錯(cuò),解決方法
1) Manually install this artifact into your local repo cache
2) Add an excludes and a corresponding dependency so you get a proper artifact
3) Stop depending on outdated Hibernate artifacts, I'd suggest
upgrading to this one:
http://repo2.maven.org/maven2/org/hibernate/hibernate-annotations/3.4.0.GA/
改成<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.4.0.GA</version>
</dependency>
同時(shí)把
<dependency>
  <groupId>javax.persistence</groupId>
  <artifactId>ejb</artifactId>
  <version>3.0-public_review</version>
</dependency>
去掉


linugb118 2012-05-09 10:44 發(fā)表評(píng)論
]]>
mvn 打包問題http://m.tkk7.com/linugb118/archive/2012/05/02/377162.htmllinugb118linugb118Wed, 02 May 2012 06:17:00 GMThttp://m.tkk7.com/linugb118/archive/2012/05/02/377162.htmlhttp://m.tkk7.com/linugb118/comments/377162.htmlhttp://m.tkk7.com/linugb118/archive/2012/05/02/377162.html#Feedback0http://m.tkk7.com/linugb118/comments/commentRss/377162.htmlhttp://m.tkk7.com/linugb118/services/trackbacks/377162.html通過mvn調(diào)用ant build.xml 文件

Mvn 命令出錯(cuò),出錯(cuò)信息:

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 1.013s

[INFO] Finished at: Wed May 02 13:36:28 CST 2012

[INFO] Final Memory: 3M/7M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:

run (compile) on project ep-cas-client: An Ant BuildException has occured: The f

ollowing error occurred while executing this line:

[ERROR] E:\casClient\build.xml:28: Unable to find a javac compiler;

[ERROR] com.sun.tools.javac.Main is not on the classpath.

[ERROR] Perhaps JAVA_HOME does not point to the JDK.

[ERROR] It is currently set to "D:\Java\jdk1.6.0_01\jre"

[ERROR] -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit

ch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please rea

d the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE

Xception

 

而直接 echo  %Java_Home%

得到:

D:\Java\jdk1.6.0_01

 

再直接mvn –version

Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800)

Maven home: D:\Java\apache-maven-3.0.4

Java version: 1.6.0_01, vendor: Sun Microsystems Inc.

Java home: D:\Java\jdk1.6.0_01\jre

Default locale: zh_CN, platform encoding: GBK

OS name: "windows vista", version: "6.1", arch: "x86", family: "windows"

 

發(fā)現(xiàn) 的確 mvn 指向的java home D:\Java\jdk1.6.0_01\jre

解決方法:

 

build.xml 文件中添加

<property name="build.compiler" value="extJavac"/>



linugb118 2012-05-02 14:17 發(fā)表評(píng)論
]]>
easiUi--datagrid中兩項(xiàng)相加點(diǎn)擊第三項(xiàng) 自動(dòng)獲取http://m.tkk7.com/linugb118/archive/2011/11/09/363307.htmllinugb118linugb118Wed, 09 Nov 2011 08:10:00 GMThttp://m.tkk7.com/linugb118/archive/2011/11/09/363307.htmlhttp://m.tkk7.com/linugb118/comments/363307.htmlhttp://m.tkk7.com/linugb118/archive/2011/11/09/363307.html#Feedback0http://m.tkk7.com/linugb118/comments/commentRss/363307.htmlhttp://m.tkk7.com/linugb118/services/trackbacks/363307.html 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <title>jQuery EasyUI</title>
 <link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
 <link rel="stylesheet" type="text/css" href="../themes/icon.css">
 <script type="text/javascript" src="../jquery-1.4.4.min.js"></script>
 <script type="text/javascript" src="../jquery.easyui.min.js"></script>
 <script>
  var products = [
      {productid:'FI-SW-01',name:'Koi'},
      {productid:'K9-DL-01',name:'Dalmation'},
      {productid:'RP-SN-01',name:'Rattlesnake'},
      {productid:'RP-LI-02',name:'Iguana'},
      {productid:'FL-DSH-01',name:'Manx'},
      {productid:'FL-DLH-02',name:'Persian'},
      {productid:'AV-CB-01',name:'Amazon Parrot'}
  ];
  function productFormatter(value){
   for(var i=0; i<products.length; i++){
    if (products[i].productid == value) return products[i].name;
   }
   return value;
  }

  function getSum()
  {
    alert(33);
  }  

  $(function () {
            var lastIndex;
            $('#tt').datagrid({
                url: 'webjson.ashx',
                title: 'Load Data ',
                iconCls: 'icon-save',
                singleSelect: true, 
                loadMsg: '數(shù)據(jù)加載中請(qǐng)稍后……',
                width: 600,
                height: 300,               
                columns: [[
                    { field: 'itemid', title: 'Item ID', width: 80 },
                    { field: 'productid', title: 'Product ID', width: 100 },
                    { field: 'listprice', title: 'List Price', width: 80, align: 'right', editor: "numberbox" }, //增加可編輯
                    { field: 'unitcost', title: 'Unit Cost', width: 80, align: 'right', editor: "numberbox" },//增加可編輯
                    { field: 'attr1', title: 'Attribute', width: 150, editor: "numberbox" },//這里雖為編輯類型,但是已經(jīng)修改源碼,成為不可以狀態(tài)
                    { field: 'status', title: 'Status', width: 60, align: 'center' }
                ]],
                pageSize: 5,
                pageList:[5,10,20,30],
                 pagination: true,
                rownumbers: true ,
toolbar:[{
     text:'append',
     iconCls:'icon-add',
     handler:function(){
     $('#tt').datagrid('endEdit', lastIndex);
      $('#tt').datagrid('appendRow',{
       itemid:'',
       productid:'',
       listprice:'',
       unitprice:'',
       attr1:'',
       status:'P'
      });
      var lastIndex = $('#tt').datagrid('getRows').length-1;
      $('#tt').datagrid('beginEdit', lastIndex);
     }
    }],
                onClickRow: function (rowIndex) {
                    if (lastIndex != rowIndex) {
                        $('#tt').datagrid('endEdit', lastIndex);
                        $('#tt').datagrid('beginEdit', rowIndex);
                        setEditing(rowIndex);
   //$('#tt').datagrid('refreshRow',rowIndex);

                    }
                    lastIndex = rowIndex;
                }
              
            });
        });
    
    
    
//具體實(shí)現(xiàn)方法
        function setEditing(rowIndex) {
            var editors = $('#tt').datagrid('getEditors', rowIndex);
            var priceEditor = editors[0];
            var amountEditor = editors[1];
            var sumcount = editors[2];
            sumcount.target.bind('click', function () {
               
                var sum = priceEditor.target.val()+amountEditor.target.val();
                alert(sum);
                sumcount.target.val(sum);
 
            });
           
        }

 
 </script>
</head>
<body>
 <h1>Editable DataGrid</h1>
 
 <table id="tt" style="width:650px;height:auto"
   title="Editable DataGrid" iconCls="icon-edit" singleSelect="true">
 </table>
 
</body>
</html>

 



linugb118 2011-11-09 16:10 發(fā)表評(píng)論
]]>
主站蜘蛛池模板: 国产成人亚洲精品91专区手机| 国产国产成年年人免费看片| 国产一区二区三区免费在线观看| 久久亚洲综合色一区二区三区| 国产成人精品亚洲2020| 日韩一级片免费观看| 久久www免费人成看片| heyzo亚洲精品日韩| 亚洲乱码卡三乱码新区| 一个人看的www在线免费视频| 久久WWW免费人成一看片| 国产亚洲色婷婷久久99精品91| 国产精品亚洲精品青青青 | 亚洲一区欧洲一区| 香蕉免费在线视频| 天天操夜夜操免费视频| 久久精品7亚洲午夜a| 亚洲精品美女久久久久久久| 无码成A毛片免费| 亚洲一级片免费看| 亚洲国产精品嫩草影院| 99在线在线视频免费视频观看| 亚洲伊人成无码综合网| 亚洲中文无码mv| 未满十八18禁止免费无码网站| 亚洲AⅤ优女AV综合久久久| 亚洲偷自精品三十六区| 日本高清免费观看| 亚洲一级片免费看| 亚洲AV无码精品国产成人| 国产h肉在线视频免费观看| 亚洲精品你懂的在线观看 | 亚洲av成人中文无码专区| h视频在线免费看| 亚洲成a人片在线观看无码| 日本免费精品一区二区三区| 成年人在线免费看视频| 亚洲永久中文字幕在线| 男人j进入女人j内部免费网站| 亚洲国产精品成人久久蜜臀| 亚洲一线产区二线产区区|