锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲偷自精品三十六区,亚洲日本一区二区一本一道 ,亚洲一级特黄特黄的大片http://www.tkk7.com/justinlei/zh-cnSat, 10 May 2025 00:38:55 GMTSat, 10 May 2025 00:38:55 GMT60鑾峰彇IPV4鍦板潃鑼冨洿鍐呯殑鎵鏈夊湴鍧http://www.tkk7.com/justinlei/archive/2011/12/04/365486.htmlJustinLeiJustinLeiSat, 03 Dec 2011 19:08:00 GMThttp://www.tkk7.com/justinlei/archive/2011/12/04/365486.htmlhttp://www.tkk7.com/justinlei/comments/365486.htmlhttp://www.tkk7.com/justinlei/archive/2011/12/04/365486.html#Feedback0http://www.tkk7.com/justinlei/comments/commentRss/365486.htmlhttp://www.tkk7.com/justinlei/services/trackbacks/365486.html
import java.net.Inet4Address;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 
@author justinlei (justinlei@gmail.com)
 * @date Nov 17, 2011
 * 
@version 1.0
 
*/
public class InetAddressUtil {
    
public static void main(String[] args) throws Exception {
        Inet4Address start 
= (Inet4Address)Inet4Address.getByName("172.20.0.254");
        Inet4Address end 
= (Inet4Address)Inet4Address.getByName("172.20.10.1");
        List
<byte[]> list = getRangeIps(null,start.getAddress(), end.getAddress());
        
for (byte[] bs : list) {
            System.out.println(InetAddress.getByAddress(bs).getHostAddress());
        }
    }
    
    
public static List<byte[]> getRangeIps(List<byte[]> list,byte[] addrBytes,byte[] endBytes) throws Exception {
        
byte[] _b = new byte[addrBytes.length];
        System.arraycopy(addrBytes, 
0, _b, 0, addrBytes.length);
        
if(_b[3== -1)
            _b[
3= -2;
        
if(list == null) {
            list 
= new ArrayList<byte[]>();
            list.add(_b);
        }
        
if(list.size() == 5000)
            
return list;
        
if(addrBytes[2== -1 && addrBytes[3== -2)
            
return list;
        
if(Arrays.equals(addrBytes, endBytes)) {
            
return list;
        }
        
int lastpart = addrBytes[addrBytes.length - 1];
        
if(lastpart != -2) {
            addrBytes[addrBytes.length 
- 1= (byte)(addrBytes[3+ 1);
            _b 
= new byte[addrBytes.length];
            System.arraycopy(addrBytes, 
0, _b, 0, addrBytes.length);
            list.add(_b);
        } 
else if(lastpart == -2) {
            addrBytes[addrBytes.length 
- 1= 1;
            list.add(plus(addrBytes, addrBytes.length 
- 2));
        }
//        System.out.println(InetAddress.getByAddress(addrBytes).getHostAddress());
        return getRangeIps(list,addrBytes, endBytes);
    }
    
    
public static byte[] plus(byte[] addrBytes,int index) throws Exception {
        
if(index == 0)
            
return addrBytes;
        
int pluspart = addrBytes[index];
        
if(pluspart != -2) {
            addrBytes[index] 
= (byte)(pluspart + 1);
            
for (int i = index + 1; i < addrBytes.length - 1; i++) {
                addrBytes[i] 
= 0;
            }
            
byte[] _b = new byte[addrBytes.length];
            System.arraycopy(addrBytes, 
0, _b, 0, addrBytes.length);
            
return _b;
        } 
else {
            
byte[] _b = new byte[addrBytes.length];
            System.arraycopy(addrBytes, 
0, _b, 0, addrBytes.length);
            
return plus(_b, index -1);
        }
    }
}


JustinLei 2011-12-04 03:08 鍙戣〃璇勮
]]>
Java NTP 瀹㈡埛绔崗璁疄鐜?/title><link>http://www.tkk7.com/justinlei/archive/2011/12/04/365485.html</link><dc:creator>JustinLei</dc:creator><author>JustinLei</author><pubDate>Sat, 03 Dec 2011 18:54:00 GMT</pubDate><guid>http://www.tkk7.com/justinlei/archive/2011/12/04/365485.html</guid><wfw:comment>http://www.tkk7.com/justinlei/comments/365485.html</wfw:comment><comments>http://www.tkk7.com/justinlei/archive/2011/12/04/365485.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/justinlei/comments/commentRss/365485.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/justinlei/services/trackbacks/365485.html</trackback:ping><description><![CDATA[<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: #008000; "></span><span style="color: #000000; "></span><span style="color: #0000FF; "></span><span style="color: #0000FF; ">import</span><span style="color: #000000; "> java.io.InputStream;<br /></span><span style="color: #0000FF; ">import</span><span style="color: #000000; "> java.net.Socket;<br /><br /></span><span style="color: #008000; ">/**</span><span style="color: #008000; "><br /> * <br /> * </span><span style="color: #808080; ">@author</span><span style="color: #008000; "> ray (justinlei@gmail.com)<br /> * @date 2009-8-27<br /> * </span><span style="color: #808080; ">@version</span><span style="color: #008000; "> 1.0<br /> </span><span style="color: #008000; ">*/</span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">class</span><span style="color: #000000; "> TimeUtil {<br />    </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">final</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> DEFAULT_PORT </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">37</span><span style="color: #000000; ">;<br />    </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">final</span><span style="color: #000000; "> String DEFAULT_HOST </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">"</span><span style="color: #000000; ">time-nw.nist.gov</span><span style="color: #000000; ">"</span><span style="color: #000000; ">;<br />    </span><span style="color: #0000FF; ">private</span><span style="color: #000000; "> TimeUtil() {<br />    };<br /><br />    </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">long</span><span style="color: #000000; "> currentTimeMillis(Boolean sync) {<br />        </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (sync </span><span style="color: #000000; ">!=</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">null</span><span style="color: #000000; "> </span><span style="color: #000000; ">&&</span><span style="color: #000000; "> sync.booleanValue() </span><span style="color: #000000; ">!=</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">true</span><span style="color: #000000; ">)<br />            </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> System.currentTimeMillis();<br />        </span><span style="color: #0000FF; ">try</span><span style="color: #000000; "> {<br />            </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> syncCurrentTime();<br />        } </span><span style="color: #0000FF; ">catch</span><span style="color: #000000; "> (Exception e) {<br />            </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> System.currentTimeMillis();<br />        }<br />    }<br /><br />    </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">long</span><span style="color: #000000; "> syncCurrentTime()  </span><span style="color: #0000FF; ">throws</span><span style="color: #000000; "> Exception {<br />        </span><span style="color: #008000; ">//</span><span style="color: #008000; "> The time protocol sets the epoch at 1900,<br />        </span><span style="color: #008000; ">//</span><span style="color: #008000; "> the java Date class at 1970. This number<br />        </span><span style="color: #008000; ">//</span><span style="color: #008000; "> converts between them.</span><span style="color: #008000; "><br /></span><span style="color: #000000; ">        </span><span style="color: #0000FF; ">long</span><span style="color: #000000; "> differenceBetweenEpochs </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">2208988800L</span><span style="color: #000000; ">;<br /><br />        </span><span style="color: #008000; ">//</span><span style="color: #008000; "> If you'd rather not use the magic number uncomment<br />        </span><span style="color: #008000; ">//</span><span style="color: #008000; "> the following section which calculates it directly.</span><span style="color: #008000; "><br /></span><span style="color: #000000; "><br />        </span><span style="color: #008000; ">/*</span><span style="color: #008000; "><br />         * TimeZone gmt = TimeZone.getTimeZone("GMT"); Calendar epoch1900 =<br />         * Calendar.getInstance(gmt); epoch1900.set(1900, 01, 01, 00, 00, 00);<br />         * long epoch1900ms = epoch1900.getTime().getTime(); Calendar epoch1970<br />         * = Calendar.getInstance(gmt); epoch1970.set(1970, 01, 01, 00, 00, 00);<br />         * long epoch1970ms = epoch1970.getTime().getTime();<br />         * <br />         * long differenceInMS = epoch1970ms - epoch1900ms; long<br />         * differenceBetweenEpochs = differenceInMS/1000;<br />         </span><span style="color: #008000; ">*/</span><span style="color: #000000; "><br /><br />        InputStream raw </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">null</span><span style="color: #000000; ">;<br />        </span><span style="color: #0000FF; ">try</span><span style="color: #000000; "> {<br />            Socket theSocket </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> Socket(DEFAULT_HOST, DEFAULT_PORT);<br />            raw </span><span style="color: #000000; ">=</span><span style="color: #000000; "> theSocket.getInputStream();<br /><br />            </span><span style="color: #0000FF; ">long</span><span style="color: #000000; "> secondsSince1900 </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />            </span><span style="color: #0000FF; ">for</span><span style="color: #000000; "> (</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> i </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">; i </span><span style="color: #000000; "><</span><span style="color: #000000; "> </span><span style="color: #000000; ">4</span><span style="color: #000000; ">; i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">) {<br />                secondsSince1900 </span><span style="color: #000000; ">=</span><span style="color: #000000; "> (secondsSince1900 </span><span style="color: #000000; "><<</span><span style="color: #000000; "> </span><span style="color: #000000; ">8</span><span style="color: #000000; ">) </span><span style="color: #000000; ">|</span><span style="color: #000000; "> raw.read();<br />            }<br />            </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (raw </span><span style="color: #000000; ">!=</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">null</span><span style="color: #000000; ">)<br />                raw.close();<br />            </span><span style="color: #0000FF; ">long</span><span style="color: #000000; "> secondsSince1970 </span><span style="color: #000000; ">=</span><span style="color: #000000; "> secondsSince1900 </span><span style="color: #000000; ">-</span><span style="color: #000000; "> differenceBetweenEpochs;<br />            </span><span style="color: #0000FF; ">long</span><span style="color: #000000; "> msSince1970 </span><span style="color: #000000; ">=</span><span style="color: #000000; "> secondsSince1970 </span><span style="color: #000000; ">*</span><span style="color: #000000; "> </span><span style="color: #000000; ">1000</span><span style="color: #000000; ">;<br />            </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> msSince1970;<br />        } </span><span style="color: #0000FF; ">catch</span><span style="color: #000000; "> (Exception e) {<br />            </span><span style="color: #0000FF; ">throw</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> Exception(e);<br />        }<br />    }<br />}<br /></span></div><img src ="http://www.tkk7.com/justinlei/aggbug/365485.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/justinlei/" target="_blank">JustinLei</a> 2011-12-04 02:54 <a href="http://www.tkk7.com/justinlei/archive/2011/12/04/365485.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>NMEA GPS璁懼(涓插彛)鎵弿瀹炰緥 GPSSerialPortScanerhttp://www.tkk7.com/justinlei/archive/2010/04/06/317569.htmlJustinLeiJustinLeiTue, 06 Apr 2010 08:47:00 GMThttp://www.tkk7.com/justinlei/archive/2010/04/06/317569.htmlhttp://www.tkk7.com/justinlei/comments/317569.htmlhttp://www.tkk7.com/justinlei/archive/2010/04/06/317569.html#Feedback0http://www.tkk7.com/justinlei/comments/commentRss/317569.htmlhttp://www.tkk7.com/justinlei/services/trackbacks/317569.html1.Library:RXTXComm.jar



/*

 * GPSSerialPortScaner.java
 * Copyright (C) 2009  <JustinLei@gmail.com>
 *
 *        This program is free software; you can redistribute it and/or modify
 *        it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *     (at your option) any later version.
 *
 *       This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *        GNU General Public License for more details.
 *
 
*/
package org.lambdasoft.serial.gps;
import gnu.io.CommPort;
import gnu.io.CommPortIdentifier;
import gnu.io.PortInUseException;
import gnu.io.SerialPort;
import gnu.io.UnsupportedCommOperationException;

import java.io.InputStream;
import java.util.Enumeration;

import org.lambdasoft.ui.dialog.BubbleDialog;
import org.lambdasoft.ui.systray.statusbar.StatusBar;
import org.lambdasoft.util.StringUtils;

/**
 * 
@author lei.tang (justinlei@gmail.com)
 * @date 2010-3-8
 * 
@version
 
*/
public class GPSSerialPortScaner {
    
private static GPSSerialPortScaner finder;
    
private static final int SCANTIME = 2000;
    
private static final int[] PORTSPEED = new int[]{4800,9600};
    
private GPSSerialPortScaner() {}
    
    
public static GPSSerialPortScaner getScaner() {
        
if(finder == null)
            finder 
= new GPSSerialPortScaner();
        
return finder;
    }

    
public String scan() {
        BubbleDialog.getBubble().display(
"GPS璁懼鑷姩鎼滅儲涓?/span>",false,false);
        
for (int speed : PORTSPEED) {
            String port 
= scan(speed);
            
if(StringUtils.isNotEmpty(port))
                
return port;
        }
        
return null;
    }
    
    @SuppressWarnings(
"unchecked")
    
public String scan(Integer speed) {
        StatusBar statusBar 
= StatusBar.getBar();
        Enumeration
<CommPortIdentifier> commons = CommPortIdentifier.getPortIdentifiers();
        CommPortIdentifier com 
= null;
        CommPort serialPort 
= null;
        
while (commons.hasMoreElements()) {
            com 
= commons.nextElement();
            
if(statusBar != null)
                statusBar.setGPSInfo(
"鎵弿GPS璁懼:" + com.getName() + " 鎵弿閫熺巼:" + speed);
            
try {
                serialPort 
= com.open("PortOpener"10);
            } 
catch (PortInUseException piue) {
                serialPort 
= null;
                
continue;
            }
            
if (com.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                SerialPort sp 
= (SerialPort) serialPort;
                
try {
                    
// Settings for B&G Hydra
                    sp.setSerialPortParams(speed.intValue(), SerialPort.DATABITS_8,
                            SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
                } 
catch (UnsupportedCommOperationException ucoe) {
                    serialPort 
= null;
                    
continue;
                }
            }
            
try {
                InputStream input 
= serialPort.getInputStream();
                
int readChar = -1;
                
long currentTime = System.currentTimeMillis();
                
while((System.currentTimeMillis() - currentTime) <= SCANTIME) {
                    
if((readChar = input.read()) == -1) {
                        
continue;
                    }
                    
if((char)readChar == '$') {
                        StringBuilder builder 
= new StringBuilder();
                        
for (int j = 0; j < 5; j++) {
                            builder.append((
char)(input.read()));
                        }
                        String head 
= builder.toString();
                        
if(head.equals("GPGGA")) {
                            serialPort.close();
                            
if(statusBar != null) {
                                String successMsg 
= "GPS璁懼鍦ㄧ鍙?/span>" + com.getName() +"鍒濆鍖栨垚鍔?閫熺巼: " + speed;
                                BubbleDialog.getBubble().display(successMsg,
false,true);
                                statusBar.setGPSInfo(successMsg);
                            }
                            
return com.getName();
                        }
                    }
                }
            } 
catch (Exception e) {
                
return null;
            }
            serialPort.close();
        }
        
if(serialPort != null)
            serialPort.close();
        
return null;
    }
}


JustinLei 2010-04-06 16:47 鍙戣〃璇勮
]]>
JMF璁懼鍦ㄧ▼搴忚嚜鍔ㄦ敞鍐岀殑渚嬪瓙DevicesAutoRegisterhttp://www.tkk7.com/justinlei/archive/2010/04/06/317567.htmlJustinLeiJustinLeiTue, 06 Apr 2010 08:35:00 GMThttp://www.tkk7.com/justinlei/archive/2010/04/06/317567.htmlhttp://www.tkk7.com/justinlei/comments/317567.htmlhttp://www.tkk7.com/justinlei/archive/2010/04/06/317567.html#Feedback0http://www.tkk7.com/justinlei/comments/commentRss/317567.htmlhttp://www.tkk7.com/justinlei/services/trackbacks/317567.html/*
 * DevicesAutoRegister.java
 * Copyright (C) 2009  <JustinLei@gmail.com>
 *
 *        This program is free software; you can redistribute it and/or modify
 *        it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *     (at your option) any later version.
 *
 *       This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *        GNU General Public License for more details.
 *
 
*/
package org.lambdasoft.device.jmf;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

import org.lambdasoft.ui.dialog.BubbleDialog;

import com.sun.media.util.Registry;

/**
 * 
@author lei.tang (justinlei@gmail.com)
 * @date 
 * 
@version
 
*/
public class DevicesAutoRegister {
    
private static DevicesAutoRegister autoRegister;
    
    
private DevicesAutoRegister() {
    }
     
    
public static final DevicesAutoRegister getRegister() {
        
if(autoRegister == null)
            autoRegister 
= new DevicesAutoRegister();
        
return autoRegister;
    }
    
    
public boolean regist(String args[]) throws IOException {
//鏌ユ壘璁懼娉ㄥ唽鏂囦歡鍦╦mf.jar鍚岀駭鐩綍
        File jarFile 
= new File(Registry.class.getProtectionDomain().getCodeSource().getLocation().getFile());
        File confFile 
= new File(jarFile.getParent() + File.separator + "jmf.properties");
        
if(confFile.exists()) {
            
return true;
        }
        writeConfigOrig(confFile);
        
return _regist(args == null ? new String[0] : args);
    }
    
    
private boolean _regist(String args[]){
        BubbleDialog.getBubble().display(
"娌℃湁鎵懼埌璁懼,寮濮嬫敞鍐岃棰戦噰闆嗚澶?/span>",false,false);
        JMFInit jmfInit 
= new JMFInit(args);
        
boolean flag = jmfInit.isInitialError();
        jmfInit.dispose();
        
if(flag != true)
            BubbleDialog.getBubble().display(
"瑙嗛閲囬泦璁懼娉ㄥ唽瀹屾瘯",false,true);
        
else 
            BubbleDialog.getBubble().display(
"瑙嗛閲囬泦璁懼娉ㄥ唽澶辮觸,紼嬪簭灝嗛鍑?/span>",true,true);
        
return !flag;
    }
    
    //鍐欏叆絀虹殑娉ㄥ唽鏂囦歡(JMF Configure Serializable Object)
    
private void writeConfigOrig(File file) throws IOException{
        InputStream is 
= DevicesAutoRegister.class.getResourceAsStream("jmf.properties.orig");
        
byte[] buff = new byte[1024];
        FileOutputStream os 
= new FileOutputStream(file);
        
while(is.read(buff) != -1) {
            os.write(buff);
        }
        os.flush();
        os.close();
        is.close();
    }
}


JustinLei 2010-04-06 16:35 鍙戣〃璇勮
]]>
apache commons httpclienthttp://www.tkk7.com/justinlei/archive/2010/04/06/317566.htmlJustinLeiJustinLeiTue, 06 Apr 2010 08:29:00 GMThttp://www.tkk7.com/justinlei/archive/2010/04/06/317566.htmlhttp://www.tkk7.com/justinlei/comments/317566.htmlhttp://www.tkk7.com/justinlei/archive/2010/04/06/317566.html#Feedback2http://www.tkk7.com/justinlei/comments/commentRss/317566.htmlhttp://www.tkk7.com/justinlei/services/trackbacks/317566.html
package org.lambdasoft.http;

import java.util.Map;

/**
 * 
@author lei.tang (justinlei@gmail.com)
 * @date 
 * 
@version
 
*/
public interface HttpRequest {
    String execute(String url,Map
<String, String> params) throws Exception;
}

package org.lambdasoft.http;

import java.util.Map;
import java.util.Set;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;

/**
 * 
@author lei.tang (justinlei@gmail.com)
 * @date 
 * 
@version
 
*/
public class GetRequest implements HttpRequest{

    @Override
    
public String execute(String url, Map<String, String> params) throws Exception {
        HttpClient client 
= new HttpClient();
        GetMethod getMethod 
= new GetMethod(url);
        
if(params != null && params.size() != 0) {
            Set
<String> keySet = params.keySet();
            NameValuePair[] nameValuePairs 
= new NameValuePair[params.size()];
            
int i = 0;
            
for (String key : keySet) {
                nameValuePairs[i] 
= new NameValuePair(key, params.get(key));
                i
++;
            }
            getMethod.setQueryString(nameValuePairs);
        }
        
int statusCode = client.executeMethod(getMethod);
        
if (statusCode != HttpStatus.SC_OK) {
            
throw new Exception(getMethod.getStatusLine().toString());
        }
        
return new String(getMethod.getResponseBody());
    }
}




package org.lambdasoft.http;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;

/**
 * 
@author lei.tang (justinlei@gmail.com)
 * @date 
 * 
@version
 
*/
public class PostRequest implements HttpRequest{

    @Override
    
public String execute(String url, Map<String, String> params)
            
throws Exception {
        HttpClient client 
= new HttpClient();
        PostMethod postMethod 
= new PostMethod(url);
        
        
if(params != null && params.size() != 0) {
            Set
<String> keySet = params.keySet();
            NameValuePair[] nameValuePairs 
= new NameValuePair[params.size()];
            
int i = 0;
            
for (String key : keySet) {
                nameValuePairs[i] 
= new NameValuePair(key, params.get(key));
                i
++;
            }
            postMethod.setQueryString(nameValuePairs);
        }
        
int statusCode = client.executeMethod(postMethod);
        
if (statusCode != HttpStatus.SC_OK) {
            
throw new Exception(postMethod.getStatusLine().toString());
        }
        
return new String(postMethod.getResponseBody());
    }

}


JustinLei 2010-04-06 16:29 鍙戣〃璇勮
]]>
鏂囦歡宸ュ叿綾籉ileUtilhttp://www.tkk7.com/justinlei/archive/2009/12/18/306587.htmlJustinLeiJustinLeiFri, 18 Dec 2009 08:40:00 GMThttp://www.tkk7.com/justinlei/archive/2009/12/18/306587.htmlhttp://www.tkk7.com/justinlei/comments/306587.htmlhttp://www.tkk7.com/justinlei/archive/2009/12/18/306587.html#Feedback1http://www.tkk7.com/justinlei/comments/commentRss/306587.htmlhttp://www.tkk7.com/justinlei/services/trackbacks/306587.html/*
 * FileUtil.java
 * Copyright (C) 2007-3-19  <JustinLei@gmail.com>
 *
 *        This program is free software; you can redistribute it and/or modify
 *        it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *     (at your option) any later version.
 *
 *       This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *        GNU General Public License for more details.
 *
 
