关于Apache Commons的简介

Apache Commons是对JDK的拓展,包含了很多开源的工具,用于解决平时编程经常会遇到的问题,减少重复劳动。官网网址:http://commons.apache.org Commons BeanUtils 针对Bean的一个工具集。由于Bean往往是有一堆get和set组成,所以BeanUtils也是在此基础上进行一些包装。 一个比较常用的功能是Bean Copy,也就是copy bean的属性。如果做分层架构开发的话就会用到,比如从PO(Persistent Object)拷贝数据到VO(Value Object) Commons Codec 是编码和解码组件,提供常用的编码和解码方法,如DES、SHA1、MD5、Base64、URL和Soundx等。 Commons Collections 是一个集合组件,扩展了Java标准Collections API,对常用的集合操作进行了很好的封装、抽象和补充,在保证性能的同时大大简化代码。 Commons Compress 是一个压缩、解压缩文件的组件,可以操作rar、cpio、Unix dump、tar、zip、gzip、XZ、Pack200和bzip2格式的压缩文件。 Commons Configuration 是一个Java应用程序的配置管理工具,可以从properties或者xml文件中加载配置信息。 Commons CSV 是一个用来读写各种Comma Separated Value(CSV)格式文件的Java类库。 Commons Daemon 实现将普通的Java应用变成系统的后台服务,例如 Tomcat 就是利用这个项目来实现作为 Linux 和 Windows 的服务启动和停止的。  Commons DBCP 数据库连接池。 Commons DBUtils 是JDBC工具组件,对传统操作数据库的类进行二次封装,可以把结果集转化成List。  Commons Digester 是XML到Java对象的映射工具集。  Commons Email 是邮件操作组件,对Java Mail API进行了封装,提供了常用的邮件发送和接收类,简化邮件操作。该组件依赖Java Mail API。 Commons … Read more

[java]Reflections 反射工具类

package com.22pig.util; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * ClassName: Reflections * @Description: 反射工具类.提供调用getter/setter方法, 访问私有变量, 调用私有方法, 获取泛型类型Class,被AOP过的真实类等工具函数. * @author * @date 2015年9月9日 下午1:02:26 */ public class Reflections { private static final String SETTER_PREFIX = “set”; private static final String GETTER_PREFIX … Read more

[java] FreeMarkerUtil 模板工具

package com.22pig.util; import java.io.StringReader; import java.io.StringWriter; import java.util.Map; import freemarker.template.Configuration; import freemarker.template.Template; /** * * <b> FreeMarkerUtil 模板工具 </b> * * @author Stone * */ public class FreeMarkerUtil { /** * * 读取模板文件 * * @author StoneLi * * @param fltFile * flt文件名 * @param templatePath * flt文件路径 src/template * @param datas * 数据集合 * … Read more

[java] DoubleUtil 数值转换工具类

package com.22pig.util; import java.math.RoundingMode; import java.text.DecimalFormat; import java.text.NumberFormat; import org.apache.commons.lang.StringUtils; public class DoubleUtil { /** * NumberFormat is the abstract base class for all number formats. * This class provides the interface for formatting and parsing numbers. * @param d * @return */ public static String formatDoubleUp(double d,int len) { return String.format(“%.”+len+”f”, d); } public … Read more

[java] HttpClientUtil.java -Http Client

package com.22pig.util; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.URL; import java.net.URLConnection; import com.alibaba.fastjson.JSONObject; public class HttpClientUtil { public static String sendGet(String url, String getValueByKey) { String result = sendGet(url); JSONObject ticketObj =JSONObject.parseObject(result); String value =ticketObj.getString(getValueByKey); return value; } /** * 向指定URL发送GET方法的请求 * * @param url * 发送请求的URL * @param param * 请求参数,请求参数应该是 … Read more

Maven – 解决Maven下载依赖包速度慢问题-加入国内镜像

其实方法很简单:maven是支持镜像的,我们可以在${maven_home}的conf目录下的setting.xml文件中找到标签 alimaven aliyun maven http://maven.aliyun.com/nexus/content/groups/public/ central CN OSChina Central http://maven.oschina.net/content/groups/public/ central repo2 central Human Readable Name for this Mirror. http://repo2.maven.org/maven2/ net-cn central Human Readable Name for this Mirror. http://maven.net.cn/content/groups/public/ ui central Human Readable Name for this Mirror. http://uk.maven.org/maven2/ ibiblio central Human Readable Name for this Mirror. http://mirrors.ibiblio.org/pub/mirrors/maven2/ jboss-public-repository-group central JBoss Public Repository Group http://repository.jboss.org/nexus/content/groups/public JBossJBPM … Read more

Jpress直接在tomcat启动运行

一、eclipse里新建maven项目 二、复制jpress官方文件下载的压缩包里jpress目录下的项目 三、粘贴到新建的maven项目里 四、选中项目右键Run As Maven Install 五、在eclipse工作空间的以上新建maven项目下jpress-web\target里会生成war包 六、将该war包粘贴到tomcat的webapps下 七、运行tomcat/bin下的startup.bat启动服务,会自动加压war包 八、tomcat/conf/server.xml文件配置如下: 九、浏览器直接输入http://127.0.0.1:8080/即可访问项目,配置jpress数据库等信息。

linux下邮件查看命令

安装mail $ yum install mailx   $mail & 2 //显示标号为2的文件 $ h //显示当前的邮件列表 $d //删除   系统提供了用户之间通信的邮件系统,当用户打开终端注册登录时发现系统给出如下信息: you have mail. 这时用户可通过键入mail命令读取信件: $ mail mail程序将逐个显示用户的信件,并依照时间顺序,显示最新的信件。每显示一段信件,mail都询问 用户是否要对该信件作些处理。若用户回答d,则表示删除信件;若仅按回车键,表示对信件不作任何改 动(信件仍旧保存,下次还可读这一信件);若回答p,则要求重复显示信件;s filename表示要把信件 存入所命名的文件;若回答q,表示要从mail退出。   [root@localhost ~]# mail Mail version 8.1 6/6/93. Type ? for help. “/var/spool/mail/root”: 76 messages 76 unread >U 1 root@localhost.local Mon Jan 19 15:43 24/936 “Cron <root@localhost>” … Read more