Sorry - I need a 301 not a 302 in most situations - minor detail I know...
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Stateless dispatch that you posted is that--it can handle everything in 1 place, it's just partial function
I would say that a cleaner way to handle that is by having something nginx in front of lift.
On Mon, Dec 22, 2014 at 6:19 PM, Gary Hewett <gary.hewett@technical-magic.com> wrote:
Sorry - I need a 301 not a 302 in most situations - minor detail I know...
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+unsubscribe@googlegroups.com.
LiftRules.dispatch.prepend {
case r @ Req("index.html" :: _, _, _) => () => Full(PermRedirectResponse("/", r))
case r @ Req("index.htm" :: _, _, _) => () => Full(PermRedirectResponse("/", r))
case r @ Req("index.jsp" :: _, _, _) => () => Full(PermRedirectResponse("/", r))
case r @ Req("home" :: _, _, _) => () => Full(PermRedirectResponse("/", r))
}
I'm not sure if I'm in a world of future pain when this hits a Tomcat container due to the moving form relative URLs to absolute ones but that is a different issue.
I'm trying to determine if there is a way to place a regex in the case statement logic but have yet to get full bearings on reading docs, healer classes and what Scala (ahem) loosely calls constructors. You're making Java look fun once more as at least I know exactly how things got done :)
Regex (non functional) example:
LiftRules.dispatch.prepend {
case r @ Req("index" (html,jsp,htm) :: _, _, _) => () => Full(PermRedirectResponse("/", r))
case r @ Req("home" :: _, _, _) => () => Full(PermRedirectResponse("/", r))
}
As for the answers to "do it elsewhere" I really want this particular "business logic" right next to where I define the Menu and to ensure that I'm not mixing development with maintenance. Doing the latter can be a nightmare at the next upgrade. Bear in mind that I may be dealign with insanely long URLs. Also bear in mind that I may want to connect this to a data store at some point and make generating this map a dynamic process -- e.g. read the database and generate the map on boot.
Editorial note: The Lift (ahem Scala?) Brochure promised that functions were first class citizens of the language -- however I feel like methods have been railroaded out of town :) Would love to see how to connect the dots between the two so I can actually write code once more instead of just praying!
You don't need reg ex, just list of string and call contains.
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.