*/
package org.lambdasoft.utils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.InputStream;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
import java.util.Set;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * 鏂囦歡宸ュ叿綾?br />  * 
 * 
@author TangLei <justinlei@gmail.com>
 * @date 2009-2-24
 
*/
public class FileUtil {
    
private static Log log = LogFactory.getLog(FileUtil.class);
    
private FileUtil() {}
    
    
/**
     * 鑾峰彇闅忔満鐨勬枃浠跺悕縐?br />      * 
@param seed    闅忔満縐嶅瓙
     * 
@return
     
*/
    
public static String getRandomFileName(String seed) {
        
byte[] ra = new byte[100];
        
new Random().nextBytes(ra);
        StringBuilder build 
= new StringBuilder("");
        
for (int i = 0; i < ra.length; i++) {
            build.append(Byte.valueOf(ra[i]).toString());
        }
        String currentDate 
= Long.valueOf(new Date().getTime()).toString();
        seed 
= seed + currentDate + build.toString();
        
return EncryptUtils.getMD5ofStr(seed).toLowerCase();
    }
    
    
/**
     * 鍒楀嚭鎵鏈夊綋鍓嶅眰鐨勬枃浠跺拰鐩綍
     * 
     * 
@param dir            鐩綍鍚嶇О
     * 
@return fileList    鍒楀嚭鐨勬枃浠跺拰鐩綍
     
*/
    
public static File[] ls(String dir) {
        
return new File(dir).listFiles();
    }
    
    
/**
     * 鏍規嵁闇瑕佸垱寤烘枃浠跺す
     * 
     * 
@param dirPath 鏂囦歡澶硅礬寰?br />      * @param del    瀛樺湪鏂囦歡澶規槸鍚﹀垹闄?br />      */
    
public static void mkdir(String dirPath,boolean del) {
        File dir 
= new File(dirPath);
        
if(dir.exists()) {
            
if(del)
                dir.delete();
            
else return;
        }
        dir.mkdirs();
    }
    
    
/**
     * 鍒犻櫎鏂囦歡鍜岀洰褰?br />      * 
     * 
@param path
     * 
@throws Exception
     
*/
    
public static void rm(String path) throws Exception{
        
if(log.isDebugEnabled())
            log.debug(
"闇瑕佸垹闄ょ殑鏂囦歡: " + path);
        File file 
= new File(path);
        
if(!file.exists()) {
            
if(log.isWarnEnabled())
                log.warn(
"鏂囦歡<" + path + ">涓嶅瓨鍦?/span>");
            
return;
        }
        
if(file.isDirectory()) {
            File[] fileList 
= file.listFiles();
            
if(fileList == null || fileList.length == 0) {
                file.delete();
            } 
else {
                
for (File _file : fileList) {
                    rm(_file.getAbsolutePath());
                }
            }
        file.delete();
        } 
else {
            file.delete();
        }
    }
    
    
/**
     * 縐誨姩鏂囦歡
     * 
     * 
@param source     婧愭枃浠?br />      * @param target         鐩爣鏂囦歡
     * 
@param cache        鏂囦歡緙撳瓨澶у皬
     * 
@throws Exception
     
*/
    
public static void mv(String source,String target,int cache) throws Exception {
        
if(source.trim().equals(target.trim()))
            
return;
        
byte[] cached = new byte[cache];
        FileInputStream fromFile 
= new FileInputStream(source);
        FileOutputStream toFile 
= new FileOutputStream(target);
        
while(fromFile.read(cached) != -1) {
            toFile.write(cached);
        }
        toFile.flush();
        toFile.close();
        fromFile.close();
        
new File(source).deleteOnExit();
    }
    
    
/**
     * 鎶婂睘鎬ф枃浠惰漿鎹㈡垚Map
     * 
     * 
@param propertiesFile
     * 
@return
     * 
@throws Exception
     
*/
    
public static final Map<String, String> getPropertiesMap(String propertiesFile) throws Exception{
        Properties properties 
= new Properties();
        FileInputStream inputStream 
= new FileInputStream(propertiesFile);
        properties.load(inputStream);
        Map
<String, String> map = new HashMap<String, String>();
        Set
<Object> keySet = properties.keySet();
        
for (Object key : keySet) {
            map.put((String)key, properties.getProperty((String)key));
        }
        
return map;
    }
    
