05 2016 档案
Java - 正则表达式常用操作
摘要:验证 简单验证 提取 替换 简单替换 使用 Pattern 对象,方便反复使用 切分 简单切分 使用 Pattern 对象,方便反复使用 阅读全文
posted @ 2016-05-26 14:46 huey2672 阅读(262) 评论(0) 推荐(0) 编辑
Jackson - Date Handling
摘要:Handling dates on Java platform is complex business. Jackson tries not to make it any harder than it has to be. Here's how. All time objects that have 阅读全文
posted @ 2016-05-23 13:41 huey2672 阅读(635) 评论(0) 推荐(0) 编辑
Jackson - Quickstart
摘要:JSON Three Ways Jackson offers three alternative methods (one with two variants) for processing JSON: Streaming API (aka "Incremental parsing/generati 阅读全文
posted @ 2016-05-23 12:16 huey2672 阅读(347) 评论(0) 推荐(0) 编辑
SAX - DefaultHandler
摘要:org.xml.sax.helpers.DefaultHandler 实现了 org.xml.sax.EntityResolver、org.xml.sax.DTDHandler、org.xml.sax.ContentHandler 和 org.xml.sax.ErrorHandler,并提供了默认的 阅读全文
posted @ 2016-05-22 19:23 huey2672 阅读(561) 评论(0) 推荐(0) 编辑
SAX - Hello World
摘要:SAX 是一种事件驱动的 XML 数据处理模型。对于 DOM 模型,解析 XML 文档时,需要将所有内容载入内容。相比 DOM 模型,SAX 模型更为高效,它一边扫描一边解析 XML 文档。但与 DOM 模型相比,SAX 的操作更为复杂。 简单示例: 阅读全文
posted @ 2016-05-21 17:12 huey2672 阅读(270) 评论(0) 推荐(0) 编辑
JDK Tools - wsimport: 编译 WSDL 生成 JAX-WS 规范的 Java 类
摘要:wsimport 命令是用来编译 wsdl 生成JAX-WS 规范的 Java 类的工具。 命令格式 wsimport [ options ] wsdl 命令参数 -s directory 指定源文件所在的目录。 -d directory 在指定的目录生成 Java 类。 -p name 指定生成的 阅读全文
posted @ 2016-05-20 16:55 huey2672 阅读(327) 评论(0) 推荐(0) 编辑
JAXB - Annotations, Type Mapping: XmlSchemaType
摘要:The annotation XmlSchemaType defines a mapping between an arbitrary Java type and a simple schema built-in type. Most of the time the default mapping 阅读全文
posted @ 2016-05-20 15:54 huey2672 阅读(339) 评论(0) 推荐(0) 编辑
JAXB - Annotations, Type Adapters: XmlJavaTypeAdapter
摘要:For some Java container types JAXB has no built-in mapping to an XML structure. Also, you may want to represent Java types in a way that is entirely d 阅读全文
posted @ 2016-05-20 15:48 huey2672 阅读(338) 评论(0) 推荐(0) 编辑
JAXB - Annotations, Annotations for Enums: XmlEnum, XmlEnumValue
摘要:An enum type is annotated with XmlEnum. It has an optional element value of type java.lang.Class which defines the class used for the values used in t 阅读全文
posted @ 2016-05-20 15:35 huey2672 阅读(360) 评论(0) 推荐(0) 编辑
JAXB - Annotations, Class Fields as Attributes: XmlAttribute
摘要:Provided that XML lets you represent a data item as a single value, there is no cut-and-dried rule for deciding between using an element or an attribu 阅读全文
posted @ 2016-05-20 15:30 huey2672 阅读(144) 评论(0) 推荐(0) 编辑
JAXB - Annotations, The Annotation XmlElement
摘要:The basic annotation for a field that's intended to be an element is XmlElement. It permits you to define the XML element name, the namespace, whether 阅读全文
posted @ 2016-05-20 15:28 huey2672 阅读(188) 评论(0) 推荐(0) 编辑
JAXB - Annotations, Controlling Element Selection: XmlAccessorType, XmlTransient
摘要:If JAXB binds a class to XML, then, by default, all public members will be bound, i.e., public getter and setter pairs, or public fields. Any protecte 阅读全文
posted @ 2016-05-20 14:05 huey2672 阅读(351) 评论(0) 推荐(0) 编辑
JAXB - Annotations, The Object Factory: XmlRegistry, XmlElementDecl
摘要:To be able to create objects from XML elements, the unmarshaller must have an object factory with methods for creating all sorts of objects. Therefore 阅读全文
posted @ 2016-05-20 13:11 huey2672 阅读(569) 评论(0) 推荐(0) 编辑
JAXB - Annotations, Annotations for the Schema: XmlSchema
摘要:This annotation can only be used with a package. It defines parameters that are derived from the xsd:schema element. It must be written on a file pack 阅读全文
posted @ 2016-05-20 13:05 huey2672 阅读(173) 评论(0) 推荐(0) 编辑
JAXB - Annotations, Annotation for Classes: XmlType
摘要:This annotation adds information that would be available from a schema type, but isn't implied by a Java class declaration. The annotation has several 阅读全文
posted @ 2016-05-20 12:56 huey2672 阅读(168) 评论(0) 推荐(0) 编辑
JAXB - Annotations, Top-level Elements: XmlRootElement
摘要:A class that describes an XML element that is to be a top-level element, i.e., one that can function as an XML document, should be annotated with XmlR 阅读全文
posted @ 2016-05-20 12:48 huey2672 阅读(472) 评论(0) 推荐(0) 编辑
JAXB - Calling marshal
摘要:Only a handful of source code lines is required to make a JAXB Marshaller object write a document tree as an XML file. First you obtain a Marshaller f 阅读全文
posted @ 2016-05-20 11:07 huey2672 阅读(217) 评论(0) 推荐(0) 编辑
JAXB - The Object Factory
摘要:Usually hidden in the middle of the list of the classes derived from the types defined in an XML schema there will be one class called ObjectFactory. 阅读全文
posted @ 2016-05-20 10:56 huey2672 阅读(381) 评论(0) 推荐(0) 编辑
JAXB - The JAXB Context
摘要:As we have seen, an object of the class JAXBContext must be constructed as a starting point for other operations. One way is to create a context from 阅读全文
posted @ 2016-05-20 10:35 huey2672 阅读(383) 评论(0) 推荐(0) 编辑
JAXB - Hello World with Namespace
摘要:如果元素带有命名空间,那么处理方式与 JAXB - Hello World 会略有不同。 1. XML Schema: 2. 编译 schema 生成 Java 类: 3. 修改生成的 GreetingListType.java 文件,添加 @XmlRootElement,指定根元素的名称和命名空间 阅读全文
posted @ 2016-05-19 21:41 huey2672 阅读(331) 评论(0) 推荐(0) 编辑
JAXB - Validate Document before It is Unmarshalled
摘要:Validation A considerable part of the XML Schema language deals with facets, enabling the programmer to restrict the basic datatypes. We have seen tha 阅读全文
posted @ 2016-05-18 21:19 huey2672 阅读(363) 评论(0) 推荐(0) 编辑
JAXB - Unmarshalling
摘要:A simple approach for unmarshalling an XML document consists of the creation of a JAXB context and the call to unmarshal the document. A JAXBContext o 阅读全文
posted @ 2016-05-18 19:41 huey2672 阅读(242) 评论(0) 推荐(0) 编辑
JAXB - XML Schema Types, Defining Subtypes
摘要:Although object orientation isn't a key feature of XML or the XML Schema language, it's still possible to apply the fundamental OO paradigm when desig 阅读全文
posted @ 2016-05-18 16:26 huey2672 阅读(244) 评论(0) 推荐(0) 编辑
JAXB - XML Schema Types, Defining Types for XML Elements With Content
摘要:Content: A Value The content of an XML element may be some value, or one or more subordinate elements, or even a combination of both. Let's look at an 阅读全文
posted @ 2016-05-18 15:09 huey2672 阅读(368) 评论(0) 推荐(0) 编辑
JAXB - XML Schema Types, Defining Types for XML Elements Without Content
摘要:Types for XML elements are constructed using xsd:complexType, even if they do not have content. The snippet below defines a simple element with two at 阅读全文
posted @ 2016-05-18 14:31 huey2672 阅读(131) 评论(0) 推荐(0) 编辑
JAXB - XML Schema Types, Defining an Enumeration
摘要:If you want a data type that enumerates discrete values you should use a restriction of the schema type xsd:string, enumerating all the values as you 阅读全文
posted @ 2016-05-18 14:16 huey2672 阅读(161) 评论(0) 推荐(0) 编辑
JAXB - XML Schema Types, Binary Data
摘要:Data that has no "natural" representation with printable characters must, for inclusion in an XML file, still be represented in printable characters. 阅读全文
posted @ 2016-05-18 13:54 huey2672 阅读(182) 评论(0) 推荐(0) 编辑
JAXB - XML Schema Types, Date and Time
摘要:JAXB binds all three of the schema types xsd:date, xsd:time and xsd:dateTime to XMLGregorianCalendar. This class is in the package javax.xml.datatype. 阅读全文
posted @ 2016-05-18 13:16 huey2672 阅读(369) 评论(0) 推荐(0) 编辑
JDK Tools - xjc: 将 XML Schema 编译成 Java 类
摘要:xjc 是 JAXB 将 xsd 生成 Java 类的工具。 命令格式 xjc [ options ] schema file/URL/dir/jar ... [-b bindinfo ] ... 命令参数 -d dir 在指定的目录生成 Java 类。指定的目录必须是已存在的,XJC 不会创建该目 阅读全文
posted @ 2016-05-18 12:22 huey2672 阅读(499) 评论(0) 推荐(0) 编辑
Table of Contents - JAXB
摘要:Getting Started Hello World Hello World with Namespace xjc - 将 XML Schema 编译成 Java 类 wsimport: 编译 WSDL 生成 JAX-WS 规范的 Java 类 Writing an XML Schema for 阅读全文
posted @ 2016-05-18 10:22 huey2672 阅读(182) 评论(0) 推荐(0) 编辑
JAXB - Hello World
摘要:We'll stick with the tradition and use a sort of "Hello World" XML document to illustrate the typical scenario for creating the Java classes and their 阅读全文
posted @ 2016-05-18 10:05 huey2672 阅读(199) 评论(0) 推荐(0) 编辑
Table of Contents - JavaSE
摘要:Java Bean Lombok IO Commons-IO - IOUtils Regular Expression 正则表达式常用操作 Concurrency java.util.concurrent API Class Diagram 线程管理 线程的基础操作 ThreadFactory, 使 阅读全文
posted @ 2016-05-18 09:36 huey2672 阅读(345) 评论(0) 推荐(0) 编辑
Servlet & JSP - Form-based Authentication
摘要:基本认证和摘要认证都只能使用浏览器自带的登录框而不能使用自定义的登录页面。如果必须使用自定义的登录页面,则可以选择基于表框的认证方式。 基于表框的认证的配置与基本认证和摘要认证的差别在于部署描述符中 <login-config/> 元素的设置不同: 基于表单的认证方式需将 auth-method 置 阅读全文
posted @ 2016-05-14 17:51 huey2672 阅读(513) 评论(0) 推荐(0) 编辑
Tomcat - 设置 HTTP 摘要认证
摘要:在 Tomcat 中设置 HTTP 摘要认证的示例 在 Tomcat 中设置摘要认证与设置基本认证几乎一样,差别在于配置 web.xml 时,<login-config/> 元素在指定认证方法时,基本认证设置 auth-method 为 BASIC,而摘要认证设置 auth-method 为 DIG 阅读全文
posted @ 2016-05-14 10:15 huey2672 阅读(723) 评论(0) 推荐(0) 编辑
HTTP - 摘要认证
摘要:基本认证便捷灵活,但极不安全。用户名和密码都是以明文形式传送的,也没有采取任何措施防止对报文的篡改。安全使用基本认证的唯一方式就是将其与 SSL 配合使用。 摘要认证是另一种 HTTP 认证协议,它与基本认证兼容,但却更为安全。摘要认证试图修复基本认证协议的严重缺陷。具体来说,摘要认证进行了如下改下 阅读全文
posted @ 2016-05-13 22:17 huey2672 阅读(7853) 评论(0) 推荐(0) 编辑
Table of Contents - Tomcat
摘要:Manager 持久化 Session JNDI Resources JNDI 配置 JDBC DataSources DBCP 配置 Realm Configuration 设置 HTTP 基本认证 设置 JDBCRealm 阅读全文
posted @ 2016-05-12 16:24 huey2672 阅读(138) 评论(0) 推荐(0) 编辑
Table of Contents - JMS
摘要:JMS Specification v1.1 JMS 基本概念 Message QueueBrowser 消息选择器 消息确认 ConnectionMetaData ExceptionListener 事务性消息 Temporary Destination Exceptions 阅读全文
posted @ 2016-05-12 16:01 huey2672 阅读(143) 评论(0) 推荐(0) 编辑
Commons IO - IOUtils
摘要:IOUtils is a general IO stream manipulation utilities. This class provides static utility methods for input/output operations. closeQuietly - these me 阅读全文
posted @ 2016-05-12 11:21 huey2672 阅读(509) 评论(0) 推荐(0) 编辑
Servlet & JSP - Decorating Requests and Responses
摘要:Servlet API 提供了四个包装类:ServletRequestWrapper、ServletResponseWrapper、HttpServletRequestWrapper、HttpServletReponseWrapper。这些包装类使用的频率很小,但却很有用。当 servlet 接收到 阅读全文
posted @ 2016-05-11 19:55 huey2672 阅读(278) 评论(0) 推荐(0) 编辑
设计模式 - 装饰者模式
摘要:装饰者模式:在不改变原类文件和使用继承的情况下,动态地扩展一个对象的功能。它是通过创建一个包装对象,也就是装饰来包裹真实的对象。 装饰者模式中的角色 抽象组件:是一个接口或抽象类,就是定义最核心的对象,也是最原始的对象,这个类是需要装饰类的基类。 具体组件:是被装饰者的一个实现类,要装饰的就是这个具 阅读全文
posted @ 2016-05-11 13:14 huey2672 阅读(157) 评论(0) 推荐(0) 编辑
Table of Contents - Spring
摘要:The IoC container Spring 容器 属性注入 & 构造注入 Bean 实例的创建方式 p-namespace & c-namespace 集合属性的注入 作用域 延迟实例化 基于 Annotation 的配置 @Resoure & @Autowired 生命周期 depends- 阅读全文
posted @ 2016-05-10 19:26 huey2672 阅读(279) 评论(0) 推荐(0) 编辑
Table of Contents - CXF
摘要:Getting Started A simple JAX-WS service Writing a service with Spring Tools WSDL to Java RESTful Services A simple JAX-RS service JSON Support 阅读全文
posted @ 2016-05-10 19:18 huey2672 阅读(158) 评论(0) 推荐(0) 编辑
Table of Contents - Lombok
摘要:Installation Lombok Annotations @Getter, @Setter, @ToString, @EqualsAndHashCode & @Data @NoArgsConstructor, @RequiredArgsConstructor & @AllArgsConstru 阅读全文
posted @ 2016-05-10 19:08 huey2672 阅读(173) 评论(0) 推荐(0) 编辑
Table of Contents - Quartz Scheduler
摘要:Getting Started Hello World Integration with Spring Quartz Scheduler Developer Guide Usage of JobDataMap Usage of Calendars Usage of SimpleTrigger Usa 阅读全文
posted @ 2016-05-10 19:03 huey2672 阅读(180) 评论(0) 推荐(0) 编辑
Servlet & JSP - UrlRewriteFilter
摘要:重写 URL 的好处有很多: UrlRewriteFilter 的简单应用 1. Maven 依赖 2. 配置 web.xml: 3. 配置 /WEB-INF/urlrewrite.xml: 4. 当在浏览器键入 http://www.yourapp.com/items/9999.html 时,请求 阅读全文
posted @ 2016-05-10 16:32 huey2672 阅读(248) 评论(0) 推荐(0) 编辑
Servlet & JSP - Filter
摘要:过滤器可以对用户的请求拦截,进行预处理操作,接着将请求交给 Servlet 处理并生成响应,最后再对响应拦截,进行后处理操作。过滤器应用的场景有:用户登录、加密解密、会话校验等。 Filter API 过滤器必须继承 javax.servlet.Filter 接口。Filter 接口暴露三个生命周期 阅读全文
posted @ 2016-05-10 15:11 huey2672 阅读(256) 评论(0) 推荐(0) 编辑
Servlet & JSP - Listener
摘要:Servlet API 中的 6 个事件类 1. ServletContextEvent:该类表示上下文事件,当应用上下文对象发生改变,例如创建或销毁上下文对象时,将触发上下文事件。 2. ServletContextAttributeEvent:该类表示上下文属性事件,当应用上下文属性发生改变,例 阅读全文
posted @ 2016-05-09 11:30 huey2672 阅读(180) 评论(0) 推荐(0) 编辑
Servlet & JSP - HttpSession
摘要:关于 Session 的内容,参考 HTTP - Session 机制 创建和检索 HttpSession 通过 HttpServletRequest.getSession 方法可以获取 HttpSession 实例。HttpServletRequest 有两个重载的 getSession 方法: 阅读全文
posted @ 2016-05-05 13:46 huey2672 阅读(226) 评论(0) 推荐(0) 编辑
HTTP - Session 机制
摘要:HTTP 是种无状态的协议,即使用 HTTP 协议时,每次发送请求都会产生对应的新响应,协议本身不会保留之前一切的请求或响应报文的信息。这是为了更快地处理大量事务,确保协议的可伸缩性,而特意把 HTTP 协议设计成简单化。随着 Web 的不断发展,因无状态而导致业务处理变得棘手的情况增多了。比如,用 阅读全文
posted @ 2016-05-05 12:37 huey2672 阅读(473) 评论(0) 推荐(0) 编辑
Servlet & JSP - 中文字符问题
摘要:Servlet 中的中文字符 来自 URL 参数部分的中文字符 Tomcat 默认接收数据的编码是 ISO-8859-1。所以当请求 URL 的参数部分含有中文字符,需要转换字符的编码。 上述的方法的一个不足是:需要对所有的参数部分解码。可以直接在 Tomcat 的 server.xml 中将默认的 阅读全文
posted @ 2016-05-02 16:40 huey2672 阅读(314) 评论(0) 推荐(0) 编辑
Servlet & JSP - Cookie
摘要:关于 Cookie 的内容,参考 HTTP - Cookie 机制 获取来自客户端的 cookie request.getCookies 方法可以获取来自 HTTP 请求的 cookie,返回的是 javax.servlet.http.Cookie 数组。 很遗憾,没有诸如 getCookieByN 阅读全文
posted @ 2016-05-02 15:19 huey2672 阅读(237) 评论(0) 推荐(0) 编辑


点击右上角即可分享
微信分享提示