1

尝试对特殊的 oracle pl/sql 验证包进行自定义调用,该包执行自定义域级别验证器之外的操作,但不会触发“firemyvalidations”。你可以看到我尝试过的一些东西被注释掉了。谁能发现我的问题?我正在使用带有 angularjs 休息配置文件的 grails 3.2.6。

urlmappings.groovy

package fytrnlt

  class UrlMappings {




static mappings = {
        delete "/$controller/$id(.$format)?"(action:"delete")
        get "/$controller(.$format)?"(action:"index")
        get "/$controller/$id(.$format)?"(action:"show")
        post "/$controller(.$format)?"(action:"save")
        put "/$controller/$id(.$format)?"(action:"update")
        patch "/$controller/$id(.$format)?"(action:"patch")

        //"/fetchStvnatnData"(controller: 'FybkbraController', action: 'fetchStvnatn')

        "/events"(resources:"event")
        "/fytrnlts"(resources:"fytrnlt")
        //"/fytrnlts"(resources:"fytrnlt"){"/fytrnlts/myvalidations" (controller: "FytrnltController", action: "myvalidations", method: "POST")}
       // "/fytrnlts/myvalidations" (controller: 'FytrnltController', action: 'myvalidations', method: 'POST')
        "/firemyvalidations" (controller: 'FytrnltController', action: 'myvalidations', method: 'GET')
        "/spridens"(resources:"spriden")
       // "/fybkbras"(resources:"fybkbra")
        "/fybkbras"(resources:"fybkbra"){"/fetchStvnatnData" (controller: "FybkbraController", action: "fetchStvnatn", method: "GET")}
        "/fytbanks"(resources:"fytbank")
        "/fyrsigns"(resources:"fyrsign")

        "/"(view: '/index')
        "500"(view: '/error')
        "404"(view: '/notFound')
    }
}

FytrnltController.groovy

package fytrnlt


import grails.rest.*
import grails.converters.*
import fytrnlt.BannerService

class FytrnltController extends RestfulController {
    //def bannerService

    static responseFormats = ['json', 'xml']
    FytrnltController() {
        super(Fytrnlt)



    }

   def myvalidations(){

       //def String mresult = bannerService.dataValidation()

       def fytrnlt = Fytrnlt.get(4)
       def CheckResult = fytrnlt.bannerService.documentValidation(fytrnlt.checkpayeepidm, fytrnlt.benefiaryname, fytrnlt.id, fytrnlt.userid, 1, fytrnlt.version, fytrnlt.actnum, fytrnlt.actnumintmdry, fytrnlt.swift, fytrnlt.createdate, null)


       respond CheckResult, [excludes: ['class']]

       /*
       def fytrnlt = Fytrnlt.get(params.id)



       if (fytrnlt.validate()) {
       def CheckResult = fytrnlt.bannerService.documentValidation(fytrnlt.checkpayeepidm, fytrnlt.benefiaryname, fytrnlt.id, fytrnlt.userid, 1, fytrnlt.version, fytrnlt.actnum, fytrnlt.actnumintmdry, fytrnlt.swift, fytrnlt.createdate, null)

       return CheckResult

       } */


    }
}

通过 Postman 访问端点返回 404 错误。

Grails 生成以下内容:

WARN --- [nio-8080-exec-2] o.s.web.servlet.PageNotFound : No mapping found for HTTP request with URI [/firemyvalidations] in DispatcherServlet with name 'grailsDispatcherServlet'
4

1 回答 1

0

您无需将 Controller 后缀添加到 URL 映射:

因此,您可以替换:

"/firemyvalidations" (controller: 'FytrnltController', action: 'myvalidations', method: 'GET')

和:

"/firemyvalidations" (controller: 'fytrnlt', action: 'myvalidations', method: 'GET')
于 2017-05-04T10:38:17.903 回答