    @SuppressWarnings(
"unchecked")
    
public static final Map<String, String> getPropertiesMap(Class clazz,String fileName) throws Exception{
        Properties properties 
= new Properties();
        InputStream inputStream 
= clazz.getResourceAsStream(fileName);
        
if(inputStream == null)
            inputStream 
= clazz.getClassLoader().getResourceAsStream(fileName);
        properties.load(inputStream);
        Map
<String, String> map = new HashMap<String, String>();
        Set
<Object> keySet = properties.keySet();
        
for (Object key : keySet) {
            map.put((String)key, properties.getProperty((String)key));
        }
        
return map;
    }
    
    
/**
     * 鎶婂睘鎬ф枃浠惰漿鎹㈡垚Map
     * 
     * 
@param inputStream
     * 
@return
     * 
@throws Exception
     
*/
    
public static final Map<String, String> getPropertiesMap(InputStream inputStream) throws Exception{
        Properties properties 
= new Properties();
        properties.load(inputStream);
        Map
<String, String> map = new HashMap<String, String>();
        Set
<Object> keySet = properties.keySet();
        
for (Object key : keySet) {
            map.put((String)key, properties.getProperty((String)key));
        }
        
return map;
    }
    
    
/**
     * 鎶婃枃鏈枃浠惰漿鎹㈡垚String
     * 
     * 
@param fullPath
     * 
@return
     * 
@throws Exception
     
*/
    
public static String readFile(String fullPath) throws Exception{
        BufferedReader reader 
= new BufferedReader(new FileReader(fullPath));
        
if(reader == null)
            
return null;
        StringBuilder builder 
= new StringBuilder("");
        String line 
= null;
        
while((line = reader.readLine()) != null) {
            builder.append(line 
+ "\n");
        }
        
return builder.toString();
    }
    
    
/**
     * 鑾峰彇璧勬簮鏂囦歡嫻?br />      * 
     * 
@param clazz
     * 
@param name
     * 
@return
     
*/
    @SuppressWarnings(
"unchecked")
    
public static InputStream getResourceAsStream(Class clazz,String name) {
        
try {
            InputStream inputStream 
= clazz.getResourceAsStream(name);
            
if(inputStream == null
                inputStream 
= clazz.getClassLoader().getResourceAsStream(name);
            
return inputStream;
        } 
catch (Exception e) {
            
if(log.isWarnEnabled())
                log.warn(
"鑾峰彇璧勬簮鏂囦歡澶辮觸", e);
            
return null;
        }
    }
}


JustinLei 2009-12-18 16:40 鍙戣〃璇勮
]]>
Java Web宸ュ叿SessionTickhttp://www.tkk7.com/justinlei/archive/2009/12/18/306586.htmlJustinLeiJustinLeiFri, 18 Dec 2009 08:37:00 GMThttp://www.tkk7.com/justinlei/archive/2009/12/18/306586.htmlhttp://www.tkk7.com/justinlei/comments/306586.htmlhttp://www.tkk7.com/justinlei/archive/2009/12/18/306586.html#Feedback0http://www.tkk7.com/justinlei/comments/commentRss/306586.htmlhttp://www.tkk7.com/justinlei/services/trackbacks/306586.htmlpackage org.lambdasoft.web.support;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.lambdasoft.web.Enviroment;

