摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><script type="text/javascript">/** * 時間對象的格式化; */ Dat... 閱讀全文
隨筆分類
隨筆檔案
文章檔案
相冊
eclipse
- http://www.sinovision.net
摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><script type="text/javascript">/** * 時間對象的格式化; */ Dat... 閱讀全文
/db/flare/flare/bin/flared --daemonize --data-dir /db/flare/data/proxy/ --index-server-name 127.0.0.1 --index-server-port 12120 --server-name 127.0.0.1 --server-port 11211
/db/flare/flare/bin/flared --daemonize --data-dir /db/flare/data/master1/ --index-server-name 127.0.0.1 --index-server-port 12120 --server-name 127.0.0.1 --server-port 11212 /db/flare/flare/bin/flared --daemonize -f /db/flare/flare/etc/flare-proxy.conf data-dir = /db/flare/data/proxy index-server-name = localhost index-server-port = 12120 log-facility = local1 server-name = localhost server-port = 11211 [flare@server logs]# vi /etc/syslog.conf # falre logs local0.* /opt/logs/flare-index.log local2.* /opt/logs/flare-master.log local1.* /opt/logs/flare-proxy.log [flare@server flare]$ cd /opt/logs/ [flare@server logs]$ ll 總計 15836 -rw------- 1 flare flare 11889779 09-10 10:16 flare-index.log -rw------- 1 flare flare 23490 09-04 17:15 flare-master.log -rw------- 1 flare flare 4270801 09-10 09:55 flare-proxy.log 分析日志查詢為啥起不起來。 [flare@server logs]# tail -f flare-proxy.log 2.查看端口是否被占用 [flare@server logs]# lsof -i:11212 [flare@server logs]# lsof -i:11211 [flare@server logs]# lsof -i:11210 3.查看tmp臨時目錄文件是否正常 vi /db/flare/tmp/flare.xml 發現改文件損壞,從備份程序拷貝 cp /opt/flare/tmp/flare.xml /db/flare/tmp/ 啟動成功
cccccccccccccccccccccccccccccccccccccc
《蔡康永的說話之道》 1 private static String getMethodName(String fildeName){
2 byte[] items = fildeName.getBytes(); 3 items[0] = (byte)((char)items[0]-'a'+'A');; 4 return new String(items); 5 } 效率是最高的.
在開發環境,只能用localhost (本機機器名) 來訪問站點,因為在DotNet環境下,
域名的設置不能單單通過設置hosts文件實現,必須在IIS里面配置。 另外: <casClientConfig casServerLoginUrl="https://××××.net:8443/cas/login" casServerUrlPrefix="https://××××.net:8443/cas/" serverName="http://localhost:1054/CasTest" 如果serverName 配置不當也會導致循環重定向。 在確定 <sessionState mode="StateServer" cookieless="UseCookies" timeout="36000"></sessionState> CasAuthentication.cs internal static void ProcessRequestAuthentication() { HttpContext context = HttpContext.Current; // Look for a valid FormsAuthenticationTicket encrypted in a cookie. CasAuthenticationTicket casTicket = null; FormsAuthenticationTicket formsAuthenticationTicket = GetFormsAuthenticationTicket(); if (formsAuthenticationTicket != null) { ICasPrincipal principal; if (ServiceTicketManager != null) { string serviceTicket = formsAuthenticationTicket.UserData; casTicket = ServiceTicketManager.GetTicket(serviceTicket); if (casTicket != null) { IAssertion assertion = casTicket.Assertion; if (!ServiceTicketManager.VerifyClientTicket(casTicket)) { Trace.WriteLine(String.Format("{0}:Ticket failed verification." + Environment.NewLine, CommonUtils.MethodName)); 這里是調試的斷點設置。
catalina.sh
JAVA_OPTS="$JAVA_OPTS -server -Xverify:none -XX:+UseParallelGC -XX:PermSize=20M -Xms2200m -Djava.rmi.server.hostname=172.16.4.200 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9004 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" 增加一行配置. 可以使用jconsole 來遠程連接,查看內存使用.服務器端,應用所需的內存,最好一次申請到位,即使不用也要占著 參考 http://gwt-ext.com/forum/viewtopic.php?t=1682 import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; @RemoteServiceRelativePath("sessout") public interface MyService extends RemoteService { public Integer getUserSessionTimeoutMillis(); } import com.google.gwt.user.client.rpc.AsyncCallback; public interface MyServiceAsync { void getUserSessionTimeoutMillis(AsyncCallback async); } import com.google.gwt.user.server.rpc.RemoteServiceServlet; @SuppressWarnings("serial") public class MyServiceImpl extends RemoteServiceServlet implements MyService { public Object getLoggedInUser() { return getThreadLocalRequest().getSession().getAttribute(EConstants.USER); } /** * Should be the first RPC call from all UIDef*.onModuleLoad() * * @return java.lang.Integer (-1 if the user session has already timed out, * otherwise, the number of milliseconds) */ public Integer getUserSessionTimeoutMillis() { Integer returnObj = null; if (getLoggedInUser() != null) { returnObj = new Integer(EduConstants.SESSION_TIMEOUT_MILLIS); // milliseconds } else { returnObj = new Integer(-1); } return returnObj; } } public class EConstants { public static final String USER = "sessuser"; public static final int SESSION_TIMEOUT_MILLIS = 1800; // 30 minute } web.xml <servlet> <servlet-name>sessServlet</servlet-name> <servlet-class>com.chinaedu.edupass.server.MyServiceImpl</servlet-class> </servlet> <servlet-mapping> <servlet-name>sessServlet</servlet-name> <url-pattern>/ldapmanager/sessout</url-pattern> </servlet-mapping> public class LManager implements EntryPoint { private Timer sessionTimeoutTimer = null; private MyServiceAsync service; public void onModuleLoad() { service = (MyServiceAsync) GWT.create(MyService.class); showLogin(); private void showLogin() { final LoginDialog dialog = new LoginDialog() { protected void showMainView() { super.showMainView(); doShowMainView(); // 登錄后開始計時 initSessionTimers(); } }; dialog.setAutoCenter(true); dialog.setIsModal(true); dialog.setShowHeader(false); dialog.setShowToolbar(false); dialog.setEdgeSize(10); dialog.setWidth(300); dialog.setHeight(180); dialog.show(); } private void doShowMainView() { }/** * 客戶端在超時后執行跳轉登錄 * * @sessionTimeInMillis Integer */ private void initSessionTimers() { // Allow 30 seconds to get the RPC call constructed and called. sessionTimeoutTimer = new Timer() { public void run() { service.getUserSessionTimeoutMillis(new AsyncCallback() { public void onSuccess(Object result) { int sessionTimeMillis = ((Integer) result).intValue(); if (sessionTimeMillis == -1) { // 超時后執行跳轉到登錄窗口 displaySessionTimedOut(); } else { sessionTimeoutTimer.cancel(); initSessionTimers(); } } public void onFailure(final Throwable caught) { SC.say(LdapI18N.ldapMessages().failed()); } }); } }; // 31 minutes 服務器端設置為30分鐘超時,如果30分鐘沒有操作 // 就會返回超時,如果期間有操作,則在等31分鐘后再輪詢 sessionTimeoutTimer.schedule(31*60*1000); } private void displaySessionTimedOut() { SC.say(LI18N.ldapMessages().sessionTimeOut(), new BooleanCallback() { public void execute(Boolean value) { showLogin(); } }); }
GWT SmartGWT
1.發布到Tomcat/Jetty. 在發布之前需要使用Eclipse中的GWT-Compile 選中工程->右鍵菜單-Google-GWT Comile 編譯后的文件在/war 目錄下面,拷貝此文件到Tomcat的Webapp下面就可以訪問了。 2.SmartGWT的可用性和GXT相比,差別巨大。 GXT前端展示非常成熟,具體表現:a.Grid 控件、表單。而SmartGWT 的GridList控件非常簡單,甚至不支持分頁,要自己DIY。 不推薦使用SmartGWT做項目。 3.開發上可以只用GWT做前端,使用Hessian來調用另外一個工程的Service,Hessian調用servlet已經封裝的很好。 在開發上要分為兩個工程:Project-webapp Project-GWT. 4.編譯后的文件體積有點龐大,至少50M。 5.具體開發細節可以參<<GWT揭秘>>,里面有很多最佳實踐,另外不要吝嗇銀子,最好使用GXT。 安裝Maven后每次啟動出現警告信息:
直接創建一個快捷方式,加入啟動參數 -vm D:\server\jdk1.6.0_21\bin\javaw 修改eclipse.ini好多次都不成功。 參考幫助文檔: eclipse -vm c:\jdk1.4.2\jre\bin\javaw |