url-mapping

Grails “loses” custom URL mapping when following any links on the page

微笑、不失礼 提交于 2019-12-04 19:08:10
I have an application where users can browse maps in two ways (like thumbnails and in a list) /map/browse /map/list Now, I would like to restrict these views to just show maps of a specific user, for example through /user/3/browse /user/3/list So I created the mapping: "/user/$userId/browse" { controller = "map" action = "browse" } "/user/$userId/list" { controller = "map" action = "list" } Now, I can go to /user/3/browse , but as soon as I click on a pagination link or change the pagination filters, the URL goes back to /map/browse . Also, if I set the userId to null in the controller, I get

Spring Controller's URL request mapping not working as expected

旧街凉风 提交于 2019-12-04 07:34:48
I have created a mapping in web.xml something like this: <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/about/*</url-pattern> </servlet-mapping> In my controller I have something like this: import org.springframework.stereotype.Controller; @Controller public class MyController{ @RequestMapping(value="/about/us", method=RequestMethod.GET) public ModelAndView myMethod1(ModelMap model){ //some

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

白昼怎懂夜的黑 提交于 2019-12-04 05:01:52
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 server error. If you are not using the Asset-Pipeline you can map static resources to URLs by following the

How to create custom url in Yii [duplicate]

旧街凉风 提交于 2019-12-03 21:23:00
This question already has answers here : Closed 7 years ago . Possible Duplicate: How to make user profile link like facebook for my web page How do i manage custom url for user profile like www.exampl.com/brito insted of www.exampl.com/user/profile/id/22 www.exampl.com/jhon insted of www.exampl.com/user/profile/id/31 www.exampl.com/piter insted of www.exampl.com/user/profile/id/66 I have done below code in my config/main.php file, now its works for this 3 static users only. how can i change it dynamically for all 1000 of users? urlManager'=>array( 'urlFormat'=>'path', 'showScriptName'=>false,

spring BeanCreationException confusion about mapping

青春壹個敷衍的年華 提交于 2019-12-03 18:05:38
问题 trying to integrate hibernate and spring ,I ran into this error SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException : Error creating bean with name ' org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping ': Initialization of bean failed; nested exception is java.lang.IllegalStateException : Cannot map handler ' org.me.spring.hib.school.web.SchoolController#0 ' to URL path [ /allschools ]: There is already handler of type

RESTful grails application: DRYing up UrlMapping

邮差的信 提交于 2019-12-03 13:24:50
Let's say we have a grails web application exposing several resources. tags urls users The application has a classical web-interface which the users interact with and some administration. We want to expose the resources from the application to clients via a RESTful API and we don't want that part of the app to clutter up the controllers and code we already have. So we came up with the following: If the web interface offers host/app_path/url/[list|show|create] we want the REST API to be at /host/app_path/rest/url . So we ended up with the following UrlMappings file: class UrlMappings { static

Clean URLs with PHP [duplicate]

家住魔仙堡 提交于 2019-12-01 13:23:33
问题 This question already has answers here : How to create friendly URL in php? (8 answers) Closed 6 months ago . So I am trying to build a clean url system in PHP to change URLS like this http://example.com/index.php?projects=05 to: http://example.com/projects/05 So far, I have figured out how to use parse_url to map urls that look like http://example.com/index.php/projects/05 but I can't figure out how to remove the 'index.php' from the URL. Is there a way to use .htaccess to remove index.php

How to ignore Spring Security config for every thing except a pattern

天大地大妈咪最大 提交于 2019-12-01 07:31:04
I have a rest webservice configured as a spring boot application. All my rest urls have a base path "/api/...". I am also serving static content from my application. I need to configure security ONLY for the web service i.e., URLs that start with "/api/..." but give the other static content w/o applying security. I've only seen examples where we filter some url patterns via: @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers("/resources/*"); } but not otherwise ... Use the antMatcher method of HttpSecurity class: @Configuration @EnableWebSecurity

Url Mapping For Jsp

若如初见. 提交于 2019-12-01 06:34:57
问题 I would like to do a mapping for my web pages. A sort of mapping like Servlet Mapping that i've done in the web.XML, not necessarily the same code or procediment but the same result. In other words my goal is to hide the deployment of my web pages. Is it possible? 回答1: You can do it the same way as for servlets. The only difference is that you must use jsp-file instead of servlet-class to declare your servlet: <servlet> <servlet-name>Hello</servlet-name> <jsp-file>hello.jsp</jsp-file> <

How to ignore Spring Security config for every thing except a pattern

淺唱寂寞╮ 提交于 2019-12-01 05:12:10
问题 I have a rest webservice configured as a spring boot application. All my rest urls have a base path "/api/...". I am also serving static content from my application. I need to configure security ONLY for the web service i.e., URLs that start with "/api/..." but give the other static content w/o applying security. I've only seen examples where we filter some url patterns via: @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers("/resources/*"); } but