Specify redirects directly in UrlMappings.groovy?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Specify redirects directly in UrlMappings.groovy?

Steven Cummings
After some searching it seems that url mappings can only be specified in terms of controller-action pairs and/or views. So the two immediate and direct options for simple redirects are:

* Define the same controller/action/view as the target in the source mapping (not actually an HTTP redirect); or
* Define a nearly empty controller for the source URL that redirects to the target.

This is by no means a show-stopper from a technical standpoint, but it seems that you should be able to manage simple redirects and URL synonyms in the mappings, avoiding the creation of an otherwise useless controller or repeating the mapping definition of the target. E.g., in URL mappings I want to be able to say:

"/"(redirect:'/somethingElse')

This would be more concise than the first option, and more DRY than the second. Did I miss something and this is already possible, or is this worth logging an RFE?
--
Steven
Reply | Threaded
Open this post in threaded view
|

Re: Specify redirects directly in UrlMappings.groovy?

tomas lin
You can also specify a filter for mapping your redirects.

This keeps your URL mappings simple and allows you to change your
redirects without having to redeploy your application.

One that I've ran into recently is this:
http://www.zlatkovic.com/httpredirectfilter.en.html

On Tue, Mar 9, 2010 at 11:01 PM, Steven Cummings <[hidden email]> wrote:

> After some searching it seems that url mappings can only be specified in
> terms of controller-action pairs and/or views. So the two immediate and
> direct options for simple redirects are:
> * Define the same controller/action/view as the target in the source mapping
> (not actually an HTTP redirect); or
> * Define a nearly empty controller for the source URL that redirects to the
> target.
>
> This is by no means a show-stopper from a technical standpoint, but it seems
> that you should be able to manage simple redirects and URL synonyms in the
> mappings, avoiding the creation of an otherwise useless controller or
> repeating the mapping definition of the target. E.g., in URL mappings I want
> to be able to say:
> "/"(redirect:'/somethingElse')
> This would be more concise than the first option, and more DRY than the
> second. Did I miss something and this is already possible, or is this worth
> logging an RFE?
> --
> Steven
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Specify redirects directly in UrlMappings.groovy?

Steven Cummings
That works, but it doesn't quite keep with the goal of consolidating redirects to UrlMappings.groovy. If I have to stray outside that, I'd like to still confine my definitions and declarations to the groovy project itself if it can be helped.
--
Steven


On Wed, Mar 10, 2010 at 3:03 AM, Tomas Lin <[hidden email]> wrote:
You can also specify a filter for mapping your redirects.

This keeps your URL mappings simple and allows you to change your
redirects without having to redeploy your application.

One that I've ran into recently is this:
http://www.zlatkovic.com/httpredirectfilter.en.html

On Tue, Mar 9, 2010 at 11:01 PM, Steven Cummings <[hidden email]> wrote:
> After some searching it seems that url mappings can only be specified in
> terms of controller-action pairs and/or views. So the two immediate and
> direct options for simple redirects are:
> * Define the same controller/action/view as the target in the source mapping
> (not actually an HTTP redirect); or
> * Define a nearly empty controller for the source URL that redirects to the
> target.
>
> This is by no means a show-stopper from a technical standpoint, but it seems
> that you should be able to manage simple redirects and URL synonyms in the
> mappings, avoiding the creation of an otherwise useless controller or
> repeating the mapping definition of the target. E.g., in URL mappings I want
> to be able to say:
> "/"(redirect:'/somethingElse')
> This would be more concise than the first option, and more DRY than the
> second. Did I miss something and this is already possible, or is this worth
> logging an RFE?
> --
> Steven
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Specify redirects directly in UrlMappings.groovy?

Steven Cummings
In reply to this post by Steven Cummings
I mis-spoke slightly in my post. I should have said "This would be more concise than the *second* option, and more DRY than the *first*." That might have been confusing.
--
Steven


On Tue, Mar 9, 2010 at 11:01 PM, Steven Cummings <[hidden email]> wrote:
After some searching it seems that url mappings can only be specified in terms of controller-action pairs and/or views. So the two immediate and direct options for simple redirects are:

* Define the same controller/action/view as the target in the source mapping (not actually an HTTP redirect); or
* Define a nearly empty controller for the source URL that redirects to the target.

This is by no means a show-stopper from a technical standpoint, but it seems that you should be able to manage simple redirects and URL synonyms in the mappings, avoiding the creation of an otherwise useless controller or repeating the mapping definition of the target. E.g., in URL mappings I want to be able to say:

"/"(redirect:'/somethingElse')

This would be more concise than the first option, and more DRY than the second. Did I miss something and this is already possible, or is this worth logging an RFE?
--
Steven

Reply | Threaded
Open this post in threaded view
|

Re: Specify redirects directly in UrlMappings.groovy?

Graeme Rocher-3
Raise a feature request

Cheers

On 10 Mar 2010, at 05:01, Steven Cummings wrote:

> I mis-spoke slightly in my post. I should have said "This would be more concise than the *second* option, and more DRY than the *first*." That might have been confusing.
> --
> Steven
>
>
> On Tue, Mar 9, 2010 at 11:01 PM, Steven Cummings <[hidden email]> wrote:
> After some searching it seems that url mappings can only be specified in terms of controller-action pairs and/or views. So the two immediate and direct options for simple redirects are:
>
> * Define the same controller/action/view as the target in the source mapping (not actually an HTTP redirect); or
> * Define a nearly empty controller for the source URL that redirects to the target.
>
> This is by no means a show-stopper from a technical standpoint, but it seems that you should be able to manage simple redirects and URL synonyms in the mappings, avoiding the creation of an otherwise useless controller or repeating the mapping definition of the target. E.g., in URL mappings I want to be able to say:
>
> "/"(redirect:'/somethingElse')
>
> This would be more concise than the first option, and more DRY than the second. Did I miss something and this is already possible, or is this worth logging an RFE?
> --
> Steven
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Specify redirects directly in UrlMappings.groovy?

Steven Cummings
Done. http://jira.codehaus.org/browse/GRAILS-5994
--
Steven


On Wed, Mar 10, 2010 at 10:22 AM, Graeme Rocher <[hidden email]> wrote:
Raise a feature request

Cheers

On 10 Mar 2010, at 05:01, Steven Cummings wrote:

> I mis-spoke slightly in my post. I should have said "This would be more concise than the *second* option, and more DRY than the *first*." That might have been confusing.
> --
> Steven
>
>
> On Tue, Mar 9, 2010 at 11:01 PM, Steven Cummings <[hidden email]> wrote:
> After some searching it seems that url mappings can only be specified in terms of controller-action pairs and/or views. So the two immediate and direct options for simple redirects are:
>
> * Define the same controller/action/view as the target in the source mapping (not actually an HTTP redirect); or
> * Define a nearly empty controller for the source URL that redirects to the target.
>
> This is by no means a show-stopper from a technical standpoint, but it seems that you should be able to manage simple redirects and URL synonyms in the mappings, avoiding the creation of an otherwise useless controller or repeating the mapping definition of the target. E.g., in URL mappings I want to be able to say:
>
> "/"(redirect:'/somethingElse')
>
> This would be more concise than the first option, and more DRY than the second. Did I miss something and this is already possible, or is this worth logging an RFE?
> --
> Steven
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email