RESTful API
- 尽量朝着RESTFul方向努力,但用户认证的仍难免
- 要统一访问URL,不应当有重复功能的定义
- 要能够被缓存,且条件缓存
Codes.java
public interface Codes {
interface GENDER{
Short UNKNOWN=0;
Short MALE=1;
Short FEMALE=2;
}
}
Config.java
PagedRecords.java
public class PagedRecords<E> implements Serializable {
private static final long serialVersionUID = 1L;
private Integer totalCount = 0;
private Integer startIndex;
private List<E> data = Collections.emptyList();
}
JsonMessage.java
package com.tc.his.web.vo;
import java.io.Serializable;
public class JsonMessage implements Serializable {
private static final long serialVersionUID = 1L;
private Integer status = STATUS_SUCCESS;
private String msg;
private Object result;
}
log
自定义错误画面
- 要能根据请求返回HTML或者JSON
- 要通过配置,可以在HTML中开发时显示错误堆栈,上线时不显示
- 要通过自定义的Error Controllor或resolver将错误记录到日志里? DB中?