grails.converters
Class XML

java.lang.Object
  extended by org.codehaus.groovy.grails.web.converters.AbstractConverter
      extended by grails.converters.XML
All Implemented Interfaces:
Converter
Direct Known Subclasses:
XML

public class XML
extends AbstractConverter
implements Converter

A converter that converts domain classes to XML

Author:
Siegfried Puchbauer

Field Summary
static org.apache.commons.logging.Log log
           
 
Fields inherited from interface org.codehaus.groovy.grails.web.converters.Converter
DEFAULT_REQUEST_ENCODING
 
Constructor Summary
XML()
          Default Constructor
XML(Object target)
          Initializes the Converter with the target
 
Method Summary
 void configureXStream(com.thoughtworks.xstream.XStream xs)
          Configures the XStream instance
static Object parse(HttpServletRequest request)
          Parses the give XML (read from the POST Body of the Request)
static Object parse(InputStream is, String encoding)
          Parses the given XML
static Object parse(String source)
          Parses the given XML
 void render(HttpServletResponse response)
          Renders the XML to the HttpServletResponse, also setting the the Content-Type (text/xml)
 void render(Writer out)
          Renders the XML to the given Writer
 void setTarget(Object target)
           
 
Methods inherited from class org.codehaus.groovy.grails.web.converters.AbstractConverter
createBeanWrapper, isJdk5Enum, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

public static final org.apache.commons.logging.Log log
Constructor Detail

XML

public XML()
Default Constructor


XML

public XML(Object target)
Initializes the Converter with the target

Parameters:
target - the target object to convert
Method Detail

configureXStream

public void configureXStream(com.thoughtworks.xstream.XStream xs)
Configures the XStream instance

Parameters:
xs - an XStream instance

render

public void render(Writer out)
            throws ConverterException
Renders the XML to the given Writer

Specified by:
render in interface Converter
Parameters:
out - the Writer
Throws:
ConverterException

render

public void render(HttpServletResponse response)
            throws ConverterException
Renders the XML to the HttpServletResponse, also setting the the Content-Type (text/xml)

Specified by:
render in interface Converter
Parameters:
response - the HttpServletResponse
Throws:
ConverterException

parse

public static Object parse(String source)
                    throws ConverterException
Parses the given XML

Parameters:
source - a String containing some XML
Returns:
a groovy.util.XmlSlurper
Throws:
ConverterException

parse

public static Object parse(InputStream is,
                           String encoding)
                    throws ConverterException
Parses the given XML

Parameters:
is - an InputStream to read from
encoding - the Character Encoding to use
Returns:
a groovy.util.XmlSlurper
Throws:
ConverterException

parse

public static Object parse(HttpServletRequest request)
                    throws ConverterException
Parses the give XML (read from the POST Body of the Request)

Parameters:
request - an HttpServletRequest
Returns:
a groovy.util.XmlSlurper
Throws:
ConverterException

setTarget

public void setTarget(Object target)
Specified by:
setTarget in class AbstractConverter
Parameters:
target - the target to convert
See Also:
Converter


Copyright (c) 2005-2006 The Grails project