java 正则匹配空格字符串 正则表达式截取字符串 需求:从一堆sql中取出某些特定字符串: 比如配置的sql语句为:"company_code = @cc and project_id = @pid ; update t set a = @aa,b=@bb,c=@cd,ttt=@ttt;update t2 set d=@bb"; 我要拿出所有的以@开头的作为变量,并且去重,则如下玩: ps:其中正则匹配空格是 “\s+” public class Test { public stat
java.text.MessageFormat格式化字符串时的小技巧 public static void main(String[] args) throws InterruptedException { MessageFormat form = new MessageFormat( "{2,date,yyyy-MM-dd HH:mm:ss.SSS} The disk \"{1}\" contains {0,number,#.##} file(s).{3}");
https://my.oschina.net/yushulx/blog/298140 How to Implement a Java WebSocket Server for Image Transmission with Jetty 创建一个从WebSocketHandler继承的类WSHandler: import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.annotatio
1. 首先引入jar包 在pom.xml文件里加入下面依赖: <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.51</version> </dependency> 2. 创建一个Person类(方面下面使用) public class Person implements Comp
当HttpSession中止(通过显示地失效或超时)时,Web容器会把HttpSession属性从HttpSession中清除. javax.servlet.http.HttpSessionBindingListener接口定义如下: public interface HttpSessionBindingListener { public void valueUnbound(HttpSessionBindingEvent hsbe); public void valueBound(HttpSes