org.codehaus.groovy.grails.support
Class GrailsByteArrayResource

java.lang.Object
  extended by org.springframework.core.io.AbstractResource
      extended by org.springframework.core.io.ByteArrayResource
          extended by org.codehaus.groovy.grails.support.GrailsByteArrayResource
All Implemented Interfaces:
InputStreamSource, Resource

public class GrailsByteArrayResource
extends ByteArrayResource

Hacky version of the ByteArrayResource that implements the getURL() method, required for the resource to work with Spring's ServletContextResource.

Author:
pledbrook

Constructor Summary
GrailsByteArrayResource(byte[] byteArray)
           
GrailsByteArrayResource(byte[] byteArray, String location)
           
 
Method Summary
 String getFilename()
           
 URL getURL()
          Overrides the default behaviour to generate a fake "file:" URL so that the resource can be used from a ServletContextResource.
 
Methods inherited from class org.springframework.core.io.ByteArrayResource
equals, exists, getByteArray, getDescription, getInputStream, hashCode
 
Methods inherited from class org.springframework.core.io.AbstractResource
createRelative, getFile, getFileForLastModifiedCheck, getURI, isOpen, isReadable, lastModified, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GrailsByteArrayResource

public GrailsByteArrayResource(byte[] byteArray)

GrailsByteArrayResource

public GrailsByteArrayResource(byte[] byteArray,
                               String location)
Method Detail

getURL

public URL getURL()
           throws IOException
Overrides the default behaviour to generate a fake "file:" URL so that the resource can be used from a ServletContextResource.

Specified by:
getURL in interface Resource
Overrides:
getURL in class AbstractResource
Throws:
IOException

getFilename

public String getFilename()
                   throws IllegalStateException
Specified by:
getFilename in interface Resource
Overrides:
getFilename in class AbstractResource
Throws:
IllegalStateException


Copyright (c) 2005-2009 The Grails project