public class SessionSupport {
    
private SessionSupport() {}
    
    
/**
     * 鑾峰彇褰撳墠鐢ㄦ埛Session
     * 
     * 
@return httpSession
     
*/
    
public final static HttpSession getSession() {
        
return ServletActionContext.getRequest().getSession();
    }
    
    @SuppressWarnings(
"unchecked")
    
public final static void removeAllSession(HttpSession session) {
        
if(session == null)
            
return;
        Enumeration names 
= session.getAttributeNames();
        
if(names == null)
            
return;
        List
<String> sessionNamesList = new ArrayList<String>();
        
while (names.hasMoreElements()) 
            sessionNamesList.add((String)names.nextElement());
        
for (String sessionName : sessionNamesList) {
            session.removeAttribute(sessionName);
        }
    }
    
    
/**
     * 娣誨姞鎴栬呮洿鏂癝ession紲ㄦ嵁淇℃伅
     * 
     * 
@param sessionTick
     
*/
    
public final static void updateSessionTick(SessionTick<TickInterface> sessionTick) {
        getSession().removeAttribute(Enviroment.getEnv().getEnv(
"WEB_SESSION_KEY"));
        getSession().setAttribute(Enviroment.getEnv().getEnv(
"WEB_SESSION_KEY"), sessionTick);
    }
    
    
/**
     * 鎶婄敤鎴風エ鎹姞鍏ュ埌Session
     * 
@param account
     
*/
    
public final static void addTickToSession(TickInterface account) {
        SessionTick
<TickInterface> tick = new SessionTick<TickInterface>();
        tick.setAccount(account);
        updateSessionTick(tick);
    }
}


