[英]HTTP Status 404 - Grails
I was trying to get into " http://localhost:8080/Twillio/smsService/index " from Grails view. 我试图从Grails视图进入“ http:// localhost:8080 / Twillio / smsService / index ”。
and I get errors like below. 我得到如下错误。
HTTP Status 404 - "/WEB-INF/grails-app/views/smsService/index.gsp" not found. HTTP状态404-找不到“ /WEB-INF/grails-app/views/smsService/index.gsp”。
My codes used for SmsServiceController.groovy is below. 我用于SmsServiceController.groovy的代码如下。
package twillio
class SmsServiceController {
def index () {}
def smsService
def twilioHttpEndpointBean
def read = { withFormat { html {} } }
def create = { SendSmsCommand cmd ->
def validMessage = cmd.validate();
log.debug "Incoming message is ${validMessage ? 'valid' : 'invalid'}"
log.debug "Format is ${request.format}"
withFormat {
json {
if (validMessage) {
def smsResponse
try {
smsResponse = smsService.send(cmd.destination, cmd.message)
render(contentType: "application/json") {
result(success: true)
}
} catch (Exception e) {
render(contentType: "application/json", status: 500) {
result(success: false, message: e.message)
}
}
} else {
render(contentType: "application/json", status: 500) { result(success: false) }
}
}
}
}
}
class SendSmsCommand {
String destination
String message
static constraints = {
message(size: 1..140)
}
}
你必须把一个index.gsp
在grails-app/views/smsService/index.gsp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.