Created
November 14, 2011 21:26
-
-
Save folkengine/1365236 to your computer and use it in GitHub Desktop.
Grails Reading in XML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.limited.ss.item | |
import org.springframework.context.ApplicationContext | |
import org.springframework.context.ApplicationContextAware | |
import grails.converters.* | |
class TestService implements ApplicationContextAware { | |
static transactional = false | |
def applicationContext | |
def loadSampleData() { | |
def myfile = applicationContext.getResource("/WEB-INF/xml/sampleevents.xml").getFile().text | |
def xml = XML.parse(myfile) | |
def events = xml.event | |
log.info("SIZE: ${events.size()}") | |
return xml | |
} | |
void setApplicationContext(ApplicationContext applicationContext) { | |
this.applicationContext = applicationContext | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works when deployed to Tomcat, or Jetty, but not in a WebLogic war file. Back to the drawing board.