Hi,
I want to change the authentication process that is used by the Acegi - Plugin. It should be a completly customized process. Cusotm login form + custom auth method.
Obviously there is only few documentation regarding this topic.
In the book "The Definitive Guide to Grails" it is described for an older version of grails. There the ...
Groovy adds the execute method to String to make executing shells fairly easy;
println "ls".execute().text
but if an error happens, then there is no resulting output. Is there an easy way to get both the standard error and standard out? (other than creating a bunch of code to; create two threads to read both inputstreams, then usin...
I am developing a small web app project (ColdFusion) and I am trying to keep my project split into multiple files during development, but deploy just one file on completion.
I have references to external files, for instance:
<script type="text/javascript" src="jquery-1.2.6.pack.js"></script>
<link type="text/css" rel="stylesheet" href=...
I'd like to take XML in the format below and load each code record into a domain object in my BootStrap.groovy. I want to preserve the formatting of each snippet of code.
XML
<records>
<code>
<language>Groovy</language>
<snippet>
println "This is Groovy"
println "A very powerful language"
...
Using groovy, would you expect better performance in terms of speed and memory overhead to read and query JSON vs XML?
...
I'm looking for something that will monitor Windows directories for size and file count over time. I'm talking about a handful of servers and a few thousand folders (millions of files).
Requirements:
Notification on X increase in size over Y time
Notification on X increase in file count over Y time
Historical graphing (or at least sav...
I want to copy text files and only text files from src/ to dst/
groovy:000> "cp src/*.txt dst/".execute().text
===>
groovy:000>
You can see the command executes w/out error but the file "src/test.txt" does not get copied to dst/
This also fails
groovy:000> "cp src/* dst/".execute().text
===>
groovy:000>
Howeve...
I'm currently working with Groovy and Grails. While Groovy is pretty straight-forward since it's basically Java, I can't say I grok Grails. I read that Groovy is to Grails as Ruby is to Ruby on Rails, but what does that mean?
...
In the following piece of code (taken from the Groovy User Guide), why prefix the assignment with the keyword def ?
def x = 0
def y = 5
while ( y-- > 0 ) {
println "" + x + " " + y
x++
}
assert x == 5
The def keyword can be removed, and this snippet would produce the same results. So what's the effect of the keyword def ?
...
I am a total Groovy newbie. I saw the following code on http://docs.huihoo.com/grails/1.0.3/ref/Controllers/beforeInterceptor.html
def beforeInterceptor = [action:this.&auth,except:'login']
How would I expand this to also include a second exception, say, if the action was 'login2'?
...
I've tried to use the new Groovy Grape capability in Groovy 1.6-beta-2 but I get an error message;
unable to resolve class com.jidesoft.swing.JideSplitButton
from the Groovy Console (/opt/groovy/groovy-1.6-beta-2/bin/groovyConsole) when running the stock example;
import com.jidesoft.swing.JideSplitButton
@Grab(group='com.jidesoft', m...
I have a domain class containing a couple of fields. I can access them from my .gsps. I want to add a method to the domain class, which I can call from the .gsps (this method is a kind of virtual field; it's data is not coming directly from the database).
How do I add the method and how can I then call it from the .gsps?
...
I'm currently in the planning stage for a web application and I find myself trying to decide on using Grails or Django. From an operation perspective:
Which ecosystem is easier to maintain (migrations, backup, disaster recovery etc.)? If using grails it'll probably be a typical tomcat + mysql on linux. If django it'll be apache + my...
It seems that Groovy does not support break and continue from within a closure. What is the best way to simulate this?
revs.eachLine { line ->
if (line ==~ /-{28}/) {
// continue to next line...
}
}
...
In Groovy, how do I grab a web page and remove HTML tags, etc., leaving only the document's text? I'd like the results dumped into a collection so I can build a word frequency counter.
Finally, let me mention again that I'd like to do this in Groovy.
...
The code
${personRequest.constraints.requestStatus.inList}
in my gsp file throws a NullPointerException, but "new PersonRequest().constraints..." works. Why? Isn't constraints static?
...
How do I make sure the correct encoding (UTF-8) is used by Grails?
...
I have a groovy script with an unknown number of variables in context at runtime, how do I find them all and print the name and value of each?
...
Obviously I could create a Calendar object with the date and use get(DAY) on it, but knowing Groovy, I would guess there is an easier, quicker way I just don't know about?
Answer
(date1..date2).size() == 1 //true if two dates are on same calendar day
...
I was fortunate enough to be able to start fresh with Grails. However, many people have asked me how to add Groovy and/or Grails to a legacy Java/JSP web app. Do people have experience or recommendations on how to best include Groovy and Grails into a large legacy application?
...