diff --git a/bin/apidoc.bat b/bin/apidoc.bat new file mode 100644 index 000000000..434913ad8 --- /dev/null +++ b/bin/apidoc.bat @@ -0,0 +1,7 @@ +@ECHO OFF + +SET APP_HOME=%~dp0 + +IF NOT EXIST "%APP_HOME%\conf\application.xml" SET APP_HOME=%~dp0.. + +java -DCMD=APIDOC -DAPP_HOME=%APP_HOME% -classpath %APP_HOME%\lib\* org.redkale.boot.Application diff --git a/bin/restdoc.sh b/bin/apidoc.sh similarity index 78% rename from bin/restdoc.sh rename to bin/apidoc.sh index 5eef5ee2f..74e42d168 100644 --- a/bin/restdoc.sh +++ b/bin/apidoc.sh @@ -15,4 +15,4 @@ do done export CLASSPATH=$CLASSPATH:$lib echo "$APP_HOME" -java -DCMD=RESTDOC -DAPP_HOME="$APP_HOME" org.redkale.boot.Application +java -DCMD=APIDOC -DAPP_HOME="$APP_HOME" org.redkale.boot.Application diff --git a/bin/restdoc.bat b/bin/restdoc.bat deleted file mode 100644 index 689d983c2..000000000 --- a/bin/restdoc.bat +++ /dev/null @@ -1,7 +0,0 @@ -@ECHO OFF - -SET APP_HOME=%~dp0 - -IF NOT EXIST "%APP_HOME%\conf\application.xml" SET APP_HOME=%~dp0.. - -java -DCMD=RESTDOC -DAPP_HOME=%APP_HOME% -classpath %APP_HOME%\lib\* org.redkale.boot.Application diff --git a/src/org/redkale/boot/RestDocs.java b/src/org/redkale/boot/ApiDocs.java similarity index 93% rename from src/org/redkale/boot/RestDocs.java rename to src/org/redkale/boot/ApiDocs.java index 92e6501d7..cb33cc602 100644 --- a/src/org/redkale/boot/RestDocs.java +++ b/src/org/redkale/boot/ApiDocs.java @@ -17,11 +17,11 @@ import org.redkale.util.*; * * @author zhangjx */ -public class RestDocs extends HttpBaseServlet { +public class ApiDocs extends HttpBaseServlet { private final Application app; - public RestDocs(Application app) { + public ApiDocs(Application app) { this.app = app; } @@ -123,18 +123,18 @@ public class RestDocs extends HttpBaseServlet { resultmap.put("servers", serverList); resultmap.put("types", typesmap); final String json = JsonConvert.root().convertTo(resultmap); - final FileOutputStream out = new FileOutputStream(new File(app.getHome(), "restdoc.json")); + final FileOutputStream out = new FileOutputStream(new File(app.getHome(), "apidoc.json")); out.write(json.getBytes("UTF-8")); out.close(); - File doctemplate = new File(app.getHome(), "conf/restdoc-template.html"); + File doctemplate = new File(app.getHome(), "conf/apidoc-template.html"); InputStream in = null; if (doctemplate.isFile() && doctemplate.canRead()) { in = new FileInputStream(doctemplate); } - if (in == null) in = RestDocs.class.getResourceAsStream("restdoc-template.html"); + if (in == null) in = ApiDocs.class.getResourceAsStream("apidoc-template.html"); String content = Utility.read(in).replace("${content}", json); in.close(); - FileOutputStream outhtml = new FileOutputStream(new File(app.getHome(), "restdoc.html")); + FileOutputStream outhtml = new FileOutputStream(new File(app.getHome(), "apidoc.html")); outhtml.write(content.getBytes("UTF-8")); outhtml.close(); } diff --git a/src/org/redkale/boot/Application.java b/src/org/redkale/boot/Application.java index 6bbb77805..7fa48875a 100644 --- a/src/org/redkale/boot/Application.java +++ b/src/org/redkale/boot/Application.java @@ -388,16 +388,16 @@ public final class Application { buffer.flip(); channel.send(buffer, address); } - } else if ("RESTDOC".equalsIgnoreCase(new String(bytes))) { + } else if ("APIDOC".equalsIgnoreCase(new String(bytes))) { try { - new RestDocs(application).run(); + new ApiDocs(application).run(); buffer.clear(); - buffer.put("RESTDOC OK".getBytes()); + buffer.put("APIDOC OK".getBytes()); buffer.flip(); channel.send(buffer, address); } catch (Exception ex) { buffer.clear(); - buffer.put("RESTDOC FAIL".getBytes()); + buffer.put("APIDOC FAIL".getBytes()); buffer.flip(); channel.send(buffer, address); } diff --git a/src/org/redkale/boot/restdoc-template.html b/src/org/redkale/boot/apidoc-template.html similarity index 100% rename from src/org/redkale/boot/restdoc-template.html rename to src/org/redkale/boot/apidoc-template.html