I have a grails project that contains a few domain objects. I am using a java project in this code which can parse a document for me. The controller that calls that Java project is using JAXB to generate XML from the object returned by the Java project.
I want to use this XML document (which is generated after some text parsing, using J...
Expecting grails domain object to be written to XML response:
Image.groovy:
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
class Image{
@XmlElement
String url
@XmlElement
String contentType
}
WebServiceRequestHandler.groovy:
@GET
@Path("/myrestfullmethod/parameter1/{parameter1name}
@Produces("text/xml")
Images...
Hello community!
I'm writing a grails app and running into a strange problem. When clicking the submit button on a page, the associated action gets called twice in rapid succession. This causes everything to break horribly. Has anyone else seen this issue before? Below is my code:
From the GSP page:
<g:form method="post" action="show"...
I can write:
def c = Transaction.createCriteria()
def transactions = c.list {
projections {
groupProperty("product")
countDistinct("id")
}
maxResults(pageBlock)
firstResult(pageIndex)
}
But can't write this:
def transactions = Transaction.createCriteria() .list {
projections {
groupPropert...
I'm accessing some website and I need to extract some data. To be more specific - from this part:
<input type="hidden" value="1" name="d520783895194bd08750e47c744d553d">
I need to extract the "name" part. I heard that reular expressions are not the best solution, so I'd like to ask what is the best way to access this piece of data I n...
I want to parse with XmlSlurper a HTML document which I read using HTTPBuilder. Initialy I tried to do it this way:
def response = http.get(path: "index.php", contentType: TEXT)
def slurper = new XmlSlurper()
def xml = slurper.parse(response)
But it produces an exception:
java.io.IOException: Server returned HTTP response code: 503 ...
I've parsed some html using XmlSlurper. Now I want to iterate all the children with a given element name.
What I've got now is the following code snippet
html.'**'.findAll { it.name() == 'a' }.each {
println it
}
It works but just isn't groovy enough. I would like to simply write something like this
html.'**'...
Mormally setting up one-to-many associations is easy. Take for example:
class Author {
String firstName
String lastName
static hasMany = [books: Book]
static constraints = {
books(nullable: true)
}
}
class Book {
String title
Author author
Publisher publisher
static constrai...
Is it possible to unit test addTo* functions in Grails ?
thanks for your help.
...
http://download.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlSeeAlso.html
According to this, I should be able to make my root element have more than one class reference. However, when I try that, I get this exception:
[groovyc] Compiling 72 source files to C:\Users\dcole\.grails\1.3.4\projects\trunk\classes
[groovyc] org.c...
SO I am testing a Rest OAuth implementation.
My testing tool will send the HTTP Request, but I need to prepare the Authorization header.
What I need: I want a valid Authorization Header
What I have: All the headers except the oauth_signature
I also have the 2 secrets, the token_secret and the consumer_secret. I also posses the access_...
I'm new to grails and receive the following error:
No signature of method: Something.findAll() is applicable for argument types: (java.lang.String, java.util.ArrayList) values: [from Something AS s WHERE s.some_number LIKE ?, [%asdf%]]"
The error occurs when I run test-app. It occurs in the following place:
SomethingVO[] findBySomeN...
Suppose I have a block of Gant code:
target(echo:"test"){
ant.echo(message:"hi")
}
setDefaultTarget("echo")
This is usually run from a command line.
How could I place the block in a Grails controller and run it from there?
...
Hello -
I am getting started researching / creating a groovy portlet that will connect to a REST based ESB service that returns JSON; I will also need to pass the username in the headers. I was wondering if there are any examples out there on how to create the portlet and set the headers? I am new to groovy and from what I understand th...
Hey all,
I am trying to call a service method defined in my project programmatically from a test step script. I am at a blocker and can't seem to figure how to set the request fields and make the call. The method will getMore() results of the call being tested. So I want to call this method while there are more results to fetch and store...
have a project set up like the following:
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
@XmlRootEle...
I've asked the exact same question on nabble here
I'm trying to send params or different domains in the controller integration test.
But can't get them to bind to the domain class with the prefix of "book"
//Controller action being tested
def saveBook = {
def book = new Book()
bindData(book, params["book"], [include: ['publicPrivacy'...
Let's say I have a combobox with the options GENERAL, AIR, GROUND, and SEA
<g:select name="group" from="${['GENERAL', 'AIR', 'GROUND', 'SEA']}" valueMessagePrefix="default.category" value="${tipoN}" />
And then another combobox that loads certain information depending whether you select GENERAL, AIR, GROUND, or SEA.
Let's say GROUND ...
I have a list with information and I want to export it to Excel.
How do I do it?
Is the "Export Plugin" any good? I think I saw one a while ago to export files to Excel but I can't find it anymore.
...
How do I convert LinkedHashMap to java.util.HashMap in groovy?
When I create something like this in groovy, it automatically creates a LinkedHashMap even when I declare it like HashMap h = .... or def HashMap h = ...
I tried doing:
HashMap h = ["key1":["val1", "val2"], "key2":["val3"]]
and
def HashMap h = ["key1":["val1", "val2"],...