Compare commits
106 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ea740edf1 | ||
|
|
716f4e6934 | ||
|
|
90ab302667 | ||
|
|
4695949362 | ||
|
|
4827893a0d | ||
|
|
9276f220b0 | ||
|
|
4071a5d165 | ||
|
|
da0ff24af6 | ||
|
|
afef635146 | ||
|
|
eda9d1c780 | ||
|
|
4b5749bc60 | ||
|
|
6bb23008c2 | ||
|
|
7746971b60 | ||
|
|
bc20c82fef | ||
|
|
fff70ed241 | ||
|
|
c590d45ce0 | ||
|
|
8bab9ad22b | ||
|
|
3c457dad2a | ||
|
|
eaae598234 | ||
|
|
606faf1bf8 | ||
|
|
ae9aa94323 | ||
|
|
2e41e44294 | ||
|
|
d806d9d6ff | ||
|
|
1260736c14 | ||
|
|
08c5cbbbf3 | ||
|
|
af0726cd79 | ||
|
|
ce2279030d | ||
|
|
83aba2ebee | ||
|
|
5c11742b51 | ||
|
|
5295e04275 | ||
|
|
47f723e63b | ||
|
|
54956e47d2 | ||
|
|
b2cbdf6642 | ||
|
|
989d1c6db9 | ||
|
|
e139b0cc5d | ||
|
|
66261e98b5 | ||
|
|
d9a268d30a | ||
|
|
a8bc50a947 | ||
|
|
6aa96daae2 | ||
|
|
293805a55e | ||
|
|
8b6319888c | ||
|
|
408676e97a | ||
|
|
1fabbae4f6 | ||
|
|
09a5b41d96 | ||
|
|
9d85a4dcaf | ||
|
|
9bc60c1c47 | ||
|
|
92aff864ef | ||
|
|
254e2e8ccd | ||
|
|
2480d127ac | ||
|
|
cc3d82e864 | ||
|
|
ee712c55a0 | ||
|
|
79f70266e4 | ||
|
|
3ffb8d510d | ||
|
|
e55fc1a421 | ||
|
|
ee9fb4a9b8 | ||
|
|
ef3536beed | ||
|
|
fbababaf40 | ||
|
|
4548cf78d6 | ||
|
|
86a219e3e1 | ||
|
|
9e0876dee2 | ||
|
|
e9096372d3 | ||
|
|
cef367c693 | ||
|
|
2634524439 | ||
|
|
10d27bf78c | ||
|
|
5b7739b26b | ||
|
|
11f895a0ca | ||
|
|
63099b72be | ||
|
|
0d8f7a4fa2 | ||
|
|
83f460660b | ||
|
|
786d25678b | ||
|
|
f57d8325b3 | ||
|
|
22adab4f93 | ||
|
|
805e3910c4 | ||
|
|
ecd827e3b4 | ||
|
|
19150e9f9c | ||
|
|
de5a725acc | ||
|
|
aae2305274 | ||
|
|
00ba1ecee9 | ||
|
|
e59465eaf9 | ||
|
|
6f0b4604fc | ||
|
|
9f97f81bae | ||
|
|
ffcd04a626 | ||
|
|
ecf102aff3 | ||
|
|
c16b0b520d | ||
|
|
2f25ee1c05 | ||
|
|
b5011fa069 | ||
|
|
55e2109764 | ||
|
|
5cf4c8a95a | ||
|
|
6b319caa28 | ||
|
|
b97a23930a | ||
|
|
6c918a6c95 | ||
|
|
20ba119f93 | ||
|
|
95ca74f9f9 | ||
|
|
f28cbb4ac5 | ||
|
|
e3f851ed1f | ||
|
|
d3cf414c51 | ||
|
|
ea98bb814f | ||
|
|
515e8256cc | ||
|
|
903c58b239 | ||
|
|
1c59c86ba2 | ||
|
|
b2c6dd2db2 | ||
|
|
beffe53d4d | ||
|
|
4eb5edaef2 | ||
|
|
ba07d343ae | ||
|
|
c887a9dc4c | ||
|
|
689cdca004 |
@@ -8,17 +8,17 @@
|
||||
<li>提供HTTP服务,同时内置JSON功能与限时缓存功能</li>
|
||||
<li>TCP层完全使用NIO.2,并统一TCP与UDP的接口换</li>
|
||||
<li>提供分布式与集中式部署的无缝切换</li>
|
||||
<li>提供类似JPA功能,并包含数据缓存自动同步与简洁的数据层操作接口</li>
|
||||
<li>提供类似JPA功能,包含数据缓存自动同步、分表分库与简洁的数据层操作接口</li>
|
||||
<li>可以动态修改已依赖注入的资源</li>
|
||||
</ol>
|
||||
|
||||
<strong>Redkale 设计理念</strong>
|
||||
<p>
|
||||
作为一个全新的微服务框架,不仅是使用了Java8的新语法,更多是设计上与主流框架有所不同。Redkale是按组件形式设计的,而非以容器为主,几乎每个子包都是能提供独立功能的组件。如Tomcat是按容器设计的,所有web资源/配置由Tomcat控制,开发者很能难控制到Tomcat内部,而Redkale的HTTP服务只是个组件,开发者既可以自己启动和配置HttpServer,也可以把Redkale当成容器通过Redkale进程来初始化服务。Spring的Ioc容器也是如此,Redkale提供的依赖注入仅通过ResouceFactory一个类来控制,非常轻量,而且也可以动态更改已注入的资源。Spring提倡控制反转思想,偏偏自身的容器却让开发者很难控制。Redkale是一个既能以组件形式也能以容器形式存在的框架。从整体上看,Redkale的架构分两层:接口和默认实现。若开发者不想使用Redkale内置的HTTP服务而使用符合JavaEE规范的HttpServlet, 可以采用自定义协议基于JSR 340(Servlet 3.1)来实现自己的HTTP服务;若开发者想使用Hibernate作为数据库操作,可以写一个自己的DataSource实现类;JSON的序列化和反序列化也可以使用第三方的实现。这其实包含了控制反转的思想,让框架里的零件可以让开发者控制。<br/>
|
||||
与主流框架比,功能上Redkale显得很简单,这也是Redkale的一个特点并非不足,从一个良好的设计习惯或架构上来看,有些常用功能是不需要提供的,比如Redkale的HTTP服务不支持HTTPS和JSP,HTTPS比HTTP多了一层加密解密,这种密集的数字计算不是Java的专长,同时一个稍好的提供HTTP服务的架构不会将Java动态服务器放在最前端,通常前面会放nginx或apache,除了负载均衡还能静动分离,既然Java服务器前面有C写的服务器,那么HTTPS的加解密就应该交给前面的服务器处理。Redkale再提供HTTPS服务就显得鸡肋。JSP其实算是一个落后的技术,现在是一个多样化终端的时代,终端不只局限于桌面程序和PC浏览器,还有原生App、混合式App、微信端、移动H5、提供第三方接口等各种形式的终端,这些都不是JSP能兼顾的,而HTTP+JSON作为通用性接口可以避免重复开发,模版引擎的功能加上各种强大的JS框架足以取代JSP(如果初级程序员还花大量时间去学习基于JSP的Struts或Spring MVC框架,就有点跟不上时代了)。Redkale在功能上做了筛选,不会只因为迎合主流而提供,而是以良好的设计思想为指导。这也是Redkale很重要的一个思想。
|
||||
作为一个全新的微服务框架,Redkale在接口定义上使用了Java 8大量的新语法,接口有默认实现、接口带静态方法、重复注解等特性,同时在设计上与主流框架有很大不同。Redkale是按组件形式设计的,而非以容器为主,几乎每个子包都是能提供独立功能的组件。如Tomcat是按容器设计的,所有web资源/配置由Tomcat控制,开发者很能难控制到Tomcat内部,而Redkale的HTTP服务只是个组件,开发者既可以自己启动和配置HttpServer,也可以把Redkale当成容器通过Redkale进程来初始化服务。Spring的Ioc容器也是如此,Redkale提供的依赖注入仅通过ResouceFactory一个类来控制,非常轻量,并且可动态更改已注入的资源。Spring提倡控制反转思想,而自身的容器却让开发者很难控制。Redkale是一个既能以组件形式也能以容器形式存在的框架。从整体上看,Redkale的架构分两层:接口和默认实现。开发者若想替换掉Redkale内置的HTTP服务而使用符合JavaEE规范的HttpServlet, 可以采用自定义协议基于JSR 340(Servlet 3.1)来实现自己的HTTP服务;若想使用Hibernate作为数据库操作,可以写一个自己的DataSource实现类;JSON的序列化和反序列化也可以使用第三方的实现;Memcached或Redis也可以作为另一个CacheSource的实现替换Redkale的默认实现。这其实包含了控制反转的思想,让框架里的各个组件均可让开发者控制。<br/>
|
||||
与主流框架比,功能上Redkale显得很简单,这体现了Redkale的简易性,而并非是不足,从一个良好的设计习惯或架构上来看,有些常用功能是不需要提供的,如Redkale的HTTP服务不支持HTTPS和JSP,HTTPS比HTTP多了一层加密解密,这种密集型的计算不是Java的专长,通常提供HTTP服务的架构不会将Java动态服务器放在最前端,而是在前方会放nginx或apache,除了负载均衡还能静动分离,因此HTTPS的加解密应交给nginx这样的高性能服务器处理。Redkale再提供HTTPS服务就显得鸡肋。JSP其实算是一个落后的技术,现在是一个多样化终端的时代,终端不只局限于桌面程序和PC浏览器,还有原生App、混合式App、微信端、移动H5、提供第三方接口等各种形式的终端,这些都不是JSP能方便兼顾的,而HTTP+JSON作为通用性接口可以避免重复开发,模版引擎的功能加上各种强大的JS框架足以取代JSP。Redkale在功能上做了筛选,不会为了迎合主流而提供,而是以良好的设计思想为指导。这是Redkale的主导思维。
|
||||
</p>
|
||||
|
||||
|
||||
由于RedKale使用了JDK 8 内置的ASM包,所以需要在源码工程中的编译器选项中加入: <b>-XDignore.symbol.file=true</b>
|
||||
|
||||
<h5>详情请访问: <a href='http://redkale.org' target='_blank'>http://redkale.org</a></h5>
|
||||
<h5>详情请访问: <a href='https://redkale.org' target='_blank'>https://redkale.org</a></h5>
|
||||
|
||||
158
pom.xml
158
pom.xml
@@ -1,158 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.redkale</groupId>
|
||||
<artifactId>redkale</artifactId>
|
||||
<name>Redkale</name>
|
||||
<packaging>jar</packaging>
|
||||
<url>http://redkale.org</url>
|
||||
<!-- -SNAPSHOT
|
||||
mvn clean deploy -P release -Dgpg.passphrase=password
|
||||
mvn release:clean release:prepare release:perform
|
||||
-->
|
||||
<version>1.0.0-rc1</version>
|
||||
|
||||
<description>Redkale is a Microservices Framework written in Java</description>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<compilerArguments>
|
||||
<verbose />
|
||||
<bootclasspath>${java.home}/lib/rt.jar</bootclasspath>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>org.redkale.boot.Application</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.3</version>
|
||||
<configuration>
|
||||
<charset>${file_encoding}</charset>
|
||||
<encoding>${file_encoding}</encoding>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-compiler-javac</artifactId>
|
||||
<version>2.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>3.0.22</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release-sign-artifacts</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>performRelease</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<scm>
|
||||
<url>https://github.com/redkale/redkale/tags/redkale-1.0.0-rc1</url>
|
||||
<connection>scm:svn:https://github.com/redkale/redkale/tags/redkale-1.0.0-rc1</connection>
|
||||
</scm>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>redkale</id>
|
||||
<name>redkale</name>
|
||||
<email>redkale@qq.com</email>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache 2</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
<comments>A business-friendly OSS license</comments>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>ossrh</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
@@ -137,7 +137,7 @@
|
||||
includes:当autoload="true", 拉取类名与includes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
|
||||
excludes:当autoload="true", 排除类名与excludes中的正则表达式匹配的类, 多个正则表达式用分号;隔开
|
||||
-->
|
||||
<rest base="org.redkale.net.http.DefaultRestServlet" mustsign="false" autoload="true" includes="" excludes="">
|
||||
<rest base="org.redkale.net.http.DefaultRestServlet" mustsign="true" autoload="true" includes="" excludes="">
|
||||
<!--
|
||||
value: Service类名,列出的表示必须被加载的Service对象
|
||||
ignore: 是否忽略,设置为true则不会加载该Service对象,默认值为false
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
<!--
|
||||
javax.persistence.jdbc.driver在JPA的值是JDBC驱动,Redkale有所不同,值应该是javax.sql.DataSource的子类。
|
||||
为了兼容用户习惯,Redkale内置常见JDBC驱动到javax.sql.DataSource的映射关系:
|
||||
com.mysql.jdbc.Driver —————— com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
|
||||
org.mariadb.jdbc.Driver —————— org.mariadb.jdbc.MySQLDataSource
|
||||
org.postgresql.Driver —————— org.postgresql.ds.PGConnectionPoolDataSource
|
||||
com.mysql.jdbc.Driver —————— com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
|
||||
oracle.jdbc.driver.OracleDriver —————— oracle.jdbc.pool.OracleConnectionPoolDataSource
|
||||
com.microsoft.sqlserver.jdbc.SQLServerDriver —————— com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource
|
||||
因此 com.mysql.jdbc.Driver 会被自动转换成 com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
|
||||
@@ -23,13 +24,13 @@
|
||||
<!-- 最大连接数,默认值:CPU数*16 -->
|
||||
<property name="javax.persistence.connections.limit" value="32"/>
|
||||
|
||||
<!-- 包含的SQL模板,相当于反向LIKE,不同的JDBC驱动的SQL语句不一样,Redkale内置了MySQL、Oracle、Sqlserver的语句 -->
|
||||
<!-- 包含的SQL模板,相当于反向LIKE,不同的JDBC驱动的SQL语句不一样,Redkale内置了MySQL的语句 -->
|
||||
<property name="javax.persistence.contain.sqltemplate" value="LOCATE(${keystr}, ${column}) > 0"/>
|
||||
<property name="javax.persistence.notcontain.sqltemplate" value="LOCATE(${keystr}, ${column}) = 0"/>
|
||||
|
||||
<!-- 复制表结构的SQL模板,Redkale内置了MySQL的语句 -->
|
||||
<property name="javax.persistence.tablenotexist.sqlstates" value="42000;42S02"/>
|
||||
<property name="javax.persistence.tablecopy.sqltemplate" value="CREATE TABLE ${newtable} LIKE ${oldtable}"/>
|
||||
<property name="javax.persistence.tablecopy.sqltemplate" value="CREATE TABLE ${newtable} LIKE ${oldtable}"/>
|
||||
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
|
||||
@@ -61,6 +61,13 @@ public @interface Column {
|
||||
*/
|
||||
String name() default "";
|
||||
|
||||
/**
|
||||
* (Optional) The comment of the column.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
String comment() default "";
|
||||
|
||||
/**
|
||||
* (Optional) Whether the column is a unique key. This is a
|
||||
* shortcut for the <code>UniqueConstraint</code> annotation at the table
|
||||
@@ -96,17 +103,6 @@ public @interface Column {
|
||||
*/
|
||||
boolean updatable() default true;
|
||||
|
||||
/**
|
||||
* (Optional) The SQL fragment that is used when
|
||||
* generating the DDL for the column.
|
||||
* <p>
|
||||
* Defaults to the generated SQL to create a
|
||||
* column of the inferred type.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
String columnDefinition() default "";
|
||||
|
||||
/**
|
||||
* (Optional) The name of the table that contains the column.
|
||||
* If absent the column is assumed to be in the primary table.
|
||||
|
||||
@@ -40,4 +40,11 @@ public @interface Entity {
|
||||
* @return String
|
||||
*/
|
||||
String name() default "";
|
||||
|
||||
/**
|
||||
* (Optional) The comment of the entity.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
String comment() default "";
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*******************************************************************************
|
||||
/** *****************************************************************************
|
||||
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
@@ -12,7 +12,7 @@
|
||||
* Linda DeMichiel - Java Persistence 2.1
|
||||
* Linda DeMichiel - Java Persistence 2.0
|
||||
*
|
||||
******************************************************************************/
|
||||
***************************************************************************** */
|
||||
package javax.persistence;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
@@ -23,13 +23,14 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* Provides for the specification of generation strategies for the
|
||||
* values of primary keys.
|
||||
* values of primary keys.
|
||||
*
|
||||
* <p> The <code>GeneratedValue</code> annotation
|
||||
* <p>
|
||||
* The <code>GeneratedValue</code> annotation
|
||||
* may be applied to a primary key property or field of an entity or
|
||||
* mapped superclass in conjunction with the {@link Id} annotation.
|
||||
* The use of the <code>GeneratedValue</code> annotation is only
|
||||
* required to be supported for simple primary keys. Use of the
|
||||
* required to be supported for simple primary keys. Use of the
|
||||
* <code>GeneratedValue</code> annotation is not supported for derived
|
||||
* primary keys.
|
||||
*
|
||||
@@ -58,22 +59,5 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
@Retention(RUNTIME)
|
||||
|
||||
public @interface GeneratedValue {
|
||||
/**
|
||||
* (Optional) The primary key generation strategy
|
||||
* that the persistence provider must use to
|
||||
* generate the annotated entity primary key.
|
||||
* @return GenerationType
|
||||
*/
|
||||
@Deprecated
|
||||
GenerationType strategy() default GenerationType.AUTO;
|
||||
|
||||
/**
|
||||
* (Optional) The name of the primary key generator
|
||||
* to use as specified in the SequenceGenerator
|
||||
* or TableGenerator annotation.
|
||||
* <p> Defaults to the id generator supplied by persistence provider.
|
||||
* @return String
|
||||
*/
|
||||
@Deprecated
|
||||
String generator() default "";
|
||||
}
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
|
||||
* which accompanies this distribution.
|
||||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
|
||||
* and the Eclipse Distribution License is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* Contributors:
|
||||
* Linda DeMichiel - Java Persistence 2.1
|
||||
* Linda DeMichiel - Java Persistence 2.0
|
||||
*
|
||||
******************************************************************************/
|
||||
package javax.persistence;
|
||||
|
||||
/**
|
||||
* Defines the types of primary key generation strategies.
|
||||
*
|
||||
* @see GeneratedValue
|
||||
*
|
||||
* @since Java Persistence 1.0
|
||||
*/
|
||||
public enum GenerationType {
|
||||
|
||||
/**
|
||||
* Indicates that the persistence provider must assign
|
||||
* primary keys for the entity using an underlying
|
||||
* database table to ensure uniqueness.
|
||||
*/
|
||||
TABLE,
|
||||
|
||||
/**
|
||||
* Indicates that the persistence provider must assign
|
||||
* primary keys for the entity using a database sequence.
|
||||
*/
|
||||
SEQUENCE,
|
||||
|
||||
/**
|
||||
* Indicates that the persistence provider must assign
|
||||
* primary keys for the entity using a database identity column.
|
||||
*/
|
||||
IDENTITY,
|
||||
|
||||
/**
|
||||
* Indicates that the persistence provider should pick an
|
||||
* appropriate strategy for the particular database. The
|
||||
* <code>AUTO</code> generation strategy may expect a database
|
||||
* resource to exist, or it may attempt to create one. A vendor
|
||||
* may provide documentation on how to create such resources
|
||||
* in the event that it does not support schema generation
|
||||
* or cannot create the schema resource at runtime.
|
||||
*/
|
||||
AUTO
|
||||
}
|
||||
69
src/javax/persistence/Index.java
Normal file
69
src/javax/persistence/Index.java
Normal file
@@ -0,0 +1,69 @@
|
||||
/** *****************************************************************************
|
||||
* Copyright (c) 2011 - 2013 Oracle Corporation. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
|
||||
* which accompanies this distribution.
|
||||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
|
||||
* and the Eclipse Distribution License is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* Contributors:
|
||||
* Linda DeMichiel - Java Persistence 2.1
|
||||
*
|
||||
***************************************************************************** */
|
||||
package javax.persistence;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Used in schema generation to specify creation of an index.
|
||||
* <p>
|
||||
* Note that it is not necessary to specify an index for a primary key,
|
||||
* as the primary key index will be created automatically.
|
||||
*
|
||||
* <p>
|
||||
* The syntax of the <code>columnList</code> element is a
|
||||
* <code>column_list</code>, as follows:
|
||||
*
|
||||
* <pre>
|
||||
* column::= index_column [,index_column]*
|
||||
* index_column::= column_name [ASC | DESC]
|
||||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* If <code>ASC</code> or <code>DESC</code> is not specified,
|
||||
* <code>ASC</code> (ascending order) is assumed.
|
||||
*
|
||||
* @since Java Persistence 2.1
|
||||
*
|
||||
*/
|
||||
@Target({})
|
||||
@Retention(RUNTIME)
|
||||
public @interface Index {
|
||||
|
||||
/**
|
||||
* (Optional) The name of the index; defaults to a provider-generated name.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
String name() default "";
|
||||
|
||||
/**
|
||||
* (Required) The names of the columns to be included in the index,
|
||||
* in order.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
String columnList();
|
||||
|
||||
/**
|
||||
* (Optional) Whether the index is unique.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
boolean unique() default false;
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/*******************************************************************************
|
||||
/** *****************************************************************************
|
||||
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
@@ -12,7 +12,7 @@
|
||||
* Linda DeMichiel - Java Persistence 2.1
|
||||
* Linda DeMichiel - Java Persistence 2.0
|
||||
*
|
||||
******************************************************************************/
|
||||
***************************************************************************** */
|
||||
package javax.persistence;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
@@ -22,9 +22,10 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* Specifies the primary table for the annotated entity. Additional
|
||||
* tables may be specified using SecondaryTable or SecondaryTables annotation.
|
||||
* tables may be specified using SecondaryTable or SecondaryTables annotation.
|
||||
*
|
||||
* <p> If no <code>Table</code> annotation is specified for an entity
|
||||
* <p>
|
||||
* If no <code>Table</code> annotation is specified for an entity
|
||||
* class, the default values apply.
|
||||
*
|
||||
* <pre>
|
||||
@@ -37,27 +38,50 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
*
|
||||
* @since Java Persistence 1.0
|
||||
*/
|
||||
@Target(TYPE)
|
||||
@Target(TYPE)
|
||||
@Retention(RUNTIME)
|
||||
public @interface Table {
|
||||
|
||||
/**
|
||||
* (Optional) The name of the table.
|
||||
* <p> Defaults to the entity name.
|
||||
* <p>
|
||||
* Defaults to the entity name.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
String name() default "";
|
||||
|
||||
/** (Optional) The catalog of the table.
|
||||
* <p> Defaults to the default catalog.
|
||||
* <p>
|
||||
* Defaults to the default catalog.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
String catalog() default "";
|
||||
|
||||
/** (Optional) The schema of the table.
|
||||
* <p> Defaults to the default schema for user.
|
||||
* @return String
|
||||
/**
|
||||
* (Optional) Unique constraints that are to be placed on
|
||||
* the table. These are only used if table generation is in
|
||||
* effect. These constraints apply in addition to any constraints
|
||||
* specified by the <code>Column</code> and <code>JoinColumn</code>
|
||||
* annotations and constraints entailed by primary key mappings.
|
||||
* <p>
|
||||
* Defaults to no additional constraints.
|
||||
* @return UniqueConstraint[]
|
||||
*/
|
||||
String schema() default "";
|
||||
UniqueConstraint[] uniqueConstraints() default {};
|
||||
|
||||
/**
|
||||
* (Optional) Indexes for the table. These are only used if
|
||||
* table generation is in effect. Note that it is not necessary
|
||||
* to specify an index for a primary key, as the primary key
|
||||
* index will be created automatically.
|
||||
*
|
||||
* @return indexes
|
||||
* @since Java Persistence 2.1
|
||||
*/
|
||||
Index[] indexes() default {};
|
||||
|
||||
String comment() default "";
|
||||
|
||||
}
|
||||
|
||||
56
src/javax/persistence/UniqueConstraint.java
Normal file
56
src/javax/persistence/UniqueConstraint.java
Normal file
@@ -0,0 +1,56 @@
|
||||
/** *****************************************************************************
|
||||
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
|
||||
* which accompanies this distribution.
|
||||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
|
||||
* and the Eclipse Distribution License is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* Contributors:
|
||||
* Linda DeMichiel - Java Persistence 2.1
|
||||
* Linda DeMichiel - Java Persistence 2.0
|
||||
*
|
||||
***************************************************************************** */
|
||||
package javax.persistence;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.Retention;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* Specifies that a unique constraint is to be included in
|
||||
* the generated DDL for a primary or secondary table.
|
||||
*
|
||||
* <pre>
|
||||
* Example:
|
||||
* @Entity
|
||||
* @Table(
|
||||
* name="EMPLOYEE",
|
||||
* uniqueConstraints=
|
||||
* @UniqueConstraint(columnNames={"EMP_ID", "EMP_NAME"})
|
||||
* )
|
||||
* public class Employee { ... }
|
||||
* </pre>
|
||||
*
|
||||
* @since Java Persistence 1.0
|
||||
*/
|
||||
@Target({})
|
||||
@Retention(RUNTIME)
|
||||
public @interface UniqueConstraint {
|
||||
|
||||
/** (Optional) Constraint name. A provider-chosen name will be chosen
|
||||
* if a name is not specified.
|
||||
*
|
||||
* @return String
|
||||
* @since Java Persistence 2.0
|
||||
*/
|
||||
String name() default "";
|
||||
|
||||
/** (Required) An array of the column names that make up the constraint.
|
||||
*
|
||||
* @return String[]
|
||||
*/
|
||||
String[] columnNames();
|
||||
}
|
||||
@@ -8,13 +8,17 @@ package org.redkale.boot;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
import javax.persistence.*;
|
||||
import org.redkale.convert.json.JsonConvert;
|
||||
import org.redkale.net.http.*;
|
||||
import org.redkale.source.*;
|
||||
import org.redkale.util.*;
|
||||
|
||||
/**
|
||||
* 继承 HttpBaseServlet 是为了获取 WebAction 信息
|
||||
*
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
public class ApiDocs extends HttpBaseServlet {
|
||||
@@ -28,7 +32,7 @@ public class ApiDocs extends HttpBaseServlet {
|
||||
public void run() throws Exception {
|
||||
List<Map> serverList = new ArrayList<>();
|
||||
|
||||
Map<String, Map<String, Map<String, String>>> typesmap = new LinkedHashMap<>();
|
||||
Map<String, Map<String, Map<String, Object>>> typesmap = new LinkedHashMap<>();
|
||||
for (NodeServer node : app.servers) {
|
||||
if (!(node instanceof NodeHttpServer)) continue;
|
||||
final Map<String, Object> map = new LinkedHashMap<>();
|
||||
@@ -59,57 +63,116 @@ public class ApiDocs extends HttpBaseServlet {
|
||||
|
||||
List<Map> actionsList = new ArrayList<>();
|
||||
servletmap.put("actions", actionsList);
|
||||
for (Method method : servlet.getClass().getMethods()) {
|
||||
if (method.getParameterCount() != 2) continue;
|
||||
WebAction action = method.getAnnotation(WebAction.class);
|
||||
if (action == null) continue;
|
||||
final Map<String, Object> actionmap = new LinkedHashMap<>();
|
||||
actionmap.put("url", prefix + action.url());
|
||||
actionmap.put("auth", method.getAnnotation(AuthIgnore.class) == null);
|
||||
actionmap.put("actionid", action.actionid());
|
||||
actionmap.put("comment", action.comment());
|
||||
List<Map> paramsList = new ArrayList<>();
|
||||
actionmap.put("params", paramsList);
|
||||
for (WebParam param : method.getAnnotationsByType(WebParam.class)) {
|
||||
final Map<String, Object> parammap = new LinkedHashMap<>();
|
||||
final boolean isarray = param.type().isArray();
|
||||
final Class ptype = isarray ? param.type().getComponentType() : param.type();
|
||||
parammap.put("name", param.name());
|
||||
parammap.put("radix", param.radix());
|
||||
parammap.put("type", ptype.getName() + (isarray ? "[]" : ""));
|
||||
parammap.put("src", param.src());
|
||||
parammap.put("comment", param.comment());
|
||||
paramsList.add(parammap);
|
||||
if (ptype.isPrimitive() || ptype == String.class) continue;
|
||||
if (typesmap.containsKey(ptype.getName())) continue;
|
||||
final Class selfClz = servlet.getClass();
|
||||
Class clz = servlet.getClass();
|
||||
HashSet<String> actionurls = new HashSet<>();
|
||||
do {
|
||||
if (Modifier.isAbstract(clz.getModifiers())) break;
|
||||
for (Method method : clz.getMethods()) {
|
||||
if (method.getParameterCount() != 2) continue;
|
||||
WebAction action = method.getAnnotation(WebAction.class);
|
||||
if (action == null) continue;
|
||||
if (!action.inherited() && selfClz != clz) continue; //忽略不被继承的方法
|
||||
final Map<String, Object> actionmap = new LinkedHashMap<>();
|
||||
if (actionurls.contains(action.url())) continue;
|
||||
actionmap.put("url", prefix + action.url());
|
||||
actionurls.add(action.url());
|
||||
actionmap.put("auth", method.getAnnotation(AuthIgnore.class) == null);
|
||||
actionmap.put("actionid", action.actionid());
|
||||
actionmap.put("comment", action.comment());
|
||||
List<Map> paramsList = new ArrayList<>();
|
||||
actionmap.put("params", paramsList);
|
||||
List<String> results = new ArrayList<>();
|
||||
for (final Class rtype : action.results()) {
|
||||
results.add(rtype.getName());
|
||||
if (typesmap.containsKey(rtype.getName())) continue;
|
||||
final boolean filter = FilterBean.class.isAssignableFrom(rtype);
|
||||
final Map<String, Map<String, Object>> typemap = new LinkedHashMap<>();
|
||||
Class loop = rtype;
|
||||
do {
|
||||
if (loop == null || loop.isInterface()) break;
|
||||
for (Field field : loop.getDeclaredFields()) {
|
||||
if (Modifier.isFinal(field.getModifiers())) continue;
|
||||
if (Modifier.isStatic(field.getModifiers())) continue;
|
||||
|
||||
final Map<String, Map<String, String>> typemap = new LinkedHashMap<>();
|
||||
Class loop = ptype;
|
||||
do {
|
||||
if (loop == null || loop.isInterface()) break;
|
||||
for (Field field : loop.getDeclaredFields()) {
|
||||
if (Modifier.isFinal(field.getModifiers())) continue;
|
||||
if (Modifier.isStatic(field.getModifiers())) continue;
|
||||
Map<String, Object> fieldmap = new LinkedHashMap<>();
|
||||
fieldmap.put("type", field.getType().isArray() ? (field.getType().getComponentType().getName() + "[]") : field.getGenericType().getTypeName());
|
||||
|
||||
Map<String, String> fieldmap = new LinkedHashMap<>();
|
||||
fieldmap.put("type", field.getType().isArray() ? (field.getType().getComponentType().getName() + "[]") : field.getGenericType().getTypeName());
|
||||
Comment comment = field.getAnnotation(Comment.class);
|
||||
Column col = field.getAnnotation(Column.class);
|
||||
FilterColumn fc = field.getAnnotation(FilterColumn.class);
|
||||
if (comment != null) {
|
||||
fieldmap.put("comment", comment.value());
|
||||
} else if (col != null) {
|
||||
fieldmap.put("comment", col.comment());
|
||||
} else if (fc != null) {
|
||||
fieldmap.put("comment", fc.comment());
|
||||
}
|
||||
fieldmap.put("primary", !filter && (field.getAnnotation(Id.class) != null));
|
||||
fieldmap.put("updatable", (filter || col == null || col.updatable()));
|
||||
if (servlet.getClass().getAnnotation(Rest.RestDynamic.class) != null) {
|
||||
if (field.getAnnotation(RestAddress.class) != null) continue;
|
||||
}
|
||||
|
||||
Comment comment = field.getAnnotation(Comment.class);
|
||||
if (comment != null) fieldmap.put("comment", comment.value());
|
||||
|
||||
if (servlet.getClass().getAnnotation(Rest.RestDynamic.class) != null) {
|
||||
if (field.getAnnotation(RestAddress.class) != null) continue;
|
||||
typemap.put(field.getName(), fieldmap);
|
||||
}
|
||||
} while ((loop = loop.getSuperclass()) != Object.class);
|
||||
typesmap.put(rtype.getName(), typemap);
|
||||
}
|
||||
actionmap.put("results", results);
|
||||
for (WebParam param : method.getAnnotationsByType(WebParam.class)) {
|
||||
final Map<String, Object> parammap = new LinkedHashMap<>();
|
||||
final boolean isarray = param.type().isArray();
|
||||
final Class ptype = isarray ? param.type().getComponentType() : param.type();
|
||||
parammap.put("name", param.name());
|
||||
parammap.put("radix", param.radix());
|
||||
parammap.put("type", ptype.getName() + (isarray ? "[]" : ""));
|
||||
parammap.put("src", param.src());
|
||||
parammap.put("comment", param.comment());
|
||||
parammap.put("required", param.required());
|
||||
paramsList.add(parammap);
|
||||
if (ptype.isPrimitive() || ptype == String.class) continue;
|
||||
if (typesmap.containsKey(ptype.getName())) continue;
|
||||
|
||||
typemap.put(field.getName(), fieldmap);
|
||||
}
|
||||
} while ((loop = loop.getSuperclass()) != Object.class);
|
||||
final Map<String, Map<String, Object>> typemap = new LinkedHashMap<>();
|
||||
Class loop = ptype;
|
||||
final boolean filter = FilterBean.class.isAssignableFrom(loop);
|
||||
do {
|
||||
if (loop == null || loop.isInterface()) break;
|
||||
for (Field field : loop.getDeclaredFields()) {
|
||||
if (Modifier.isFinal(field.getModifiers())) continue;
|
||||
if (Modifier.isStatic(field.getModifiers())) continue;
|
||||
|
||||
typesmap.put(ptype.getName(), typemap);
|
||||
Map<String, Object> fieldmap = new LinkedHashMap<>();
|
||||
fieldmap.put("type", field.getType().isArray() ? (field.getType().getComponentType().getName() + "[]") : field.getGenericType().getTypeName());
|
||||
|
||||
Column col = field.getAnnotation(Column.class);
|
||||
FilterColumn fc = field.getAnnotation(FilterColumn.class);
|
||||
Comment comment = field.getAnnotation(Comment.class);
|
||||
if (comment != null) {
|
||||
fieldmap.put("comment", comment.value());
|
||||
} else if (col != null) {
|
||||
fieldmap.put("comment", col.comment());
|
||||
} else if (fc != null) {
|
||||
fieldmap.put("comment", fc.comment());
|
||||
}
|
||||
fieldmap.put("primary", !filter && (field.getAnnotation(Id.class) != null));
|
||||
fieldmap.put("updatable", (filter || col == null || col.updatable()));
|
||||
|
||||
if (servlet.getClass().getAnnotation(Rest.RestDynamic.class) != null) {
|
||||
if (field.getAnnotation(RestAddress.class) != null) continue;
|
||||
}
|
||||
|
||||
typemap.put(field.getName(), fieldmap);
|
||||
}
|
||||
} while ((loop = loop.getSuperclass()) != Object.class);
|
||||
|
||||
typesmap.put(ptype.getName(), typemap);
|
||||
}
|
||||
actionmap.put("result", action.result());
|
||||
actionsList.add(actionmap);
|
||||
}
|
||||
actionmap.put("result", action.result());
|
||||
actionsList.add(actionmap);
|
||||
}
|
||||
} while ((clz = clz.getSuperclass()) != HttpServlet.class);
|
||||
actionsList.sort((o1, o2) -> ((String) o1.get("url")).compareTo((String) o2.get("url")));
|
||||
servletsList.add(servletmap);
|
||||
}
|
||||
@@ -132,7 +195,7 @@ public class ApiDocs extends HttpBaseServlet {
|
||||
in = new FileInputStream(doctemplate);
|
||||
}
|
||||
if (in == null) in = ApiDocs.class.getResourceAsStream("apidoc-template.html");
|
||||
String content = Utility.read(in).replace("${content}", json);
|
||||
String content = Utility.read(in).replace("'${content}'", json);
|
||||
in.close();
|
||||
FileOutputStream outhtml = new FileOutputStream(new File(app.getHome(), "apidoc.html"));
|
||||
outhtml.write(content.getBytes("UTF-8"));
|
||||
@@ -140,7 +203,7 @@ public class ApiDocs extends HttpBaseServlet {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean authenticate(int module, int actionid, HttpRequest request, HttpResponse response) throws IOException {
|
||||
public boolean authenticate(int moduleid, int actionid, HttpRequest request, HttpResponse response) throws IOException {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package org.redkale.boot;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.*;
|
||||
@@ -33,7 +34,7 @@ import org.w3c.dom.*;
|
||||
* <p>
|
||||
* 进程启动类,程序启动后读取application.xml,进行classpath扫描动态加载Service与Servlet 优先加载所有SNCP协议的服务, 再加载其他协议服务, 最后进行Service、Servlet与其他资源之间的依赖注入。
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
@@ -188,6 +189,7 @@ public final class Application {
|
||||
}
|
||||
this.logger = Logger.getLogger(this.getClass().getSimpleName());
|
||||
this.serversLatch = new CountDownLatch(config.getAnyValues("server").length + 1);
|
||||
logger.log(Level.INFO, "------------------------------- Redkale ------------------------------");
|
||||
//------------------配置 <transport> 节点 ------------------
|
||||
ObjectPool<ByteBuffer> transportPool = null;
|
||||
ExecutorService transportExec = null;
|
||||
@@ -526,6 +528,7 @@ public final class Application {
|
||||
}
|
||||
|
||||
public static <T extends Service> T singleton(String name, Class<T> serviceClass) throws Exception {
|
||||
if (serviceClass == null) throw new IllegalArgumentException("serviceClass is null");
|
||||
final Application application = Application.create(true);
|
||||
application.init();
|
||||
application.start();
|
||||
@@ -533,7 +536,9 @@ public final class Application {
|
||||
T service = server.resourceFactory.find(name, serviceClass);
|
||||
if (service != null) return service;
|
||||
}
|
||||
return null;
|
||||
if (Modifier.isAbstract(serviceClass.getModifiers())) throw new IllegalArgumentException("abstract class not allowed");
|
||||
if (serviceClass.isInterface()) throw new IllegalArgumentException("interface class not allowed");
|
||||
throw new IllegalArgumentException(serviceClass.getName() + " maybe have zero not-final public method");
|
||||
}
|
||||
|
||||
public static Application create(final boolean singleton) throws IOException {
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.redkale.util.AnyValue.DefaultAnyValue;
|
||||
/**
|
||||
* class过滤器, 符合条件的class会保留下来存入FilterEntry。
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <T> 泛型
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.logging.Formatter;
|
||||
/**
|
||||
* 自定义的日志输出类
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.redkale.util.*;
|
||||
* HTTP Server节点的配置Server
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
@@ -189,7 +189,9 @@ public class NodeHttpServer extends NodeServer {
|
||||
for (int i = 0; i < mappings.length; i++) {
|
||||
mappings[i] = prefix + mappings[i];
|
||||
}
|
||||
ss.add(new AbstractMap.SimpleEntry<>(servlet.getClass().getName(), mappings));
|
||||
if (servlet.getClass().getSimpleName().charAt(0) != '_') {
|
||||
ss.add(new AbstractMap.SimpleEntry<>(servlet.getClass().getName(), mappings));
|
||||
}
|
||||
}
|
||||
});
|
||||
//输出信息
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.redkale.service.Service;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.lang.annotation.*;
|
||||
* 根据application.xml中的server节点中的protocol值来适配Server的加载逻辑
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.redkale.util.*;
|
||||
* Server节点的初始化配置类
|
||||
*
|
||||
*
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.redkale.util.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"><title>Document</title>
|
||||
<meta charset="UTF-8"><title>接口文档(apidoc生成)</title>
|
||||
<style type="text/css">
|
||||
body {text-align: center;margin:auto;}
|
||||
a{text-decoration: none;}
|
||||
.table {margin: auto;border-collapse: collapse;border-spacing: 0;display: block;width: 100%;overflow: auto;word-break: normal;word-break: keep-all;}
|
||||
.table td,.table th{padding: 0.4rem 1.2rem 0.4rem 1.2rem;border: 1px solid #aaa;}
|
||||
.table td,.table th{padding: 0.2rem 0.8rem 0.2rem 0.8rem;border: 1px solid #aaa;}
|
||||
.table td {text-align: left;}
|
||||
.s {font-size: 0.8rem; vertical-align: middle;}
|
||||
.subtable {border-spacing: 0;border: 0;margin:0;}
|
||||
@@ -25,11 +25,17 @@
|
||||
html.push('<div style="width:' + Math.floor(window.screen.width * 0.9) + 'px;margin:0 auto;text-align: center;">');
|
||||
html.push('<br/><br/><table class="table" align="center">');
|
||||
for (var i = 0; i < jsoncontent.servers.length; i++) {
|
||||
for (var j = 0; j < jsoncontent.servers[i].servlets.length; j++) {
|
||||
var servlet = jsoncontent.servers[i].servlets[j];
|
||||
var servlets = jsoncontent.servers[i].servlets;
|
||||
if (servlets.length && (servlets[0].comment || "").indexOf("【") === 0) {
|
||||
servlets.sort(function (a, b) {
|
||||
return a.comment > b.comment ? -1 : (a.comment == b.comment ? 0 : 1);
|
||||
});
|
||||
}
|
||||
for (var j = 0; j < servlets.length; j++) {
|
||||
var servlet = servlets[j];
|
||||
if (html.length > 2) html.push(' <tr><th colspan="5" style="border-bottom:0;"> </th></tr>');
|
||||
html.push(' <tr><th colspan="5" style="border-top:' + ((html.length > 2) ? 0 : 1) + ';">' + (servlet.comment || '未知模块') + '</th></tr>');
|
||||
html.push(' <tr><th>请求URL</th><th>描 述</th><th>鉴 权</th><th>参 数 <span style="font-size:12px;">(红色: Header; 蓝色: Cookie)</span></th><th>输 出</th></tr>');
|
||||
html.push(' <tr><th>请求URL</th><th>描 述</th><th>鉴 权</th><th>参 数 <span style="font-size:12px;">(粗体: 必填项; 红色: Header; 蓝色: Cookie)</span></th><th>输 出</th></tr>');
|
||||
for (var k = 0; k < servlet.actions.length; k++) {
|
||||
var action = servlet.actions[k];
|
||||
html.push(' <tr>');
|
||||
@@ -47,15 +53,22 @@
|
||||
if (param.name == '&') {
|
||||
paramshtml.push('<tr><td style="font-size:12px;">内置 </td><td> ' + t + '</td><td> 当前用户</td></tr>');
|
||||
} else {
|
||||
var c = ' style="font-weight:bold;"';
|
||||
if (param.src == "HEADER") c = ' style="color:red;font-weight:bold;"';
|
||||
if (param.src == "COOKIE") c = ' style="color:blue;font-weight:bold;"';
|
||||
var w = param.required ? "font-weight:bold;" : "";
|
||||
var c = ' style="' + w + '"';
|
||||
if (param.src == "HEADER") c = ' style="color:red;' + w + '"';
|
||||
if (param.src == "COOKIE") c = ' style="color:blue;' + w + '"';
|
||||
paramshtml.push('<tr><td ' + c + '> ' + param.name + ' </td><td> ' + t + '</td><td> ' + param.comment + '</td></tr>');
|
||||
}
|
||||
}
|
||||
paramshtml.push('</table>');
|
||||
html.push('<td class="s" style="padding:0 5px;">' + paramshtml.join('') + '</td>');
|
||||
html.push('<td>' + action.result.replace(/</g,"<").replace(/>/g,">").replace(/([a-zA-Z0-9_\$]+\.)+/g, "") + '</td>');
|
||||
var rs = [];
|
||||
rs.push(action.result.replace(/</g, "<").replace(/>/g, ">").replace(/([a-zA-Z0-9_\$]+\.)+/g, ""));
|
||||
var results = action.results || [];
|
||||
for (var r = 0; r < results.length; r++) {
|
||||
rs.push('<a href="#' + results[r].replace('[]', '') + '">' + results[r].replace(/([a-zA-Z0-9_\$]+\.)+/g, "") + '</a>');
|
||||
}
|
||||
html.push('<td>' + rs.join("<br/>") + '</td>');
|
||||
html.push('</tr>');
|
||||
}
|
||||
}
|
||||
@@ -66,8 +79,20 @@
|
||||
html.push(' <tr><td colspan="5"><table class="typetable">');
|
||||
for (var fieldname in classmap[type]) {
|
||||
var field = classmap[type][fieldname];
|
||||
var t = field.type.replace(/</g,"<").replace(/>/g,">").replace(/([a-zA-Z0-9_\$]+\.)+/g, "");
|
||||
html.push(' <tr class="l"><td>' + fieldname + '</td><td>' + t + '</td><td colspan="2">' + (field.comment || '') + '</td></tr>');
|
||||
var t = field.type.replace(/</g, "<").replace(/>/g, ">").replace(/\$/g, ".").replace(/([a-zA-Z0-9_\$]+\.)+/g, "");
|
||||
if (t == 'boolean' || t == 'short' || t == 'int' || t == 'long' || t == 'float' || t == 'double'
|
||||
|| t == 'boolean[]' || t == 'short[]' || t == 'int[]' || t == 'long[]' || t == 'float[]' || t == 'double[]') {
|
||||
t = '<font color=blue>' + t + '</font>';
|
||||
} else if (t == 'String' || t == 'String[]' || t == 'LongRange' || t.indexOf('Map<') === 0) {
|
||||
t = '<font color=red>' + t + '</font>';
|
||||
}
|
||||
var c = (field.comment || '');
|
||||
if (field.primary) {
|
||||
c = '【主键】 ' + c;
|
||||
} else if (!field.updatable) {
|
||||
c = '【只读】 ' + c;
|
||||
}
|
||||
html.push(' <tr class="l"><td>' + fieldname + '</td><td>' + t + '</td><td colspan="2">' + c + '</td></tr>');
|
||||
}
|
||||
html.push(' </table></td></tr>');
|
||||
}
|
||||
@@ -78,7 +103,7 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var jsoncontent = ${content};
|
||||
var jsoncontent = '${content}'; //这里必须要用单引号引起来
|
||||
document.write(createhtml(jsoncontent));
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.lang.reflect.Type;
|
||||
/**
|
||||
* 对不明类型的对象进行序列化; BSON序列化时将对象的类名写入Writer,JSON则不写入。
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <T> 序列化的泛型类型
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.*;
|
||||
* 支持一定程度的泛型。
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <T> 反解析的数组元素类型
|
||||
@@ -28,31 +28,53 @@ public final class ArrayDecoder<T> implements Decodeable<Reader, T[]> {
|
||||
|
||||
private final Class componentClass;
|
||||
|
||||
private final Decodeable<Reader, T> decoder;
|
||||
protected final Decodeable<Reader, T> decoder;
|
||||
|
||||
private boolean inited = false;
|
||||
|
||||
private final Object lock = new Object();
|
||||
|
||||
public ArrayDecoder(final ConvertFactory factory, final Type type) {
|
||||
this.type = type;
|
||||
if (type instanceof GenericArrayType) {
|
||||
Type t = ((GenericArrayType) type).getGenericComponentType();
|
||||
this.componentType = t instanceof TypeVariable ? Object.class : t;
|
||||
} else if ((type instanceof Class) && ((Class) type).isArray()) {
|
||||
this.componentType = ((Class) type).getComponentType();
|
||||
} else {
|
||||
throw new ConvertException("(" + type + ") is not a array type");
|
||||
try {
|
||||
if (type instanceof GenericArrayType) {
|
||||
Type t = ((GenericArrayType) type).getGenericComponentType();
|
||||
this.componentType = t instanceof TypeVariable ? Object.class : t;
|
||||
} else if ((type instanceof Class) && ((Class) type).isArray()) {
|
||||
this.componentType = ((Class) type).getComponentType();
|
||||
} else {
|
||||
throw new ConvertException("(" + type + ") is not a array type");
|
||||
}
|
||||
if (this.componentType instanceof ParameterizedType) {
|
||||
this.componentClass = (Class) ((ParameterizedType) this.componentType).getRawType();
|
||||
} else {
|
||||
this.componentClass = (Class) this.componentType;
|
||||
}
|
||||
factory.register(type, this);
|
||||
this.decoder = factory.loadDecoder(this.componentType);
|
||||
} finally {
|
||||
inited = true;
|
||||
synchronized (lock) {
|
||||
lock.notifyAll();
|
||||
}
|
||||
}
|
||||
if (this.componentType instanceof ParameterizedType) {
|
||||
this.componentClass = (Class) ((ParameterizedType) this.componentType).getRawType();
|
||||
} else {
|
||||
this.componentClass = (Class) this.componentType;
|
||||
}
|
||||
factory.register(type, this);
|
||||
this.decoder = factory.loadDecoder(this.componentType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T[] convertFrom(Reader in) {
|
||||
final int len = in.readArrayB();
|
||||
if (len == Reader.SIGN_NULL) return null;
|
||||
if (this.decoder == null) {
|
||||
if (!this.inited) {
|
||||
synchronized (lock) {
|
||||
try {
|
||||
lock.wait();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final Decodeable<Reader, T> localdecoder = this.decoder;
|
||||
final List<T> result = new ArrayList();
|
||||
if (len == Reader.SIGN_NOLENGTH) {
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.lang.reflect.*;
|
||||
* 支持一定程度的泛型。
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <T> 序列化的数组元素类型
|
||||
@@ -29,19 +29,30 @@ public final class ArrayEncoder<T> implements Encodeable<Writer, T[]> {
|
||||
|
||||
private final Encodeable<Writer, Object> encoder;
|
||||
|
||||
private boolean inited = false;
|
||||
|
||||
private final Object lock = new Object();
|
||||
|
||||
public ArrayEncoder(final ConvertFactory factory, final Type type) {
|
||||
this.type = type;
|
||||
if (type instanceof GenericArrayType) {
|
||||
Type t = ((GenericArrayType) type).getGenericComponentType();
|
||||
this.componentType = t instanceof TypeVariable ? Object.class : t;
|
||||
} else if ((type instanceof Class) && ((Class) type).isArray()) {
|
||||
this.componentType = ((Class) type).getComponentType();
|
||||
} else {
|
||||
throw new ConvertException("(" + type + ") is not a array type");
|
||||
try {
|
||||
if (type instanceof GenericArrayType) {
|
||||
Type t = ((GenericArrayType) type).getGenericComponentType();
|
||||
this.componentType = t instanceof TypeVariable ? Object.class : t;
|
||||
} else if ((type instanceof Class) && ((Class) type).isArray()) {
|
||||
this.componentType = ((Class) type).getComponentType();
|
||||
} else {
|
||||
throw new ConvertException("(" + type + ") is not a array type");
|
||||
}
|
||||
factory.register(type, this);
|
||||
this.encoder = factory.loadEncoder(this.componentType);
|
||||
this.anyEncoder = factory.getAnyEncoder();
|
||||
} finally {
|
||||
inited = true;
|
||||
synchronized (lock) {
|
||||
lock.notifyAll();
|
||||
}
|
||||
}
|
||||
factory.register(type, this);
|
||||
this.encoder = factory.loadEncoder(this.componentType);
|
||||
this.anyEncoder = factory.getAnyEncoder();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,6 +66,17 @@ public final class ArrayEncoder<T> implements Encodeable<Writer, T[]> {
|
||||
out.writeArrayE();
|
||||
return;
|
||||
}
|
||||
if (this.encoder == null) {
|
||||
if (!this.inited) {
|
||||
synchronized (lock) {
|
||||
try {
|
||||
lock.wait();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out.writeArrayB(value.length);
|
||||
final Type comp = this.componentType;
|
||||
boolean first = true;
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.Collection;
|
||||
* 支持一定程度的泛型。
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <T> 反解析的集合元素类型
|
||||
@@ -30,18 +30,29 @@ public final class CollectionDecoder<T> implements Decodeable<Reader, Collection
|
||||
|
||||
protected Creator<Collection<T>> creator;
|
||||
|
||||
private final Decodeable<Reader, T> decoder;
|
||||
protected final Decodeable<Reader, T> decoder;
|
||||
|
||||
private boolean inited = false;
|
||||
|
||||
private final Object lock = new Object();
|
||||
|
||||
public CollectionDecoder(final ConvertFactory factory, final Type type) {
|
||||
this.type = type;
|
||||
if (type instanceof ParameterizedType) {
|
||||
final ParameterizedType pt = (ParameterizedType) type;
|
||||
this.componentType = pt.getActualTypeArguments()[0];
|
||||
this.creator = factory.loadCreator((Class) pt.getRawType());
|
||||
factory.register(type, this);
|
||||
this.decoder = factory.loadDecoder(this.componentType);
|
||||
} else {
|
||||
throw new ConvertException("collectiondecoder not support the type (" + type + ")");
|
||||
try {
|
||||
if (type instanceof ParameterizedType) {
|
||||
final ParameterizedType pt = (ParameterizedType) type;
|
||||
this.componentType = pt.getActualTypeArguments()[0];
|
||||
this.creator = factory.loadCreator((Class) pt.getRawType());
|
||||
factory.register(type, this);
|
||||
this.decoder = factory.loadDecoder(this.componentType);
|
||||
} else {
|
||||
throw new ConvertException("collectiondecoder not support the type (" + type + ")");
|
||||
}
|
||||
} finally {
|
||||
inited = true;
|
||||
synchronized (lock) {
|
||||
lock.notifyAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +60,17 @@ public final class CollectionDecoder<T> implements Decodeable<Reader, Collection
|
||||
public Collection<T> convertFrom(Reader in) {
|
||||
final int len = in.readArrayB();
|
||||
if (len == Reader.SIGN_NULL) return null;
|
||||
if (this.decoder == null) {
|
||||
if (!this.inited) {
|
||||
synchronized (lock) {
|
||||
try {
|
||||
lock.wait();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final Decodeable<Reader, T> localdecoder = this.decoder;
|
||||
final Collection<T> result = this.creator.create();
|
||||
if (len == Reader.SIGN_NOLENGTH) {
|
||||
|
||||
@@ -10,10 +10,12 @@ import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 对象集合的序列化.
|
||||
* 集合大小不能超过 32767。 在BSON中集合大小设定的是short,对于大于32767长度的集合传输会影响性能,所以没有采用int存储。
|
||||
* 集合大小不能超过 32767。 在BSON中集合大小设定的是short,对于大于32767长度的集合传输会影响性能,所以没有采用int存储。
|
||||
* 支持一定程度的泛型。
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <T> 序列化的集合元素类型
|
||||
*/
|
||||
@@ -24,17 +26,28 @@ public final class CollectionEncoder<T> implements Encodeable<Writer, Collection
|
||||
|
||||
private final Encodeable<Writer, Object> encoder;
|
||||
|
||||
private boolean inited = false;
|
||||
|
||||
private final Object lock = new Object();
|
||||
|
||||
public CollectionEncoder(final ConvertFactory factory, final Type type) {
|
||||
this.type = type;
|
||||
if (type instanceof ParameterizedType) {
|
||||
Type t = ((ParameterizedType) type).getActualTypeArguments()[0];
|
||||
if (t instanceof TypeVariable) {
|
||||
this.encoder = factory.getAnyEncoder();
|
||||
try {
|
||||
if (type instanceof ParameterizedType) {
|
||||
Type t = ((ParameterizedType) type).getActualTypeArguments()[0];
|
||||
if (t instanceof TypeVariable) {
|
||||
this.encoder = factory.getAnyEncoder();
|
||||
} else {
|
||||
this.encoder = factory.loadEncoder(t);
|
||||
}
|
||||
} else {
|
||||
this.encoder = factory.loadEncoder(t);
|
||||
this.encoder = factory.getAnyEncoder();
|
||||
}
|
||||
} finally {
|
||||
inited = true;
|
||||
synchronized (lock) {
|
||||
lock.notifyAll();
|
||||
}
|
||||
} else {
|
||||
this.encoder = factory.getAnyEncoder();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +62,17 @@ public final class CollectionEncoder<T> implements Encodeable<Writer, Collection
|
||||
out.writeArrayE();
|
||||
return;
|
||||
}
|
||||
if (this.encoder == null) {
|
||||
if (!this.inited) {
|
||||
synchronized (lock) {
|
||||
try {
|
||||
lock.wait();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out.writeArrayB(value.size());
|
||||
boolean first = true;
|
||||
for (Object v : value) {
|
||||
|
||||
@@ -9,7 +9,7 @@ package org.redkale.convert;
|
||||
* 序列化操作类
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类
|
||||
|
||||
@@ -13,7 +13,7 @@ import static java.lang.annotation.RetentionPolicy.*;
|
||||
* 依附在setter、getter方法、字段进行简单的配置
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,7 @@ package org.redkale.convert;
|
||||
/**
|
||||
* ConvertColumn 对应的实体类
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
*/
|
||||
public final class ConvertColumnEntry {
|
||||
|
||||
@@ -12,7 +12,7 @@ import static java.lang.annotation.RetentionPolicy.*;
|
||||
/**
|
||||
* ConvertColumn 的多用类
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
*/
|
||||
@Inherited
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.lang.annotation.*;
|
||||
* 该值必须是全局唯一
|
||||
* 使用场景: 当BSON序列化为了不指定class可以使用@ConvertEntity来取个别名。关联方法: Reader.readClassName() 和 Writer.writeClassName(String value) 。
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
*/
|
||||
@Inherited
|
||||
|
||||
@@ -6,7 +6,7 @@ package org.redkale.convert;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
*/
|
||||
public class ConvertException extends RuntimeException {
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.redkale.util.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类
|
||||
|
||||
@@ -7,7 +7,7 @@ package org.redkale.convert;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
*/
|
||||
public enum ConvertType {
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.redkale.util.Attribute;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类
|
||||
@@ -88,6 +88,6 @@ public final class DeMember<R extends Reader, T, F> implements Comparable<DeMemb
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DeMember{" + "attribute=" + attribute.field() + ", decoder=" + decoder + '}';
|
||||
return "DeMember{" + "attribute=" + attribute.field() + ", decoder=" + (decoder == null ? null : decoder.getClass().getName()) + '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.lang.reflect.Type;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.redkale.util.Attribute;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <W> Writer输出的子类
|
||||
@@ -81,6 +81,6 @@ public final class EnMember<W extends Writer, T, F> implements Comparable<EnMemb
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EnMember{" + "attribute=" + attribute.field() + ", encoder=" + encoder + '}';
|
||||
return "EnMember{" + "attribute=" + attribute.field() + ", encoder=" + (encoder == null ? null : encoder.getClass().getName()) + '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.lang.reflect.Type;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <W> Writer输出的子类
|
||||
|
||||
@@ -12,7 +12,9 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <K> Map key的数据类型
|
||||
* @param <V> Map value的数据类型
|
||||
@@ -28,27 +30,49 @@ public final class MapDecoder<K, V> implements Decodeable<Reader, Map<K, V>> {
|
||||
|
||||
protected Creator<Map<K, V>> creator;
|
||||
|
||||
private final Decodeable<Reader, K> keyDecoder;
|
||||
protected final Decodeable<Reader, K> keyDecoder;
|
||||
|
||||
private final Decodeable<Reader, V> valueDecoder;
|
||||
protected final Decodeable<Reader, V> valueDecoder;
|
||||
|
||||
private boolean inited = false;
|
||||
|
||||
private final Object lock = new Object();
|
||||
|
||||
public MapDecoder(final ConvertFactory factory, final Type type) {
|
||||
this.type = type;
|
||||
if (type instanceof ParameterizedType) {
|
||||
final ParameterizedType pt = (ParameterizedType) type;
|
||||
this.keyType = pt.getActualTypeArguments()[0];
|
||||
this.valueType = pt.getActualTypeArguments()[1];
|
||||
this.creator = factory.loadCreator((Class) pt.getRawType());
|
||||
factory.register(type, this);
|
||||
this.keyDecoder = factory.loadDecoder(this.keyType);
|
||||
this.valueDecoder = factory.loadDecoder(this.valueType);
|
||||
} else {
|
||||
throw new ConvertException("mapdecoder not support the type (" + type + ")");
|
||||
try {
|
||||
if (type instanceof ParameterizedType) {
|
||||
final ParameterizedType pt = (ParameterizedType) type;
|
||||
this.keyType = pt.getActualTypeArguments()[0];
|
||||
this.valueType = pt.getActualTypeArguments()[1];
|
||||
this.creator = factory.loadCreator((Class) pt.getRawType());
|
||||
factory.register(type, this);
|
||||
this.keyDecoder = factory.loadDecoder(this.keyType);
|
||||
this.valueDecoder = factory.loadDecoder(this.valueType);
|
||||
} else {
|
||||
throw new ConvertException("mapdecoder not support the type (" + type + ")");
|
||||
}
|
||||
} finally {
|
||||
inited = true;
|
||||
synchronized (lock) {
|
||||
lock.notifyAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<K, V> convertFrom(Reader in) {
|
||||
if (this.keyDecoder == null || this.valueDecoder == null) {
|
||||
if (!this.inited) {
|
||||
synchronized (lock) {
|
||||
try {
|
||||
lock.wait();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final int len = in.readMapB();
|
||||
if (len == Reader.SIGN_NULL) return null;
|
||||
final Map<K, V> result = this.creator.create();
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Map;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <K> Map key的数据类型
|
||||
@@ -27,15 +27,26 @@ public final class MapEncoder<K, V> implements Encodeable<Writer, Map<K, V>> {
|
||||
|
||||
private final Encodeable<Writer, V> valencoder;
|
||||
|
||||
private boolean inited = false;
|
||||
|
||||
private final Object lock = new Object();
|
||||
|
||||
public MapEncoder(final ConvertFactory factory, final Type type) {
|
||||
this.type = type;
|
||||
if (type instanceof ParameterizedType) {
|
||||
final Type[] pt = ((ParameterizedType) type).getActualTypeArguments();
|
||||
this.keyencoder = factory.loadEncoder(pt[0]);
|
||||
this.valencoder = factory.loadEncoder(pt[1]);
|
||||
} else {
|
||||
this.keyencoder = factory.getAnyEncoder();
|
||||
this.valencoder = factory.getAnyEncoder();
|
||||
try {
|
||||
if (type instanceof ParameterizedType) {
|
||||
final Type[] pt = ((ParameterizedType) type).getActualTypeArguments();
|
||||
this.keyencoder = factory.loadEncoder(pt[0]);
|
||||
this.valencoder = factory.loadEncoder(pt[1]);
|
||||
} else {
|
||||
this.keyencoder = factory.getAnyEncoder();
|
||||
this.valencoder = factory.getAnyEncoder();
|
||||
}
|
||||
} finally {
|
||||
inited = true;
|
||||
synchronized (lock) {
|
||||
lock.notifyAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +57,18 @@ public final class MapEncoder<K, V> implements Encodeable<Writer, Map<K, V>> {
|
||||
out.writeNull();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.keyencoder == null || this.valencoder == null) {
|
||||
if (!this.inited) {
|
||||
synchronized (lock) {
|
||||
try {
|
||||
lock.wait();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out.writeMapB(values.size());
|
||||
boolean first = true;
|
||||
for (Map.Entry<K, V> en : values.entrySet()) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.redkale.util.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.redkale.util.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <W> Writer输出的子类
|
||||
|
||||
@@ -8,7 +8,7 @@ package org.redkale.convert;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.lang.reflect.Type;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.redkale.util.Attribute;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,8 @@ import static org.redkale.convert.Reader.SIGN_NULL;
|
||||
import org.redkale.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.function.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.redkale.util.*;
|
||||
*
|
||||
* </pre></blockquote>
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.redkale.convert.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.redkale.util.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.redkale.convert.SimpledCoder;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <T> 序列化/反解析的数据类型
|
||||
|
||||
@@ -9,6 +9,8 @@ import java.io.*;
|
||||
import org.redkale.convert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,8 @@ import java.io.*;
|
||||
import org.redkale.convert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.redkale.util.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.math.BigInteger;
|
||||
* BigInteger 的SimpledCoder实现
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.redkale.convert.Writer;
|
||||
* boolean[] 的SimpledCoder实现
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.redkale.convert.Writer;
|
||||
* boolean 的SimpledCoder实现
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.redkale.convert.Writer;
|
||||
* byte[] 的SimpledCoder实现
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.redkale.convert.Writer;
|
||||
* byte 的SimpledCoder实现
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.redkale.convert.Writer;
|
||||
/**
|
||||
* char[] 的SimpledCoder实现
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
* @param <W> Writer输出的子类型
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.redkale.convert.*;
|
||||
/**
|
||||
* CharSequence 的SimpledCoder实现
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
* @param <W> Writer输出的子类型
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.redkale.convert.Writer;
|
||||
/**
|
||||
* char 的SimpledCoder实现
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
* @param <W> Writer输出的子类型
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.redkale.convert.*;
|
||||
* java.nio.channels.CompletionHandler 的SimpledCoder实现, 只输出null
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.redkale.util.*;
|
||||
* Dlong 的SimpledCoder实现
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Date;
|
||||
* Date 的SimpledCoder实现
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.redkale.convert.Writer;
|
||||
/**
|
||||
* double[] 的SimpledCoder实现
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
* @param <W> Writer输出的子类型
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.redkale.convert.Writer;
|
||||
/**
|
||||
* double 的SimpledCoder实现
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
* @param <W> Writer输出的子类型
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.redkale.convert.Writer;
|
||||
* 枚举 的SimpledCoder实现
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.redkale.convert.Writer;
|
||||
/**
|
||||
* float[] 的SimpledCoder实现
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
* @param <W> Writer输出的子类型
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.redkale.convert.Writer;
|
||||
/**
|
||||
* float 的SimpledCoder实现
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
* @param <W> Writer输出的子类型
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.net.*;
|
||||
* InetAddress 的SimpledCoder实现
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.redkale.convert.Writer;
|
||||
/**
|
||||
* int[] 的SimpledCoder实现
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
* @param <W> Writer输出的子类型
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.redkale.convert.Writer;
|
||||
/**
|
||||
* int 的SimpledCoder实现
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
* @param <W> Writer输出的子类型
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.redkale.convert.Writer;
|
||||
* long[] 的SimpledCoder实现
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.redkale.convert.Writer;
|
||||
/**
|
||||
* long 的SimpledCoder实现
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
* @param <W> Writer输出的子类型
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.redkale.convert.Writer;
|
||||
* Number 的SimpledCoder实现
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.redkale.convert.*;
|
||||
/**
|
||||
* Pattern 的SimpledCoder实现
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
* @param <W> Writer输出的子类型
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.redkale.convert.Writer;
|
||||
/**
|
||||
* short[] 的SimpledCoder实现
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
* @param <W> Writer输出的子类型
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.redkale.convert.Writer;
|
||||
/**
|
||||
* short 的SimpledCoder实现
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
* @param <W> Writer输出的子类型
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.redkale.convert.Writer;
|
||||
/**
|
||||
* String[] 的SimpledCoder实现
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
* @param <W> Writer输出的子类型
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.redkale.convert.Writer;
|
||||
/**
|
||||
* String 的SimpledCoder实现
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
* @param <W> Writer输出的子类型
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.redkale.convert.SimpledCoder;
|
||||
* Type 的SimpledCoder实现 只支持Type的子类Class
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.redkale.convert.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.redkale.convert.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R> Reader输入的子类型
|
||||
|
||||
@@ -11,7 +11,10 @@ import org.redkale.convert.*;
|
||||
import static org.redkale.convert.Reader.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* 只支持UTF-8格式
|
||||
*
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.redkale.util.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.redkale.util.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.redkale.util.DLong;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.redkale.util.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.redkale.convert.SimpledCoder;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <T> 序列化/反解析的数据类型
|
||||
|
||||
@@ -10,6 +10,8 @@ import org.redkale.convert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
class JsonStreamReader extends JsonByteBufferReader {
|
||||
|
||||
@@ -13,6 +13,8 @@ import org.redkale.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
class JsonStreamWriter extends JsonByteBufferWriter {
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.redkale.util.*;
|
||||
*
|
||||
* writeTo系列的方法输出的字符不能含特殊字符
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.concurrent.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.redkale.watch.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
*/
|
||||
public class Context {
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.redkale.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -34,7 +34,7 @@ public final class PrepareRunner implements Runnable {
|
||||
public void run() {
|
||||
final PrepareServlet prepare = context.prepare;
|
||||
final ObjectPool<? extends Response> responsePool = context.responsePool;
|
||||
if (data != null) {
|
||||
if (data != null) { //BIO模式的UDP连接创建AsyncConnection时已经获取到ByteBuffer数据了
|
||||
final Response response = responsePool.get();
|
||||
response.init(channel);
|
||||
try {
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.redkale.util.*;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <K> SessionID的类型
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.concurrent.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p> 详情见: http://redkale.org
|
||||
* <p> 详情见: https://redkale.org
|
||||
* @author zhangjx
|
||||
*/
|
||||
public abstract class ProtocolServer {
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.redkale.convert.json.JsonConvert;
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* 详情见: http://redkale.org
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <C> Context子类型
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user