Wish subExists with raipDebug

icefairy333

Active Member
Licensed User
Longtime User
I use this as a controller:
B4X:
Sub Class_Globals
    Private te As WPTemplateEngine
    Public actionkey As String="/user/*"
    Private db As SQL
    Private bEnd As Boolean=False
End Sub

Public Sub Initialize
    te.Initialize
End Sub

Sub Handle(req As ServletRequest, resp As ServletResponse)
    te.bindResponse(resp)
    Try
        db=wpDB.conpool.Connection
        Dim routes() As String= G.url2Array(req.RequestURI)
        Dim lastidx As Int=routes.Length-1
        If SubExists(Me,routes(lastidx)) Then
            CallSub3(Me,routes(lastidx),req,resp)
        Else
            unknowaction(req,resp)
        End If
    Catch
        Log(LastException)
    End Try
    If db.IsInitialized Then db.Close
    Return
End Sub
Sub add(req As ServletRequest,resp As ServletResponse)
    Dim newUser As userModel=wpModelUtils.map2Type(reqUtils.getReqMapByModelName(req,"user"),newUser)
    newUser.nickname="testuser"
    newUser.address="新疆乌鲁木齐市"
    wpDB.insertMap(db,"wp_user",wpModelUtils.type2Map(newUser))'经过转换可以避免前端提交过来表中不存在的字段报错
    te.renderJson(True,"成功")
'    newUser.
End Sub

Sub unknowaction(req As ServletRequest,resp As ServletResponse)
    te.renderText("unknow:"&req.RequestURI)
End Sub
when I add an sub example "
B4X:
Sub delete(req As ServletRequest,resp As ServletResponse)
end sub
and press ctrl+s save the code,
the SubExists(me,"delete") return false,
so wish SubExists can reload the subs when ctrl+s
thank you.
 
Top