This RESTful framework was developed by following:
- jersey 2 for RESTful.
- maven for repository management.
- hibernate ORM and mysql jdbc for Database.
So, you have to know about these frameworks and libraries. Getting Started
- Upgrade maven libraries
- Remove and Reduce
- Remove SESSION management to prevent multi session creation
- Remove JSP Web Page
- Remove application path "api"
- Generate upload directory ({basePath}/upload) if does not exist in setting (com.sdm.path.upload)
- Remove GeoIPCache
- Hide (Null/Empty) property in JSON Response
- Change routeList path (sample/customers/route => /sample/customers/~info)
- Auth allowed userName/email
- Performance Improvement and Bug Fixed
- Use Exceptions instead of MessageModel for ErrorMessages
- Changed JSP Template => Velocity Template
- Full Info for User AuditInfo
- Support Firebase Cloud Messaging
MessageModel(204, "...") => throw new NullPointerException("...")
MessageModel(400, "...") => throw new InvalidRequestException("...", "...", "...")
@Path("sample/customers")
public class CustomerResource extends RestResource<CustomerEntity, Integer> {
public CustomerResource() {
super();
}
}
- Clone or download the project from github
- Open project in Java IDE such as Eclipse, NetBeans, etc ...
- Clone following setting files:
- example.hibernate.cfg.xml => hibernate.cfg.xml
- example.log4j.properties => log4j.properties
- example.setting.properties => setting.properties
- Edit require properties from setting files.
Change database configuration at (line: 8-11)
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/{your_db_schema}?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8</property>
<property name="hibernate.connection.username">{your_db_user}</property>
<property name="hibernate.connection.password">{your_db_password}</property>
<property name="hibernate.default_schema">{your_db_schema}</property>
Change Log directory name at (line: 15)
log4j.appender.fileAppender.File={your_log_directory}/sundew-api.log
Change directory for system at (line: 9, 10)
com.sdm.path={system_root_directory}
com.sdm.path.storage={file_upload_directory}
Change mail setting for system mail service at (line: 45-49). You can use your gmail account.
com.sdm.mail.host=smtp.gmail.com
com.sdm.mail.port=465
com.sdm.mail.is_auth=true
com.sdm.mail.user={your_gmail_account}
com.sdm.mail.password={your_gmail_password}
- Naming Standard
- Property => camelCase
- Class => {ObjectNameWithCamelCase}Entity
- Naming Standard
- Class => {ResourceNameWithCamelCase}Resource
- Naming Standard
- Property => camelCase
- Class => {ObjectNameWithCamelCase}Request
- Naming Standard
- Property => camelCase
- Class => {ObjectNameWithCamelCase}Response
- Naming Standard
- Property => camelCase
- Class => {ObjectNameWithCamelCase}DAO
- Table => tbl_{name_with_snake_case}
- View => vw_{name_with_snake_case}
- Procedure => proc_{name_with_snake_case}
- User Columns => {nameWithCamelCase}