zw7534313的博客 -凯发k8国际

`
文章列表
往网页分批推送数据:boundary=end,总头-->分头-->body @getmapping("/test")     public void testjpg(httpservletresponse response) throws ioexception{         response.setcontenttype("multipart/x-mixed-replace;boundary=end");         // set the content type based on the file type you need t ...
    博客分类:
  • java
import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.namevaluepair; import org.apache.http.client.httpclient; import org.apache.http.client.entity.urlencodedformentity; import org.apache.http.client.methods.httppost; import org.apache.http.impl.client.httpcl ...
    博客分类:
  • java
//groovy超强的java动态计算能力 groovy-2.5.12.jar apache  表达式语言  public class groovytest { public static void main(string[] args) { groovyshell shell = new groovyshell();         object result = shell.evaluate("(1 5)/2");         system.out.println(result);                 binding binding = ne ...
    博客分类:
  • java
import java.util.date; /** * beanshell解释器:亦可嵌入到java源代码中,能动态执行java源代码   bsh-1.3.0.jar */ public class iftest { public static void main(string[] args) { interpreter interpreter = new interpreter();   string s = "2>3||3>4&&5<4";   try {    //计算表达式    interpreter ...
    博客分类:
  • java
jdk的延迟队列 方案是利用jdk自带的delayqueue来实现,这是一个无界阻塞队列,该队列只有在延迟期满的时候才能从中获取元素,放入delayqueue中的对象,是必须实现delayed接口的。 list list; order createtime; 延迟30秒,与当前时间比对 import java.util.concurrent.delayed; import java.util.concurrent.timeunit; public class orderdelay implements delayed {     private strin ...
    博客分类:
  • java
import java.net.url; import javax.net.ssl.hostnameverifier; import javax.net.ssl.httpsurlconnection; import javax.net.ssl.sslsession; public class httpsurlconnectiontest { public static void main(string args[])throws exception{ // 客户端密钥库 string sslkeystorepath="e:\\tomk.keystore"; ...
    博客分类:
  • java
log4j的conversionpattern参数的格式含义 log4j建议只使用四个级别,优先级从高到低分别是error、warn、info、debug #这里定义能显示到的最低级别,若定义到info级别,则看不到debug级别的信息了~! log4j.rootlogger=debug #将dao层log记录到daolog,alllog中 log4j.logger.dao=debug,a2,a4 #将逻辑层log记录到businesslog,alllog中 log4j.logger.businesslog=debug,a3,a4 #a1--打印到屏幕上 log4j.appender.a1= ...
    博客分类:
  • java
java里面也有这个方法,java thread中, join() 方法主要是让调用该方法的thread完成run方法里面的东西后, 在执行join()方法后面的代码。 thread thread = new thread(new test());          system.out.println("start....");          thread.start();          thread.join();          system.out.println("after thread runed"); 
    博客分类:
  • java
import java.io.bufferedreader; import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.ioexception; import java.io.inputstreamreader; import java.util.zip.gzipinputstream; import java.util.zip.gzipoutputstream; public class zipfile { public static void main(string[] args) t ...
    博客分类:
  • java
软引用softreference的使用 softreference的主要特点就是在当内存不够的时候,gc会回收softreference所引用的对象。 所以,在memory sensitive的项目中将某些数据设置成softreference可以避免内存的溢出。 public class ac { public static void main(string[] args) { ac ac=new ac(); softreference sr=new softreference(ac); list list=new arraylist(); list.add(sr); ...
    博客分类:
  • java
import java.util.arraylist; import java.util.date; import java.util.hashmap; import java.util.list; import java.util.map; import com.alibaba.fastjson.json; import com.alibaba.fastjson.jsonobject; import com.alibaba.fastjson.typereference; import com.alibaba.fastjson.serializer.serializeconfig; import ...
    博客分类:
  • java
import org.apache.commons.lang.randomstringutils;    public class dummyfilehelper {      //private final static string ramdom_source = "0123456789"; private final static string ramdom_source = "0123456789025689";        public static void main(string[] args) throws ioexcept ...
    博客分类:
  • java
java加密和数字签名 消息摘要 这是一种与消息认证码结合使用以确保消息完整性的技术。主要使用单向散列函数算法, 可用于检验消息的完整性,和通过散列密码直接以文本形式保存等,目前广泛使用的算法 有md4、md5、sha-1, java.security.messagedigest提供了一个简易的操作方法 私钥加密 消息摘要只能检查消息的完整性,但是单向的,对明文消息并不能加密,要加密明文的消息的话, 就要使用其他的算法,要确保机密性,我们需要使用私钥密码术来交换私有消息。 使用私钥加密的话,首先需要一个密钥,可用javax.crypto.keygenerator产生一个密钥(java.sec ...
    博客分类:
  • java
import java.security.securerandom; import javax.crypto.spec.deskeyspec; import javax.crypto.secretkeyfactory; import javax.crypto.secretkey; import javax.crypto.cipher; /** * des加密介绍 des是一种对称加密算法,所谓对称加密算法即:加密和解密使用相同密钥的算法。des加密算法出自ibm的研究, * 后来被美国政府正式采用,之后开始广泛流传,但是近些年使用越来越少,因为des使用56位密钥, */ public ...
    博客分类:
  • java
对称加密、解密 import javax.crypto.cipher; import javax.crypto.spec.secretkeyspec; import sun.misc.base64decoder; import sun.misc.base64encoder;    /** * aes加解密 */ public class aes {        /**      * 密钥算法      */      private static final string algorithm = "aes";      /**      * 加解 ...
    博客分类:
  • java
springboot中使用springmvc的拦截器-handlerinterceptoradapter 拦截器配合注解使用: 权限判断 (1)controller层: @authorityvalid(validate=true) @requestmapping("/") public string list(model model) { system.out.println(" *** controller *** " this); return "index"; } (2)自定义注解@authorityval ...
    博客分类:
  • java
切点指示符 切点指示符是切点定义的关键字,切点表达式以切点指示符开始。 开发人员使切点指示符来告诉切点将要匹配什么,有以下9种切点指示符: execution、within、this、target、args、@target、@args、@within、@annotation。 (1)executio ...
    博客分类:
  • java
spring之aspectj面向切面编程 面向切面编程,实现方式有三种,最常用的是 1、实现invocationhandler接口:这样需要根据代理的类 2、基于spring 的aop方式:这种和实现接口一样,也需要有个新的类来代理 3、基于aspectj 自定义注解来实现,这个很完美,对外调用不需要重写类 使用aspectj注解实现切面编程 增加jar包: dependency>             org.aspectj             aspectjrt< ...
    博客分类:
  • java
 
  public class person { private igohome home;  public void tohome(){  home.gohome(); } public void sethome(igohome home) {  this.home = home; }  public static void main(string[] args){  person p = new person();  p.sethome(new driver());  p.tohome();    p.sethome(new rider());  p.tohome(); }} publ ...
    博客分类:
  • java
  //使用反射将对象转mappublic class object2map {  public static void main(string[] args) throws exception{  user user = new user();  user.setname("zhangsan");  user.setage(20);  user.setbirthday(new date());    map map = new hashmap
    博客分类:
  • java
  /** * 原型设计模式:原型模式主要用于对象的复制 * prototype类需要具备以下两个条件:     1.实现cloneable接口。在java语言有一个cloneable接口,它的作用只有一个,就是在运行时通知虚拟机可以安全地在实现了此接口的类上使用clone方法。在java虚拟机中,只有实现了这个接口的类才可以被拷贝,否则在运行时会抛出clonenotsupportedexception异常。     2.重写object类中的clone方法。java中,所有类的父类都是object类,object类中有一个clone方法,作用是返回对象的一个拷贝,但是其作用域protect ...
    博客分类:
  • java
nio 
  // 通过nio的channel来读写文件public class niofilereadwrite {  public static void main(string[] args) {  string file = "d:\\n4.txt";  string file2 = "d:\\ncc.txt";    // 1.通过channel-buffer进行文件读写//  new thread(new readfilethread(file, file2)) ...
    博客分类:
  • java
 
  使用jndi获取数据库连接池   jndi是j2ee13个规范之一,也是非常重要的。这里我来先简单介绍一下jndi: jndi(java naming and directory interface) java命名和目录服务接口             降低程序和程序之间的耦合性            降低设备和设备的耦合性   tomcat服务器实现了jndi服务,启动tomcat服务器,等同于启动jndi服务器   jndi是sun制定的一套规范,这套规范可以和jdbc进行类比,jdbc也是一套规范,我们面向jdbc接口调用就可以获取数据库中的数据。         同样,我们面 ...
    博客分类:
  • java
   echarts 图表 - echarts.js    
global site tag (gtag.js) - google analytics
网站地图