/*
 * SessionTick.java
 * Copyright (C) 2009  <JustinLei@gmail.com>
 *
 *        This program is free software; you can redistribute it and/or modify
 *        it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *     (at your option) any later version.
 *
 *       This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *        GNU General Public License for more details.
 *
 
*/
package org.lambdasoft.web.support;

/**
 * Session Support
 * 
 * 
@author lei.tang (justinlei@gmail.com)
 * @date 
 * 
@version
 
*/
import java.io.Serializable;

public class SessionTick<extends TickInterface> implements Serializable{
    
private static final long serialVersionUID = 1L;
    
private T account = null;
    
    
public SessionTick() {}
    
    
public SessionTick(T account) {
        
this.account = account;
    }
    
    
public T getAccount() {
        
return account;
    }
    
public void setAccount(T account) {
        
this.account = account;
    }
}

package org.lambdasoft.web.support;

public interface TickInterface {
    Long getId();
}


JustinLei 2009-12-18 16:37 鍙戣〃璇勮
]]>
Java Web宸ュ叿CookieSupporthttp://www.tkk7.com/justinlei/archive/2009/12/18/306584.htmlJustinLeiJustinLeiFri, 18 Dec 2009 08:34:00 GMThttp://www.tkk7.com/justinlei/archive/2009/12/18/306584.htmlhttp://www.tkk7.com/justinlei/comments/306584.htmlhttp://www.tkk7.com/justinlei/archive/2009/12/18/306584.html#Feedback0http://www.tkk7.com/justinlei/comments/commentRss/306584.htmlhttp://www.tkk7.com/justinlei/services/trackbacks/306584.html/*
 * CookieSupport.java
 * Copyright (C) 2007-3-19  <JustinLei@gmail.com>
 *
 *        This program is free software; you can redistribute it and/or modify
 *        it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *     (at your option) any later version.
 *
 *       This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *        GNU General Public License for more details.
 *
 
*/
package org.lambdasoft.web.support;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.lambdasoft.utils.StringUtils;

/**
 * 
@author TangLei <justinlei@gmail.com>
 * @date 2008-12-17
 
*/
public class CookieSupport {
    
private CookieSupport() {
    }

    
/**
     * 鍐檆ookies
     * 
     * 
@param response
     * 
@param cookieParams
     * 
@param maxAge
     
*/
    
public static final void writeCookies(HttpServletResponse response,
            Map
<String, String> cookieParams, int maxAge) {
        
if (cookieParams == null || cookieParams.size() == 0)
            
return;
        Set
<String> keySet = cookieParams.keySet();
        
for (String key : keySet) {
            Cookie cookie 
= new Cookie(key, cookieParams.get(key));
            cookie.setMaxAge(maxAge);
            response.addCookie(cookie);
        }
    }
    
    
/**
     * 鍒犻櫎鎵鏈夌殑cookies
     * 
@param request
     * 
@param response
     
*/
    
public static final void removeAllCookies(HttpServletRequest request,HttpServletResponse response) {
        Cookie[] cookies 
= request.getCookies();
        
if(cookies == null || cookies.length == 0)
            
return;
        Map
<String, String> cookiesMap = new HashMap<String, String>();
        
for (Cookie cookie : cookies) {
            cookiesMap.put(cookie.getName(),
"");
        }
        writeCookies(response, cookiesMap, 
0);
    }
    
    
/**
     * 璇誨彇cookies
     * 
     * 
@param request
     * 
@param cookieName
     * 
@return
     
*/
    
public static final Cookie[] readCookies(HttpServletRequest request,String cookieName) {
        Cookie[] cookies 
= request.getCookies();
        
if(cookies == null || cookies.length == 0)
            
return null;
        
if(StringUtils.isEmpty(cookieName))
            
return cookies;
        
for (int i = 0; i < cookies.length; i++) {
            
if(cookies[i].getName().equals(cookieName))
                
return new Cookie[] {cookies[i]};
        }
        
return null;
    }
}


