禁用grails可搜索插件的默认搜索页面? [英] Disable grails Searchable plugin default search page?

查看:92
本文介绍了禁用grails可搜索插件的默认搜索页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试禁用Searchable插件默认搜索页面( http://localhost/searchable/) ,但还没有找到一种方法.任何人都知道如何做到这一点,最好以合法的方式,但在必要时采取欺骗手段?

I'm trying to disable the Searchable plugin default search page (http://localhost/searchable/), but haven't found a way to do it. Anyone know how this can be done, preferably in a legit way, but resorting to trickery if necessary?

推荐答案

我通常将错误代码处理程序重新路由到控制器,以便在呈现视图之前可以进行一些日志记录或其他操作.您还可以在这里使用它:

I usually re-route error code handlers to a controller so I can do some logging or whatever before rendering the view. You can use that here also:

class UrlMappings {

   static mappings = {

      "/searchable/$action?"(controller: "errors", action: "urlMapping")

      "/$controller/$action?/$id?" { }

      "/"(view:"/index")

      "403"(controller: "errors", action: "accessDenied")
      "404"(controller: "errors", action: "notFound")
      "405"(controller: "errors", action: "notAllowed")
      "500"(view: '/error')
   }
}

其中ErrorsController看起来像这样:

where ErrorsController looks something like this:

class ErrorsController {

   def accessDenied = {}

   def notFound = {
      log.debug "could not find $request.forwardURI"
   }

   def notAllowed = {}

   def urlMapping = {
      log.warn "unexpected call to URL-Mapped $request.forwardURI"
      render view: 'notFound'
   }
}

,您将需要在grails-app/errors中创建accessDenied.gsp,notFound.gsp和notAllowed.gsp

and you'll need to create accessDenied.gsp, notFound.gsp, and notAllowed.gsp in grails-app/errors

通过向其自定义映射发送隐藏"控制器,您可以记录对其的意外访问,但仍会呈现404页面以隐藏其存在.

By sending a 'hidden' controller to its custom mapping you can log unexpected access to it, but still render the 404 page to hide its existence.

这篇关于禁用grails可搜索插件的默认搜索页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