`
chenying998179
  • 浏览: 25679 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
安全性是Java应用程序的非功能性需求的重要组成部分,如同其它的非功能性需求一样,安全性很容易被开发人员所忽略。当然,对于Java EE的开发人员来说,安全性的话题可能没那么陌生,用户认证和授权可能是绝大部分Web应用都有的功能。类似Spring Security这样的框架,也使得开发变得更加简单。本文并不会讨论Web应用的安全性,而是介绍Java安全一些底层和基本的内容。 认证 用户认证是应用安全性的重要组成部分,其目的是确保应用的使用者具有合法的身份。 Java安全中使用术语主体(Subject)来表示访问请求的来源。一个主体可以是任何的实体。一个主体可以有多个不同的身份标识(Pr ...
安装 Hibernate Annotations为了使用Hibernate Annotations,你需要最新的Hibernate 3.2 ,当然还有Java 5 你可以在Hibernate web site 这个网站下载Hibernate 3.2和Hibernate Annotations库.除了标准的Hibernate 库文件和必须的依赖库之外,还需要下载 Hibernate Annotations库和Java 持久化API ---ejb3-persstence.jar文件.如果你正在使用Maven,仅仅添加相应的依赖到你的DOM文件里,如下所示: ...     <depende ...
Spring has an awesome feature to deal with Hibernate. For a traditional Hibernate application, you need a hibernate configuration file, a number of mapping files for tables. But Spring reduces that overhead and introduces a new Annotation based mapping. At last, we dont need to brag with that XML ...
To learn any web framework starting with a HelloWorld application is a good idea. Once we get familiarity with the framework configuration it would be better to do a CRUD (Create,Read,Update,Delete) application which covers various aspects of a web framework like Validations, Request URL Mappings, Re ...
  The Singleton pattern is used when you need one, and only one instance of your class. Sometimes you see this pattern used in cases where the construction of a class is expensive (like a file stream). It can be lazy loaded (at runtime instead of compiletime) and must be thread-safe. The class gets ...
Another day, another pattern. The Observer Pattern provides a mechanism for receiving push-based notifications (like events). It separates the Subject from the Observer (separation of concerns). The original pattern by the Group of Four was implemented with base classes, but as of .NET 4 we welcom ...
The Strategy Pattern is a proven design construct to vary operations or algorithms independently from the clients that use it. The pattern underwrites the Open / Closed Principle of S.O.L.I.D., stating that a class should be open to extension, but closed to modification. It also keeps a clean sepa ...
The Command Pattern makes a execution request into an object. This makes it possible to store, search and transport requests and let clients call them via a common interface. This pattern is often used to implement undo or macro operations. A command has a execution method without any parameters t ...
  The Repository Pattern is a common construct to avoid duplication of data access logic throughout our application. This includes direct access to a database, ORM, WCF dataservices, xml files and so on. The sole purpose of the repository is to hide the nitty gritty details of accessing the data. We ...
The Chain of Responsibility pattern takes a request and flows through a chain of handlers. Each handler checks if it can handle the request according to some business rules. If the handler can’t handle the request it gets passed to the next handler in the chain. The client doesn’t know which handl ...
Null checks are quite common in the code I write. It litters up my class methods with all kinds of exception handling. The Null Object Design Pattern helps me to avoid this checking for null. It provides a non functional object to the client instead of null. So I can call a method on this object t ...
在使用MyBatis做持久层时,insert语句默认是不返回记录的主键值,而是返回插入的记录条数;如果业务层需要得到记录的主键时,可以通过配置的方式来完成这个功能 针对Sequence主键而言,在执行insert sql前必须指定一个主键值给要插入的记录,如Oracle、DB2,可以采用如下配置方式: <insert id="add" parameterType="vo.Category"> <selectKey resultType="java.lang.Short" order=" ...

spring mvc 2

    博客分类:
  • java
视图解析器 spring mvc的action返回的是一个逻辑视图名,视图解析器根据逻辑视图名,查找视图解析器,直到一个能处理的视图解析器存在,交给它处理。它会将逻辑视图转换成物理视图。 它支持多个视图解析器同时存在。可以把他们看成是一个链结构。必要时,也可以通过order属性来声明每个解析器的序列。 要记住的是,某个解析器的order越高, 它在解析链中的位置越靠后。 如果返回的逻辑视图名带有redirect:前缀 ,那么这个视图将被认为是重定向 如果返回的逻辑视图名带有forward:前缀,那么这个视图被认为是跳转。 spring提供的视图解析器有 AbstractCachingViewRe ...

spring mvc

    博客分类:
  • java
spring-mvc 如图 请求首先通过DispatcherServlet。servlet根据HandlerMapping,来处理请求,并根据请求,来找到Controller,Controller执行完毕后,发送一个ModelAndView,并告诉需要展示哪个视图。根据这个视图,servlet找到这个视图的ViewResolver,并由这个ViewResolver生成对应的view,并输出。 配置servlet springmvc是基于servlet的,因此需要在web.xml配置。 <servlet> <servlet-name>roadrantz</servle ...
JDK动态代理   JDK 动态代理是 java 反射的一个重要特性。它在某种方面为 java 提供了动态性的特性,给应用带来了无限的空间。大名鼎鼎的 Hessian 、 Spring AOP 基于动态代理实现。本文将简单的介绍 JDK 动态代理使用。   1.关 ...
Global site tag (gtag.js) - Google Analytics