JustinLei 2009-12-18 16:34 鍙戣〃璇勮
]]>
Freemark Memcached妯℃澘鍔犺澆鍣?/title><link>http://www.tkk7.com/justinlei/archive/2009/12/18/306577.html</link><dc:creator>JustinLei</dc:creator><author>JustinLei</author><pubDate>Fri, 18 Dec 2009 08:25:00 GMT</pubDate><guid>http://www.tkk7.com/justinlei/archive/2009/12/18/306577.html</guid><wfw:comment>http://www.tkk7.com/justinlei/comments/306577.html</wfw:comment><comments>http://www.tkk7.com/justinlei/archive/2009/12/18/306577.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/justinlei/comments/commentRss/306577.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/justinlei/services/trackbacks/306577.html</trackback:ping><description><![CDATA[Freemark鐨勬ā鏉挎枃浠朵粠緙撳瓨鍔犺澆(璇ュ疄鐜頒嬌鐢ㄧ殑緙撳瓨鏈嶅姟鍣∕emcached)<br /> <div>璇ュ姞杞藉櫒鍒嗕負浠ヤ笅鍑犱釜閮ㄥ垎:<br /> 1.涓誨姞杞藉櫒FreemarkerCacheTemplateLoader(瀹炵幇浜唂reemarker.cache.TemplateLoader)<br /> 2.緙撳瓨緇勪歡CacheComponent(璇ュ疄鐜頒負Memcached,濡傞渶瑕佸疄鐜伴檮涓婄暀璦)<br /> 3.緙撳瓨瀹炰綋綾誨皝瑁匔acheEntity(鐢ㄤ簬緙撳瓨瀹炰綋瀛樺彇)<br /> 4.鑷畾涔夊紓甯窩acheException<br /> 5.閰嶇疆鏂囦歡TemplateConfigure.properties(妯℃澘鍔犺澆鍣ㄩ厤緗?,JNDI_Configure.properties(緙撳瓨緇勪歡閰嶇疆)<br /> <br /> 瀹炵幇鑷畾涔夋ā鏉垮姞杞藉櫒闇瑕佸疄鐜癟emplateLoader浠ヤ笅鏂規硶<br /> 1.void closeTemplateSource(Object arg0) throws IOException //妯℃澘浣跨敤瀹屽叧闂柟娉?br /> 2.long getLastModified(Object templateSource)<span id="f79bf9b" class="Apple-tab-span" style="white-space:pre"> </span>//妯℃澘鏈鍚庝慨鏀規椂闂?br /> 3.Object findTemplateSource(String name) throws IOException<span id="tp7lhrx" class="Apple-tab-span" style="white-space:pre"> </span>//妯℃澘鏌ユ壘<br /> 4.Reader getReader(final Object templateSource, final String encoding) throws IOException<span id="v3ppr9d" class="Apple-tab-span" style="white-space:pre"> </span>//妯℃澘鍐呭<br /> <br /> <strong>浠ヤ笅涓轟釜綾誨疄鐜?</strong></div> <div><strong> <div style="background-color: #eeeeee; font-size: 13px; border-left-color: #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: #008000; "><span style="font-weight: normal;">/*</span></span><span style="color: #008000; "><span style="font-weight: normal;"><br />  * FreemarkerCacheTemplateLoader.java<br />  * Copyright (C) 2009  <JustinLei@gmail.com><br />  *<br />  *        This program is free software; you can redistribute it and/or modify<br />  *        it under the terms of the GNU General Public License as published by<br />  *      the Free Software Foundation; either version 2 of the License, or<br />  *     (at your option) any later version.<br />  *<br />  *       This program is distributed in the hope that it will be useful,<br />  *      but WITHOUT ANY WARRANTY; without even the implied warranty of<br />  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br />  *        GNU General Public License for more details.<br />  *<br />  </span></span><span style="color: #008000; "><span style="font-weight: normal;">*/</span></span><span style="color: #000000; "><span style="font-weight: normal;"><br /> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">package</span></span><span style="color: #000000; "><span style="font-weight: normal;"> org.lambdasoft.components.template.ejb;<br /> <br /> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">import</span></span><span style="color: #000000; "><span style="font-weight: normal;"> java.io.BufferedReader;<br /> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">import</span></span><span style="color: #000000; "><span style="font-weight: normal;"> java.io.File;<br /> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">import</span></span><span style="color: #000000; "><span style="font-weight: normal;"> java.io.FileReader;<br /> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">import</span></span><span style="color: #000000; "><span style="font-weight: normal;"> java.io.FilenameFilter;<br /> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">import</span></span><span style="color: #000000; "><span style="font-weight: normal;"> java.io.IOException;<br /> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">import</span></span><span style="color: #000000; "><span style="font-weight: normal;"> java.io.Reader;<br /> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">import</span></span><span style="color: #000000; "><span style="font-weight: normal;"> java.io.StringReader;<br /> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">import</span></span><span style="color: #000000; "><span style="font-weight: normal;"> java.util.Locale;<br /> <br /> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">import</span></span><span style="color: #000000; "><span style="font-weight: normal;"> org.lambdasoft.components.cache.CacheComponent;<br /> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">import</span></span><span style="color: #000000; "><span style="font-weight: normal;"> org.lambdasoft.components.cache.CacheEntity;<br /> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">import</span></span><span style="color: #000000; "><span style="font-weight: normal;"> org.lambdasoft.exception.CacheException;<br /> <br /> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">import</span></span><span style="color: #000000; "><span style="font-weight: normal;"> freemarker.cache.TemplateLoader;<br /> <br /> </span></span><span style="color: #008000; "><span style="font-weight: normal;">/**</span></span><span style="color: #008000; "><span style="font-weight: normal;"><br />  * Freemark Memcached妯℃澘鍔犺澆鍣?br />  * <br />  * </span></span><span style="color: #808080; "><span style="font-weight: normal;">@author</span></span><span style="color: #008000; "><span style="font-weight: normal;"> lei.tang (justinlei@gmail.com)<br />  * @date <br />  * </span></span><span style="color: #808080; "><span style="font-weight: normal;">@version</span></span><span style="color: #008000; "><span style="font-weight: normal;"><br />  </span></span><span style="color: #008000; "><span style="font-weight: normal;">*/</span></span><span style="color: #000000; "><span style="font-weight: normal;"><br /> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">class</span></span><span style="color: #000000; "><span style="font-weight: normal;"> FreemarkerCacheTemplateLoader </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">implements</span></span><span style="color: #000000; "><span style="font-weight: normal;"> TemplateLoader{<br />     </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">private</span></span><span style="color: #000000; "><span style="font-weight: normal;"> CacheComponent cacheComponent;<br />     </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">static</span></span><span style="color: #000000; "><span style="font-weight: normal;"> String DEFAULT_CACHE_KEY_PREFIX </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #000000; "><span style="font-weight: normal;">"</span></span><span style="color: #000000; "><span style="font-weight: normal;">CACHE.TEMPLATE.</span></span><span style="color: #000000; "><span style="font-weight: normal;">"</span></span><span style="color: #000000; "><span style="font-weight: normal;">;<br />     </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">static</span></span><span style="color: #000000; "><span style="font-weight: normal;"> String TEMPLATE_PREFIX </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #000000; "><span style="font-weight: normal;">"</span></span><span style="color: #000000; "><span style="font-weight: normal;">.ftl</span></span><span style="color: #000000; "><span style="font-weight: normal;">"</span></span><span style="color: #000000; "><span style="font-weight: normal;">;<br />     <br />     </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">private</span></span><span style="color: #000000; "><span style="font-weight: normal;"> String templatePath;<br />     </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> FreemarkerCacheTemplateLoader(CacheComponent cacheComponent,String templatePath) </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">throws</span></span><span style="color: #000000; "><span style="font-weight: normal;"> Exception {<br />         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">synchronized</span></span><span style="color: #000000; "><span style="font-weight: normal;"> (FreemarkerCacheTemplateLoader.</span></span><span style="color: #0000FF; "><span style="font-weight: normal;">class</span></span><span style="color: #000000; "><span style="font-weight: normal;">) {<br />             </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">this</span></span><span style="color: #000000; "><span style="font-weight: normal;">.templatePath </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> templatePath;<br />             </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">this</span></span><span style="color: #000000; "><span style="font-weight: normal;">.cacheComponent </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> cacheComponent;<br />             _addTemplateToCacheServer();<br />         }<br />     }<br />         <br />     </span></span><span style="color: #008000; "><span style="font-weight: normal;">//</span></span><span style="color: #008000; "><span style="font-weight: normal;">鍐呴儴綾葷紦瀛樺疄浣?/span></span><span style="color: #008000; "><span style="font-weight: normal;"><br /> </span></span><span style="color: #000000; "><span style="font-weight: normal;">    </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">private</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">static</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">final</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">class</span></span><span style="color: #000000; "><span style="font-weight: normal;"> _cacheEntity </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">implements</span></span><span style="color: #000000; "><span style="font-weight: normal;"> CacheEntity{<br />         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">private</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">static</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">final</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">long</span></span><span style="color: #000000; "><span style="font-weight: normal;"> serialVersionUID </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #000000; "><span style="font-weight: normal;">1L</span></span><span style="color: #000000; "><span style="font-weight: normal;">;<br />         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">private</span></span><span style="color: #000000; "><span style="font-weight: normal;"> String key;<br />         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">private</span></span><span style="color: #000000; "><span style="font-weight: normal;"> String entity;<br />         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> _cacheEntity(String key,String entity) {<br />             </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">this</span></span><span style="color: #000000; "><span style="font-weight: normal;">.key </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> key;<br />             </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">this</span></span><span style="color: #000000; "><span style="font-weight: normal;">.entity </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> entity;<br />         }<br />         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">void</span></span><span style="color: #000000; "><span style="font-weight: normal;"> setKey(String key) {<br />         }<br />         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">void</span></span><span style="color: #000000; "><span style="font-weight: normal;"> setEntity(Object obj) {<br />         }<br />         <br />         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> String getKey() {<br />             </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">return</span></span><span style="color: #000000; "><span style="font-weight: normal;"> key.toUpperCase();<br />         }<br />         <br />         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> Object getEntity() {<br />             </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">return</span></span><span style="color: #000000; "><span style="font-weight: normal;"> entity;<br />         }<br />         <br />         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">void</span></span><span style="color: #000000; "><span style="font-weight: normal;"> check() </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">throws</span></span><span style="color: #000000; "><span style="font-weight: normal;"> CacheException {}<br />     }<br />     </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">private</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">void</span></span><span style="color: #000000; "><span style="font-weight: normal;"> _addTemplateToCacheServer() </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">throws</span></span><span style="color: #000000; "><span style="font-weight: normal;"> Exception {<br />         File file </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">new</span></span><span style="color: #000000; "><span style="font-weight: normal;"> File(templatePath);<br />         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">if</span></span><span style="color: #000000; "><span style="font-weight: normal;">(file.isDirectory()) {<br />             File[] templateFiles </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> file.listFiles(</span></span><span style="color: #0000FF; "><span style="font-weight: normal;">new</span></span><span style="color: #000000; "><span style="font-weight: normal;"> FilenameFilter() {<br />                 </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">boolean</span></span><span style="color: #000000; "><span style="font-weight: normal;"> accept(File dir, String name) {<br />                     </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">if</span></span><span style="color: #000000; "><span style="font-weight: normal;">(name.endsWith(TEMPLATE_PREFIX))<br />                         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">return</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">true</span></span><span style="color: #000000; "><span style="font-weight: normal;">;<br />                     </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">return</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">false</span></span><span style="color: #000000; "><span style="font-weight: normal;">;<br />                 }<br />             });<br />             String locale </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #000000; "><span style="font-weight: normal;">"</span></span><span style="color: #000000; "><span style="font-weight: normal;">_</span></span><span style="color: #000000; "><span style="font-weight: normal;">"</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #000000; "><span style="font-weight: normal;">+</span></span><span style="color: #000000; "><span style="font-weight: normal;"> Locale.getDefault();<br />             </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">for</span></span><span style="color: #000000; "><span style="font-weight: normal;"> (File templateFile : templateFiles) {<br />                 </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">final</span></span><span style="color: #000000; "><span style="font-weight: normal;"> String key </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> DEFAULT_CACHE_KEY_PREFIX </span></span><span style="color: #000000; "><span style="font-weight: normal;">+</span></span><span style="color: #000000; "><span style="font-weight: normal;"> templateFile.getName().substring(</span></span><span style="color: #000000; "><span style="font-weight: normal;">0</span></span><span style="color: #000000; "><span style="font-weight: normal;">,<br />                                 templateFile.getName().length()</span></span><span style="color: #000000; "><span style="font-weight: normal;">-</span></span><span style="color: #000000; "><span style="font-weight: normal;"> TEMPLATE_PREFIX.length()) </span></span><span style="color: #000000; "><span style="font-weight: normal;">+</span></span><span style="color: #000000; "><span style="font-weight: normal;"> locale;<br />                 BufferedReader bufferedReader </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">new</span></span><span style="color: #000000; "><span style="font-weight: normal;"> BufferedReader(</span></span><span style="color: #0000FF; "><span style="font-weight: normal;">new</span></span><span style="color: #000000; "><span style="font-weight: normal;"> FileReader(templateFile));<br />                 String line </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">null</span></span><span style="color: #000000; "><span style="font-weight: normal;">;<br />                 StringBuilder stringBuilder </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">new</span></span><span style="color: #000000; "><span style="font-weight: normal;"> StringBuilder();<br />                 </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">while</span></span><span style="color: #000000; "><span style="font-weight: normal;">((line </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> bufferedReader.readLine()) </span></span><span style="color: #000000; "><span style="font-weight: normal;">!=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">null</span></span><span style="color: #000000; "><span style="font-weight: normal;">) {<br />                     stringBuilder.append(line);<br />                 }<br />                 </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">final</span></span><span style="color: #000000; "><span style="font-weight: normal;"> String entity </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> stringBuilder.toString();<br />                 cacheComponent.add(</span></span><span style="color: #0000FF; "><span style="font-weight: normal;">new</span></span><span style="color: #000000; "><span style="font-weight: normal;"> _cacheEntity(key.toUpperCase(),entity));<br />             }<br />         }<br />     }<br />     <br />     </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">void</span></span><span style="color: #000000; "><span style="font-weight: normal;"> closeTemplateSource(Object arg0) </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">throws</span></span><span style="color: #000000; "><span style="font-weight: normal;"> IOException {}<br /> <br />     </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">long</span></span><span style="color: #000000; "><span style="font-weight: normal;"> getLastModified(Object templateSource) {<br />         </span></span><span style="color: #008000; "><span style="font-weight: normal;">//</span></span><span style="color: #008000; "><span style="font-weight: normal;">娌℃湁鏈鍚庝慨鏀規爣璇嗗彧榪斿洖涓?</span></span><span style="color: #008000; "><span style="font-weight: normal;"><br /> </span></span><span style="color: #000000; "><span style="font-weight: normal;">        </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">return</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #000000; "><span style="font-weight: normal;">0</span></span><span style="color: #000000; "><span style="font-weight: normal;">;<br />     }<br />     <br />     </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> Object findTemplateSource(String name) </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">throws</span></span><span style="color: #000000; "><span style="font-weight: normal;"> IOException {<br />         CacheEntity cacheEntity </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> cacheComponent.get(DEFAULT_CACHE_KEY_PREFIX </span></span><span style="color: #000000; "><span style="font-weight: normal;">+</span></span><span style="color: #000000; "><span style="font-weight: normal;"> name.toUpperCase());<br />         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">return</span></span><span style="color: #000000; "><span style="font-weight: normal;"> cacheEntity.getEntity();<br />     }<br /> <br />     </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> Reader getReader(</span></span><span style="color: #0000FF; "><span style="font-weight: normal;">final</span></span><span style="color: #000000; "><span style="font-weight: normal;"> Object templateSource, </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">final</span></span><span style="color: #000000; "><span style="font-weight: normal;"> String encoding) </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">throws</span></span><span style="color: #000000; "><span style="font-weight: normal;"> IOException {<br />         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">return</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">new</span></span><span style="color: #000000; "><span style="font-weight: normal;"> StringReader((String)templateSource);<br />     }<br /> <br />     </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">void</span></span><span style="color: #000000; "><span style="font-weight: normal;"> setCacheComponent(CacheComponent cacheComponent) {<br />         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">this</span></span><span style="color: #000000; "><span style="font-weight: normal;">.cacheComponent </span></span><span style="color: #000000; "><span style="font-weight: normal;">=</span></span><span style="color: #000000; "><span style="font-weight: normal;"> cacheComponent;<br />     }<br /> <br />     </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">public</span></span><span style="color: #000000; "><span style="font-weight: normal;"> CacheComponent getCacheComponent() {<br />         </span></span><span style="color: #0000FF; "><span style="font-weight: normal;">return</span></span><span style="color: #000000; "><span style="font-weight: normal;"> cacheComponent;<br />     }<br /> }</span><br /> </span></div> <div style="background-color: #eeeeee; font-size: 13px; border-left-color: #cccccc; padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; "><span style="font-weight: normal;"><br /> </span></div> <div style="font-size: 13px; border-left-color: #cccccc; padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; background-color: #eeeeee; "><span style="font-weight: normal;"> <div style="background-color: #eeeeee; font-size: 13px; border-left-color: #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: #008000; ">/*</span><span style="color: #008000; "><br />  * CacheEntity.java<br />  * Copyright (C) 2009  <JustinLei@gmail.com><br />  *<br />  *        This program is free software; you can redistribute it and/or modify<br />  *        it under the terms of the GNU General Public License as published by<br />  *      the Free Software Foundation; either version 2 of the License, or<br />  *     (at your option) any later version.<br />  *<br />  *       This program is distributed in the hope that it will be useful,<br />  *      but WITHOUT ANY WARRANTY; without even the implied warranty of<br />  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br />  *        GNU General Public License for more details.<br />  *<br />  </span><span style="color: #008000; ">*/</span><span style="color: #000000; "><br /> </span><span style="color: #0000FF; ">package</span><span style="color: #000000; "> org.lambdasoft.components.cache;<br /> <br /> </span><span style="color: #0000FF; ">import</span><span style="color: #000000; "> java.io.Serializable;<br /> <br /> </span><span style="color: #0000FF; ">import</span><span style="color: #000000; "> org.lambdasoft.exception.CacheException;<br /> <br /> </span><span style="color: #008000; ">/**</span><span style="color: #008000; "><br />  * <br />  * </span><span style="color: #808080; ">@author</span><span style="color: #008000; "> lei.tang (justinlei@gmail.com)<br />  * @date 2009-8-15<br />  * </span><span style="color: #808080; ">@version</span><span style="color: #008000; "> 1.0<br />  </span><span style="color: #008000; ">*/</span><span style="color: #000000; "><br /> </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">interface</span><span style="color: #000000; "> CacheEntity </span><span style="color: #0000FF; ">extends</span><span style="color: #000000; "> Serializable{<br />     <br />     </span><span style="color: #008000; ">/**</span><span style="color: #008000; "><br />      * 鑾峰彇緙撳瓨key<br />      * </span><span style="color: #808080; ">@return</span><span style="color: #008000; "><br />      </span><span style="color: #008000; ">*/</span><span style="color: #000000; "><br />     String getKey();<br />     <br />     </span><span style="color: #008000; ">/**</span><span style="color: #008000; "><br />      * 璁劇疆緙撳瓨key<br />      </span><span style="color: #008000; ">*/</span><span style="color: #000000; "><br />     </span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> setKey(String key);<br />     <br />     </span><span style="color: #008000; ">/**</span><span style="color: #008000; "><br />      * 鑾峰彇緙撳瓨瀵硅薄<br />      * </span><span style="color: #808080; ">@return</span><span style="color: #008000; "><br />      </span><span style="color: #008000; ">*/</span><span style="color: #000000; "><br />     Object getEntity();<br />     <br />     </span><span style="color: #008000; ">/**</span><span style="color: #008000; "><br />      * 璁劇疆緙撳瓨瀵硅薄<br />      * </span><span style="color: #808080; ">@param</span><span style="color: #008000; "> obj<br />      </span><span style="color: #008000; ">*/</span><span style="color: #000000; "><br />     </span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> setEntity(Object obj);<br />     <br />     </span><span style="color: #008000; ">/**</span><span style="color: #008000; "><br />      * 緙撳瓨瀵硅薄媯鏌?br />      * </span><span style="color: #808080; ">@throws</span><span style="color: #008000; "> CacheException<br />      </span><span style="color: #008000; ">*/</span><span style="color: #000000; "><br />     </span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> check() </span><span style="color: #0000FF; ">throws</span><span style="color: #000000; "> CacheException;<br /> }<br /> </span></div> <div style="background-color: #eeeeee; font-size: 13px; border-left-color: #cccccc; padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; "><br /> </div> <div style="background-color: #eeeeee; font-size: 13px; border-left-color: #cccccc; padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; "><br /> </div> <div style="font-size: 13px; border-left-color: #cccccc; padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; background-color: #eeeeee; "> <div style="background-color: #eeeeee; font-size: 13px; border-left-color: #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: #008000; ">/*</span><span style="color: #008000; "><br />  * CacheException.java<br />  * Copyright (C) 2009  <JustinLei@gmail.com><br />  *<br />  *        This program is free software; you can redistribute it and/or modify<br />  *        it under the terms of the GNU General Public License as published by<br />  *      the Free Software Foundation; either version 2 of the License, or<br />  *     (at your option) any later version.<br />  *<br />  *       This program is distributed in the hope that it will be useful,<br />  *      but WITHOUT ANY WARRANTY; without even the implied warranty of<br />  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br />  *        GNU General Public License for more details.<br />  *<br />  </span><span style="color: #008000; ">*/</span><span style="color: #000000; "><br /> </span><span style="color: #0000FF; ">package</span><span style="color: #000000; "> org.lambdasoft.exception;<br /> <br /> </span><span style="color: #008000; ">/**</span><span style="color: #008000; "><br />  * <br />  * </span><span style="color: #808080; ">@author</span><span style="color: #008000; "> lei.tang (justinlei@gmail.com)<br />  * @date 2009-9-11<br />  * </span><span style="color: #808080; ">@version</span><span style="color: #008000; "> 1.0<br />  </span><span style="color: #008000; ">*/</span><span style="color: #000000; "><br /> </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">class</span><span style="color: #000000; "> CacheException </span><span style="color: #0000FF; ">extends</span><span style="color: #000000; "> BusinessException{<br />     </span><span style="color: #0000FF; ">private</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">final</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">long</span><span style="color: #000000; "> serialVersionUID </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">1L</span><span style="color: #000000; ">;<br />     <br />     </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> CacheException(String msg) {<br />         </span><span style="color: #0000FF; ">super</span><span style="color: #000000; ">(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">緙撳瓨閿欒: </span><span style="color: #000000; ">"</span><span style="color: #000000; "> </span><span style="color: #000000; ">+</span><span style="color: #000000; "> msg);<br />     }<br /> }<br /> </span></div> <div style="background-color: #eeeeee; font-size: 13px; border-left-color: #cccccc; padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; "><br /> </div> <div style="background-color: #eeeeee; font-size: 13px; border-left-color: #cccccc; padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; "><br /> </div> <div style="background-color: #eeeeee; border-left-color: #cccccc; padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; "><strong>TemplateConfigure.properties:</strong></div> <div style="border-left-color: #cccccc; padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; background-color: #eeeeee; "> <div style="background-color: #eeeeee; font-size: 13px; border-left-color: #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: #000000; ">TEMPLATE.DIR.ROOT</span><span style="color: #000000; ">=</span><span style="color: #000000; ">E:/workspace/templates<br /> TEMPLATE.CACHE</span><span style="color: #000000; ">=</span><span style="color: #000000; ">true<br /> TEMPLATE.CACHE.PREFIX</span><span style="color: #000000; ">=</span><span style="color: #000000; ">CACHE.TEMPLATE</span></div> </div> </div> </span></div> </strong></div> <img src ="http://www.tkk7.com/justinlei/aggbug/306577.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/justinlei/" target="_blank">JustinLei</a> 2009-12-18 16:25 <a href="http://www.tkk7.com/justinlei/archive/2009/12/18/306577.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Java Mail EJB3.0緇勪歡(POP Support)http://www.tkk7.com/justinlei/archive/2009/12/18/306569.htmlJustinLeiJustinLeiFri, 18 Dec 2009 07:40:00 GMThttp://www.tkk7.com/justinlei/archive/2009/12/18/306569.htmlhttp://www.tkk7.com/justinlei/comments/306569.htmlhttp://www.tkk7.com/justinlei/archive/2009/12/18/306569.html#Feedback0http://www.tkk7.com/justinlei/comments/commentRss/306569.htmlhttp://www.tkk7.com/justinlei/services/trackbacks/306569.html闃呰鍏ㄦ枃

