Return to Snippet

Revision: 42880
at March 17, 2011 23:44 by tarpers


Updated Code
import org.codehaus.groovy.grails.plugins.codecs.URLCodec
 
class UrlMappings {
 
	static mappings = {
		// Add the URL encode and decode methods as the codec methods are added 
		// after the mappings are processed.
		final codec = URLCodec.newInstance()
		Object.metaClass."encodeAsURL" = { -> codec.encode(delegate) }
		Object.metaClass."decodeURL" = { -> codec.decode(delegate) }
 
		"/$department/"{
			controller = "home"
			action = "index"
			constraints {
				department(inList:['women','damen','γυναίκες'.encodeAsURL()])
			}
		}
 
 
	}
 
}

Revision: 42879
at March 11, 2011 22:00 by tarpers


Updated Code
import org.codehaus.groovy.grails.plugins.codecs.URLCodec

class UrlMappings {
	
	static mappings = {
		// Add the URL encode and decode methods as the codec methods are added 
		// after the mappings are processed.
		final codec = URLCodec.newInstance()
		Object.metaClass."encodeAsURL" = { -> codec.encode(delegate) }
		Object.metaClass."decodeURL" = { -> codec.decode(delegate) }
		import org.codehaus.groovy.grails.plugins.codecs.URLCodec
		
		"/$department/"{
			controller = "home"
			action = "index"
			constraints {
				department(inList:['women','damen','γυναίκες'.encodeAsURL()])
			}
		}
		
		
	}

}

Revision: 42878
at March 11, 2011 21:53 by tarpers


Updated Code
import org.codehaus.groovy.grails.plugins.codecs.URLCodec

class UrlMappings {
	
	static mappings = {
		// Add the URL encode and decode methods as the codec methods are added 
		// after the mappings are processed.
		final codec = URLCodec.newInstance()
		Object.metaClass."encodeAsURL" = { -> codec.encode(delegate) }
		Object.metaClass."decodeURL" = { -> codec.decode(delegate) }
		import org.codehaus.groovy.grails.plugins.codecs.URLCodec
		
		"/$department/"{
			controller = "home"
			action = "index"
			constraints {
				department(inList:['women','damen','�³���½�±�¯�º�µ��'.encodeAsURL()])
			}
		}
		
		
	}

}

Revision: 42877
at March 11, 2011 21:52 by tarpers


Updated Code
import org.codehaus.groovy.grails.plugins.codecs.URLCodec

class UrlMappings {
	
	static mappings = {
		// Add the URL encode and decode methods as the codec methods are added 
		// after the mappings are processed.
		final codec = URLCodec.newInstance()
		Object.metaClass."encodeAsURL" = { -> codec.encode(delegate) }
		Object.metaClass."decodeURL" = { -> codec.decode(delegate) }
		import org.codehaus.groovy.grails.plugins.codecs.URLCodec
		
		"/$department/"{
			controller = "home"
			action = "index"
			constraints {
				department(inList:['women','damen','γ�ναίκε�'.encodeAsURL()])
			}
		}
		
		
	}

}

Revision: 42876
at March 11, 2011 21:48 by tarpers


Initial Code
import org.codehaus.groovy.grails.plugins.codecs.URLCodec

class UrlMappings {
	
	static mappings = {
		// Add the URL encode and decode methods as the codec methods are added 
		// after the mappings are processed.
		final codec = URLCodec.newInstance()
		Object.metaClass."encodeAsURL" = { -> codec.encode(delegate) }
		Object.metaClass."decodeURL" = { -> codec.decode(delegate) }
		import org.codehaus.groovy.grails.plugins.codecs.URLCodec
		
		"/$department/"{
			controller = "home"
			action = "index"
			constraints {
				department(inList:['women','damen','γυναίκες'.encodeAsURL()])
			}
		}
		
		
	}

}

Initial URL

                                

Initial Description

                                

Initial Title
Grails - Using codecs in UrlMappings config

Initial Tags

                                

Initial Language
Groovy