url-mapping

Hide id param in url in Grails App

我的未来我决定 提交于 2019-12-13 03:59:10
问题 I have a URL that looks like /myController/myAction/id . How could I hide the id in that URL so it looks like: /myController/myAction/username [email] 回答1: Define in UrlMapping.groovy as "/myController/myAction/$username"(controller: "myController",action: "myAction") and you'll be able to get the param in controller params.username 回答2: Define in UrlMapping.groovy as "/myController/myAction/$username"(controller: "myController",action: "myAction") you'll be able to get the param in

How to map the url's of view's in browser to one specific name?

心已入冬 提交于 2019-12-13 03:53:49
问题 M new to grails n now my problem is, I want when i browse my application instead of getting URL as http://localhost:8080/merchant/ i want to display only ://localhost. Like wise when i browse other views of my application i get URL like http://localhost:8080/merchant/register/list now also i don want it to display app controller and action names there instead i want it to display a single word may be list or something else which i want. I gone through URLMapping concepts but i din get what

how to detect whether a uri is allow by shiro or extract controller name from uri

我怕爱的太早我们不能终老 提交于 2019-12-13 02:37:47
问题 i have a uri such as someController/someAction?param1=aa&param2=bb is there some method of grails can extract controller name and action name from this uri. or shiro has any method to detect this uri is permitted? i have a domain Menu(name,url), and now want to get the menu list which is permitted for current user. url such as /auth/login(may be mapping as user:login), /user/login so 2 days ago i ask this question. now i change the menu to (name,controller,action,param),and filter the

Grails with JAX-RS vs UrlMappings for RESTful Services

↘锁芯ラ 提交于 2019-12-13 01:54:27
问题 I started out looking at the JAX-RS plugin for grails and thought that was the way to go mainly because it was based on JSR-311 and I figure following standards is usually the smart thing to do. However, using Grail's UrlMappings it seems I basically achieve the same thing. I figure I'm missing something, however, we aren't doing anything overly complex. We basically just need to expose CRUD via an API. Example of doing the same thing with both versions: JAX-RS: @PUT @Consumes(['application

UrlMappings to point a URL to an asset pipeline file in Grails

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 08:43:04
问题 In Grails 3.0 how do you map a URL to a file under the assets folder? For example: http://localhost:8080/favicon.ico --> grails-app/assets/images/bookmark.ico I've tried a few test mappings, such as: grails-app/controllers/UrlMappings.groovy class UrlMappings { static mappings = { ... "/t1.png" (uri: "/assets/images/test.png") "/t2.png" (uri: "/assets/test.png") "/t3.png" (uri: "/images/test.png") "/t4.png" (dir: "assets/images", file: "test.png") ... } } ...but they all result in a 500

Add URL Mapping on demand

谁说胖子不能爱 提交于 2019-12-12 04:34:54
问题 My grails project has at least 20 controllers each with at least 4 methods each, and it is continuing to grow. I decided to annotate every method like this: import enums.URLMapped class HomeController { @URLMapped(url="/", alias="home") def landingPage() { render(view: "/index") } } How can I append this URL value inside the URLMapping.groovy dynamically? I could do something like: import enums.URLMapped import java.lang.reflect.Method import org.apache.commons.lang.StringUtils import org

Spring MVC URL mapping in controller For dynamic URLs

本秂侑毒 提交于 2019-12-12 01:13:09
问题 I have a page with part of a URL that is dynamic e.g. http://localhost:8080/myApp/myPageList.htm?recNo=107&recNo=-96&recNo=-24&recNo=-9&recNo=38&recNo=-21&recNo=-50&crimeRecNo=-110 The last part of the page recNo is a parameter passed to the page. However, the parameter value was encrypted. I would like to know how I can set the urlMapping in the controller. I will be posting the data and i will require a urlMapping to process this form. 回答1: So based on your comments your request mapping

customizing url mapping of multiple sites in sitecore

谁说我不能喝 提交于 2019-12-11 06:41:17
问题 So, I want to customize my mappings of urls to home pages inside Sitecore my sites home pages are nodes like this (below /sitecore/content): /FOO/us /FOO/ca /FOO/..other countries /BAR i Want to reach them by the following urls: mysite.com/us -> /FOO/us mysite.com/ca -> /FOO/ca mysite.com/bar -> /BAR my sites declarations are like this <site name="FOO-US" virtualFolder="/us" physicalFolder="/us" rootPath="/sitecore/content" startItem="/FOO/us" database="web" domain="extranet" allowDebug="true

Dynamic URL REWRITING for QueryStrings

痴心易碎 提交于 2019-12-11 02:14:03
问题 hello please help me for this question i have the following url --> www.sample.com/news.aspx?id=45 i want pass "id" in the query string to news.aspx and show this news, but due to url rewriting the url is changed to this --> www.sample.com/news/my-news-45/ How to extract "id" from the query string? Thanx for your help 回答1: you can manually done URL rewriting but The downside of manually writing code can be tedious and error prone. Rather than do it yourself, I'd recommend using one of the

How to exclude specific keywords from UrlMapping in Grails?

心已入冬 提交于 2019-12-10 14:49:11
问题 I use the following url mapping in Grails: "/$id"{ controller = "user" action = "show" } to map urls like mydomain.com/someusername How do I attach constrains to the url mapping to exclude keywords like "login", "logout",... I.e., mydomain.com/someusername should route to mydomain.com/user/show/someusername, mydomain.com/login should not route to mydomain.com/user/show/login. 回答1: You can use contrainsts for this mapping: "/$id"{ controller = "user" action = "show" constraints { //add a