JustinLei 2009-12-18 15:40 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 99久久久精品免费观看国产| 国产99精品一区二区三区免费 | 国产亚洲日韩在线三区| 精品亚洲456在线播放| 99久久99这里只有免费费精品| 久久综合亚洲色HEZYO社区 | 亚洲成年人免费网站| 国产成人精品免费午夜app| 亚洲女人影院想要爱| 国产a视频精品免费观看| 亚洲免费电影网站| 国产福利在线免费| 亚洲精品永久在线观看| 国产日产成人免费视频在线观看| 亚洲人成无码网站在线观看| 国产成人3p视频免费观看| 污网站在线免费观看| 亚洲欧洲国产精品香蕉网| 无码精品国产一区二区三区免费| 精品亚洲aⅴ在线观看| 亚洲免费网站观看视频| 国产精品亚洲专区无码唯爱网 | 亚洲色成人网站WWW永久| 中国一级毛片视频免费看| 亚洲国产一区在线| 国产免费看JIZZ视频| 国产亚洲综合一区二区三区| 国产综合精品久久亚洲| 在线观看免费中文视频| 亚洲已满18点击进入在线观看| 国产男女性潮高清免费网站| a级毛片视频免费观看| 亚洲伊人久久大香线蕉影院| 波多野结衣免费视频观看| 国产午夜不卡AV免费| 亚洲一区二区三区写真| 亚洲人成影院在线观看| 四虎最新永久免费视频| 色吊丝免费观看网站| 少妇中文字幕乱码亚洲影视| 国产小视频在线免费|