I wonder if there is any way I could change the default output (System.out) for the groovy script that I'm executing from my Java code.
Here is the Java code:
public void exec(File file, OutputStream output) throws Exception {
GroovyShell shell = new GroovyShell();
shell.evaluate(file);
}
And the sample groovy script:
def na...
Hi,
When I execute the following script:
mb = new groovy.xml.StreamingMarkupBuilder()
mb.encoding = "UTF-8"
xmlClosure = {...} //BIG XML File building (at least 300 KB)
new OutputStreamWriter(new FileOutputStream(exportXmlFile), 'utf-8') << groovy.xml.XmlUtil.serialize(mb.bind(xmlClosure))
The XML export file is truncated!!
If ins...
Assuming that I have an object someObj of indeterminate type, I'd like to do something like:
def value = someObj.someMethod()
Where there's no guarantee that 'someObj' implements the someMethod() method, and if it doesn't, just return null.
Is there anything like that in Groovy, or do I need to wrap that in an if-statement with an in...
I have a Java object called Parameter and I'm trying to mock it using groovy. Parameter is an abstract class with 1 abstract method. It also has a non-abstract method called getName(). I'm trying to mock it as follows in Groovy:
def p1 = [name:{"p1Name"}] as Parameter
But I get a runtime error because I don't implement the abstract m...
I am using on my table to sort the values. but it is causing wrapping up the column header on firefox. Its work fine on IE.
can anyone suggest some solution for this?
using grails 1.0.1 version.
thanks
...
If I have a list with following elements
list[0] = "blach blah blah"
list[1] = "SELECT something"
list[2] = "some more text"
list[3] = "some more text"
How can I find the index of where the string starts with SELECT.
I can do list.indexOf("SELECT something");
But this is a dynamic list. SELECT something wont always be SELECT someth...
Hi,
I have groovy 1.7 beta 1 in my path and GROOVY_HOME pointing to same groovy 1.7 beta 1 directory. I have installed grails 1.2-M3, and set GRAILS_HOME to point to grails 1.2-M3.
I would like to try some groovy 1.7 features in my grails app, anonymous inner classes to be precise. I am receiving a compiler error even though this feat...
I have the following different texts
line1: SELECT column1,
line2: column2,
line3: RTRIM(LTRIM(blah1)) || ' ' || RTRIM(LTRIM(blah3)),
line4: RTRIM(LTRIM(blah3)) || ' ' || RTRIM(LTRIM(some1)) outColumn,
line5: RTRIM(LTRIM(blah3)) || ' ' || RTRIM(LTRIM(some1)) something,
line6: somelast
Following is what I want to get out of each line
b...
Using markup with the render is not adding the form tag.
I tried this with contentType "text/html", "txt/xml" and it does not work.
I have this in my controller:
def myTest= {
render(contentType: "text/plain") {
div(id:"myDiv") {
p "somess text inside the div"
form (action:'get') {
p "inside form"
}
}
...
Hi,
I'm using the groovy ant task to compile my groovy files, but it seems like groovy locks the jar file so it can't be moved, deleted, signed, etc. Has anyone run into this bug before and have a workaround? Seems weird that if I run the groovy ant task and compile to a jar file that groovy doesn't release that jar file.
thanks,
Jeff...
I'm following Scott Davis' tutorials on developing grails apps, but whenever i try to run my app (or indeed his source code) i get "Firefox has detected that the server is redirecting the request for this address in a way that will never complete." Safari gives a similar error message as does Opera.
As i've tested the original authors...
Is there a library for Groovy that introspects XML and provides an object to access each node - like lxml for Python?
...
I came across Nimble yesterday, but couldn't get past Step 1, configuring BuildConfig.groovy to find the Nimble's remote repository.
My BuildConfig.groovy file is one line:
grails.plugin.repos.discovery.intient="http://intient.com/downloads/grails/"
Here is the message I get when running grails install-plugin nimble 0.2:
Welcome...
According to the javadocs, Groovy's MockFor object always ends with a verify. Its StubFor docs say calling verify is up to the user. I read that as saying that verify will automatically be called on the MockFor object. However, in looking at the groovy samples that use MockFor on a Java object (http://svn.codehaus.org/groovy/trunk/groovy...
Say I have something like this:
new File("test").eachFile() { file->
println file.getName()
}
This prints the full filename of every file in the test directory. Is there a Groovy way to get the filename without any extension? (Or am I back in regex land?)
...
Is there someway of escaping characters in Groovy regexes? It would be nice to write a single backslash instead of 4.
...
def array = [1,2,3,4,5]
println 3 in array
prints true. What do I need to overload to support in for any object?
Example:
class Whatever {
def addItem(item) {
// add the item
}
}
def w = new Whatever()
w.addItem("one")
w.addItem("two")
println "two" in w
I know I could make the collection this class uses public, but I'...
Hi,
Using grails 1.1.1
I got this message when I did a modification on a service and then tried to refresh the page.
I have a controller name ContributionPlanController.
It has a service ContributionPlanservice.
inside the ContributionPlanService, it has ProductService and some other Services including JointPIAService.
JointPIAServi...
Where can I get the Groovy bundle for TextMate? I checked the TextMate subversion repository but it's not there. The Groovy site TextMate page references TextMate's missing Groovy bundle.
...
Spring WebFlow supports some advanced reuse features like flow inheritance and subflows. Using this features in SWF xml definitions is pretty easy, for example:
<flow parent="parent">
<subflow-state id="addGuest" subflow="createGuest">
Can I use these features with weblflows in Grails?
Can I define these using the SWF groovy dsl?
How ...