feat: use @javatypes defiend java type

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2020-06-22 10:44:17 +08:00
parent 5f0c3bbdd4
commit ef98c49e1d
18 changed files with 60 additions and 56 deletions

View File

@ -1,9 +1,8 @@
/// <reference types="@ccms/types" />
/// <reference types="@ccms/types/dist/typings/tomcat/index" />
/// <reference types="@ccms/types/dist/typings/spring/index" />
/// <reference types="@javatypes/tomcat" />
/// <reference types="@javatypes/spring-web" />
import { constants, database, plugin, web } from "@ccms/api"
import { inject, ContainerInstance, Container } from "@ccms/container"
import { inject, ContainerInstance, Container, JSClass } from "@ccms/container"
import { JSPlugin, interfaces, cmd } from "@ccms/plugin"
import { DataBase, DataBaseManager } from '@ccms/database'
import { Server, Context, RequestHandler } from '@ccms/web'
@ -22,6 +21,9 @@ export class MiaoSpring extends interfaces.Plugin {
@inject(web.Server)
private webServer: Server
@JSClass('org.springframework.http.HttpStatus')
private HttpStatus: org.springframework.http.HttpStatus
private ResponseEntity = org.springframework.http.ResponseEntity
private mainDatabase: DataBase
@ -56,7 +58,7 @@ export class MiaoSpring extends interfaces.Plugin {
preHandle: (ctx: Context) => {
const index = foundMap.indexOf(ctx.request.getRequestURI())
if (index != -1) {
return this.ResponseEntity.status(org.springframework.http.HttpStatus.FOUND).header('Location', foundMap[index + 1]).build()
return this.ResponseEntity.status(this.HttpStatus.FOUND).header('Location', foundMap[index + 1]).build()
}
}
})

View File

@ -1,6 +1,3 @@
/// <reference types="@ccms/types/dist/typings/rabbitmq" />
/// <reference types="@ccms/types/dist/typings/spring/amqp" />
import { constants, plugin as pluginApi, amqp, server, web } from '@ccms/api'
import { plugin, interfaces, cmd } from '@ccms/plugin'
import { AmqpAdmin, ConnectionFactoryAdapter, AmqpManager } from '@ccms/amqp'