Re: [Lift] About the url rewrite (more thant one params and get 404 not found error)
"Neil.Lv" writes: > Hi all, > > I have a silly question about the url rewrite in the lift. > It has another two params in the url after the img. > > http://localhost:8080/show/img/version/id > > The url works fine. > => http://localhost:8080/show/img > => http://localhost:8080/show/img/v1/ > => http://localhost:8080/show/img/v1/1 > > Get 404 error if the "/" string is not added at the end of the url > (the id param isn't supplied) > => http://localhost:8080/show/img/v1 > > So, how can i rewrite the url and set the sitemap can make this link > ( http://localhost:8080/show/img/v1 ) > works fine as ( http://localhost:8080/show/img/v1/ ) when the id > is not supplied. > > Here is the code: > > ### > case RewriteRequest( > ParsePath(List("show", "img", version, id), _, _,_), _, _) => > RewriteResponse(List("show", "img"), > Map("version" -> version, "id" -> id) > ) > ### I'm not sure if this can be handled with the standard ParsePath, but it is fairly easy to write your own extractor that can handle more complex scenarios. Here's an example: object ParamsExtractor { def unapply(pp:ParsePath): Option[(Account, OrgUnit)] = { val result:Box[(Account, OrgUnit)] = if (pp.wholePath.startsWith(path) && pp.wholePath.length == (path.length + 2)) { val res = Full((XX,YY)) debug("Decoded URL: %s=%s".format(pp,res)) res } else None result } } used like this: case RewriteRequest(ParamsExtractor(account,orgUnit) , _, _) => (RewriteResponse(path), Full(account, orgUnit)) /Jeppe -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] ByList using OR instead of IN?
>From reading Exploring Lift (Section 6.1, page 81), it says that ByList corresponds to the “field IN (x,y,z)” syntax in SQL. Well, that was what I needed, so I took it for a test drive. However, instead of seeing SQL like: where some.id in (4, 9, 20) I am seeing SQL like: where some.id = 4 or some.id = 9 or some.id = 20. I double checked the latest code: http://github.com/dpp/liftweb/blob/master/framework/lift-persistence/lift-mapper/src/main/scala/net/liftweb/mapper/MetaMapper.scala and it looks like there isn't a magical workaround to get IN working as I expected. To me, this is a violation of SQL Tuning 101: as a rule of thumb, prefer the IN clause over an OR clause. Is there a good reason why this code creates OR clauses instead of an IN clause? -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] About the url rewrite (more thant one params and get 404 not found error)
Hi all, I have a silly question about the url rewrite in the lift. It has another two params in the url after the img. http://localhost:8080/show/img/version/id The url works fine. => http://localhost:8080/show/img => http://localhost:8080/show/img/v1/ => http://localhost:8080/show/img/v1/1 Get 404 error if the "/" string is not added at the end of the url (the id param isn't supplied) => http://localhost:8080/show/img/v1 So, how can i rewrite the url and set the sitemap can make this link ( http://localhost:8080/show/img/v1 ) works fine as ( http://localhost:8080/show/img/v1/ ) when the id is not supplied. Here is the code: ### case RewriteRequest( ParsePath(List("show", "img", version, id), _, _,_), _, _) => RewriteResponse(List("show", "img"), Map("version" -> version, "id" -> id) ) ### val entries = Menu(Loc("Home", List("index"), "Home")) :: Menu(Loc("show", List("show"), "show", Hidden)) :: User.sitemap ### BTW, I use the LiftView to handle the request. ### class show extends LiftView { def dispatch = { case "img" => imgDispatch _ case _ => allDispatch _ } def imgDispatch(): Box[NodeSeq] = { ... } def allDispatch(): Box[NodeSeq] = { ... } } ### Thanks very much! Cheers, Neil -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Less boilerplate in your specifications / tests
Hi all Lift-developers, I have noticed a few commits recently where the declarations for specifications could be reduced to something simpler. For example: import org.specs._ import org.specs.runner._ class BindingsSpecTest extends Runner(BindingsSpec) with JUnit with Console object BindingsSpec extends Specification can be written as import org.specs._ class BindingsSpec extends SpecificationWithJUnit - the BindingsSpec class will run with maven, provided that you add the proper include directive in the pom.xml file, like this, for example: org.apache.maven.plugins maven-surefire-plugin 2.4.3 false -Xmx512m always **/*Unit.java **/*Spec.java **/*Test.java - It will also run in the console, like this: scala -cp run net.liftweb.http.BindingsSpec I hope this helps, please ping me if you have any concern with this. Eric. PS: I forgot to mention that I am guilty of the situation above because of how things were done in specs when I starting contributing the first specifications to Lift,... PPS: I've edited the User Guide to make clear what was the preferred way of using JUnit with specs: http://code.google.com/p/specs/wiki/RunningSpecs#Run_your_specification_with_JUnit4 -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: Javascript Dependencies
Issue 281 is not going to make it into M3. The specific issue that needs to be solved first is how to manage dependencies across multiple snippets on one page. See the Assembla page for more information: http://www.assembla.com/spaces/liftweb/tickets/281 Peter On Feb 26, 5:14 pm, Peter Robinett wrote: > Mads, thanks for bringing ticket 281 to my attention, I'll address it > in my patch. > > Jeppe, that's how I plan on using it with Flot: having Flot.init > register the plugins and in the charts call toHTML as needed. > > Should have everything up on my pr1001_issue_322 branch by tomorrow. > > Peter > > On Feb 25, 1:14 am, Jeppe Nejsum Madsen wrote: > > > > > Peter Robinett writes: > > > Hi all, > > > [...] > > > > // Usage in boot.scala > > > val myJsScript = new JsScript("flot" :: "jquery.flot.selectable.js" :: > > > Nil) > > > ResourceServer.allow(myJsScript.allowResource) > > > > // Usage in a normal snippet > > > def mySnippet = { > > > > > > { myJsScript.toHTML } > > > > > > > > > The rest of the snippet... > > > > > > } > > > > // Usage in a CometActor > > > class myActor extends CometActor with JsScriptDependency { > > > override def scripts = List(new JsScript("flot" :: > > > "jquery.flot.selectable.js" :: Nil)); > > > } > > > > What do you think? It's a really quite basic but I think such an > > > approach could work well for things like as lift-flot. > > > It might be a start :-) I'm a little unsure if it supports the use case > > I would like to see: > > > I'm using jqPlot (a flot-like lib) and would like to, in boot, just > > initialize the widget: > > > jqPlot.init > > > jqPlot comes with numerous plugins and this should be handled by the > > widget. Whether a plugin is loaded on a page depends on some higher > > level structure. Ie. if I wish to draw a pie chart, the pie chart plugin > > should be loaded. > > > Looking back at this, it seems like this could work with the above > > > In init: register all plugins > > In the specific charts, call toHtml on the plugins needed > > > /Jeppe -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] New logging code is in master
Excellent! We have the deprecations turned off in the pom.xml file by default... but gotta turn the deprecation warnings on post M3. On Sun, Feb 28, 2010 at 8:14 AM, Jeppe Nejsum Madsen wrote: > The new logging code is now in master and should be fully usable. > Therefore, the existing logging code has been deprecated. > > I've added a Wiki article here: > http://wiki.github.com/dpp/liftweb/logging-in-lift > > /Jeppe > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] LiftRules.rewrite, 404 error
All, I have this rewrite returning 404 error. Here are what I did: URL: ../app-context-path//images/CBDU-1098-BCV?F1115261516749FQD=_ Template: src/main/webapp/viewImages.html LiftRules.rewrite.append( { case RewriteRequest(ParsePath("images" :: sku :: Nil, _, _,_), _, _) => RewriteResponse("viewImages" :: Nil, Map("imageId" -> sku)) } ) Are there any other settings I need to set? I have looked around but couldn't find any other than the basics listed above. Thanks in advance! -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: How do I add sitemap.xml and robots.txt
Marius, thanks for the reply. This is exactly what I needed & I'm off and running. Thanks again :) -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: New logging code is in master
On Sun, Feb 28, 2010 at 5:14 PM, Jeppe Nejsum Madsen wrote: > The new logging code is now in master and should be fully usable. > Therefore, the existing logging code has been deprecated. .although I don't seem to get any deprecation warnings when using eg Log.info Can somebody confirm if the deprecation works? /Jeppe -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re-opened #363
I reopened #363 because according to Lift convention, JQuery14Artifacts should actually refer to the compressed version of jquery-1.4.2 min that is generated by yuicompressor-maven-plugin (and not minified version available for download). Marius, let me know if you agree to this, if not we should actually go the other way round for the other bundled js (like jquery 1.3) as well to be consistent. Cheers, Indrajit -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Returning JS that runs on client and sets result in a div
Jeg can find a lot of information about this in the lift book: http://groups.google.com/group/the-lift-book chaper 8 for Lift and Javascript and 9 for Ajax and Comet ind lift :) On 28/02/2010, at 21.49, greekscala wrote: > Hello lifters, > > I am trying to find a way to return a JS expression, that will run on > the client and > a div should be updated with the result. > > Someone here that did this? > with best regards > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Returning JS that runs on client and sets result in a div
Hello lifters, I am trying to find a way to return a JS expression, that will run on the client and a div should be updated with the result. Someone here that did this? with best regards -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: [lift] scalajpa for 2.8
You are using scalajpa-1.2-SNAPSHOT which is built with Scala 2.7.x and thus binary incompatible with Scala 2.8. To use 2.8 port of scalajpa, you should be using the version scalajpa-1.2-scala280-SNAPSHOT. Your best bet would be to start with a lift-jpa archetype from 2.8 branch. You could create a project from lift-archetype-jpa-basic as thus: mvn archetype:generate \ -DarchetypeRepository=http://scala-tools.org/repo-snapshots \ -DremoteRepositories=http://scala-tools.org/repo-snapshots \ -DarchetypeGroupId=net.liftweb \ -DarchetypeArtifactId=lift-archetype-jpa-basic \ -DarchetypeVersion=2.0-scala280-SNAPSHOT \ -DgroupId=com.mypackage \ -DartifactId=myproject \ -Dversion=1.0-SNAPSHOT The project thus created would be using the right version of scalajpa (built on Scala 2.8). Cheers, Indrajit On 28/02/10 6:34 PM, sjcarroll6 wrote: I've downloaded the scalajpa-1.2SNAPSHOT. I am now getting the following error: Error while loading ScalaEntityManager, Scala signature entity manager has wrong version, expecting 5 found 4.1 in scalajpa-1.2-SNAPSHOT. Any help in resolving this issue would be helpful. sjcarroll6 wrote: I was able to locate the 1.2 snapshot. From this I was able to find out that this was initial port for 2.8. I'm trying to read Proj JPA and converting the java code to scala. Since I don't know much about scala or JPA this is proving to be a challenge. If anyone could point me to a simple LocalEMF CRUD example that would be great. Also, if anyone could indicate if scalajpa 1.2 has any known issues with JPA 2.0 eclipselink that would be helpful. Thank you sjcarroll6 wrote: Are there any known issues with using scalajpa with 2.8? I read one post which indicated scalajpa will need to be updated for 2.8 but it wasn't clear if the existing version was still usable. Thanks, -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] New logging code is in master
Finally! Great job, Jeppe. - IRC On 28/02/10 9:44 PM, Jeppe Nejsum Madsen wrote: The new logging code is now in master and should be fully usable. Therefore, the existing logging code has been deprecated. I've added a Wiki article here: http://wiki.github.com/dpp/liftweb/logging-in-lift /Jeppe -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] *** BREAKING CHANGE *** Issue 155: Mapper <> JSON
The changes mentioned here has been committed to master: http://groups.google.com/group/liftweb/browse_frm/thread/8db6bbb93c16e0f5/e9c3cdce2f011313?lnk=gst&q=MappedField.name%2C+affects+Mappe#e9c3cdce2f011313 This means that MappedField.name is no longer lower cased, but preserves the case of the field. This in turn means the JSON representation of the mapped field will change. /Jeppe -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] New logging code is in master
The new logging code is now in master and should be fully usable. Therefore, the existing logging code has been deprecated. I've added a Wiki article here: http://wiki.github.com/dpp/liftweb/logging-in-lift /Jeppe -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Happy 3rd Anniversary to Lift
+1 Huge honor to be a part of the community. Thank you David, thank you early committers, thank you early adopters. - Indrajit On 27/02/10 7:16 PM, Heiko Seeberger wrote: I am proud to be on board and looking forward to the next three years Heiko On Saturday, February 27, 2010, David Pollak wrote: Folks, Today is Lift's 3rd Anniversary/Birthday! Before I go offline for the weekend, I wanted to give a hearty thanks for the Scala team, the Scala community, the Lift committers, and most importantly the Lift community members new and old for making Lift possible, fun, and challenging. Thank you all very, very much for everything each and everyone one of you has done. David -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: [lift] scalajpa for 2.8
I've downloaded the scalajpa-1.2SNAPSHOT. I am now getting the following error: Error while loading ScalaEntityManager, Scala signature entity manager has wrong version, expecting 5 found 4.1 in scalajpa-1.2-SNAPSHOT. Any help in resolving this issue would be helpful. sjcarroll6 wrote: > > I was able to locate the 1.2 snapshot. From this I was able to find out > that this was initial port for 2.8. I'm trying to read Proj JPA and > converting the java code to scala. Since I don't know much about scala or > JPA this is proving to be a challenge. If anyone could point me to a > simple LocalEMF CRUD example that would be great. Also, if anyone could > indicate if scalajpa 1.2 has any known issues with JPA 2.0 eclipselink > that would be helpful. > > Thank you > > > sjcarroll6 wrote: >> >> Are there any known issues with using scalajpa with 2.8? I read one post >> which indicated scalajpa will need to be updated for 2.8 but it wasn't >> clear if the existing version was still usable. >> >> Thanks, >> > > -- View this message in context: http://old.nabble.com/scalajpa-for-2.8-tp27731695p27734808.html Sent from the liftweb mailing list archive at Nabble.com. -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: [Lift committers] Lots to do by end of day on Sunday **Important for Committers**
Naftoli Gugenheim writes: > Would anyone be able to change my open tickets to after M3? I don't think I'l > have a chance to deal with them before code slush. I'm not sure but I think > they're 257, 258, 370, and 371. > Thanks! > Moved to M4 /Jeppe -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: How do I add sitemap.xml and robots.txt
To served back an xml file you'd probably want to use proper mimetype text/xml, or application/xml. Id' recommend using DispatchPf. In Boot: val dispatcher: LiftRules.DispatchPF = { case Req("sitemap" :: Nil, "xml", _) => () => Full(new XmlResponse( ) } LiftRules.dispatch.prepend(dispatcher); On Feb 28, 3:03 am, Bob Folkerts wrote: > I'm trying to add robots.txt and a sitemap.xml to a web site. My > Boot.scala has a snippet that looks like > > val entries = Menu(Loc("Home", List("index"), "Home")) :: > galleryMenu :: servingYouMenu :: > socialSitesMenu :: aboutUsMenu :: > Menu(Loc("ContactUs", List("ContactUs"), "Contact > Us")) :: > Menu(Loc("robots", List("robots.txt"), > "robots.txt", Hidden)) :: > Menu(Loc("sitemap", List("sitemap.xml"), > "sitemap.xml", Hidden)) ::Nil > > The robots.txt file shows up right away, but I get a 404 when I try to > access /sitemap.xml . I have a static sitemap.xml that I want to > include. I tried this as a static xml file in the webapp directory. > I also tried it without the explicit '.xml', but I had the same > results. I tried to make it look more like my html, so I added a > sitemap-tempate.xml in templates-hidden and had the sitemap.xml > reference that. > > Eventually, I would like to generate the sitemap.xml from the SiteMap > assuming that the user has not logged into the application. I would > also assume that for most users, a default robots.txt would be easy to > generate. This seems like something of general utility that would be > a good chance to learn more about Lift. > > Can anyone explain how to display the simple, static sitemap.xml. I'm > sure this is a newbie mistake, but I'm not seeing it on my own. -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.