Chiming in where nobody calls me, but what if the response returned a URL
where to get the raw data from instead of the Base64 encoded data? Too 90's
I know (ArcIMS memories anyone?), but I'd seriously consider that given the
options. A expiration time for the response, whether it'll be saved to disk
and deleted after some time, or computed on the fly out of the URL hints,
etc would be up to each process to decide?
On Fri, Jun 6, 2014 at 11:45 AM, Andrea Aime <[email protected]>
wrote:
> On Fri, Jun 6, 2014 at 4:24 PM, Justin Deoliveira <
> [email protected]> wrote:
>
>> So had a look around and found this example of direct encoding, in
>>> SimpleContentComplexEMFBinding:
>>>
>>> /**
>>> * Calls getValue() and appends the result as child text of
>>> <tt>value</tt>.
>>> */
>>> public Element encode(Object object, Document document, Element
>>> value) throws Exception {
>>> EObject eobject = (EObject) object;
>>> if ( EMFUtils.has( eobject, "value") ) {
>>> Object v = EMFUtils.get( ((EObject)object), "value" );
>>> if ( v != null ) {
>>> valueappendChild( document.createTextNode( v.toString()
>>> ) );
>>> }
>>> }
>>> return value;
>>> }
>>>
>>> I guess the binding has to either implement encode, or to return the
>>> properties, right?
>>>
>>
>> If I remember correctly it can do both if necessary. Properties are
>> always mapped to child elements.
>>
>>
>
> Ah right, indeed I noticed that in SimpleContentComplexEMFBinding after
> sending the mail
>
>
>> One thing that bothers me about the above example is that it's memory
>>> bound, if I have
>>> a large binary to put in the output module, I'd rather go with a
>>> ContentHandler instead,
>>> which is what the binary delegates expect anyways, for example:
>>>
>>> public class RawDataEncoderDelegate implements EncoderDelegate {
>>>
>>>
>>> private RawData rawData;
>>>
>>> public RawDataEncoderDelegate(RawData rawData) {
>>> this.rawData = rawData;
>>> }
>>>
>>> * public void encode(ContentHandler output) throws Exception {*
>>> InputStream is = null;
>>> try {
>>> is = rawData.getInputStream();
>>> byte[] buffer = new byte[4096];
>>> int read = 0;
>>> while ((read = is.read(buffer)) > 0) {
>>> char[] chars;
>>> if (read == 4096) {
>>> chars = new
>>> String(Base64.encodeBase64(buffer)).toCharArray();
>>> } else {
>>> byte[] reducedBuffer = new byte[read];
>>> System.arraycopy(buffer, 0, reducedBuffer, 0, read);
>>> chars = new
>>> String(Base64.encodeBase64(reducedBuffer)).toCharArray();
>>> }
>>>
>>> output.characters(chars, 0, chars.length);
>>> }
>>> } finally {
>>> IOUtils.closeQuietly(is);
>>> }
>>> }
>>>
>>> public void encode(OutputStream os) throws IOException {
>>> IOUtils.copy(rawData.getInputStream(), os);
>>> }
>>>
>>> Is this possible?
>>>
>>
>> Sorry... not sure what you are asking here.
>>
>
> So basically, when running something like:
> valueappendChild( document.createTextNode( v.toString() )
> );
> I am creating a text node by loading all of its contents in memory.
> Unfortunately,
> a WPS result can be GB large, so I would like to avoid that.
>
> Instead, the code above using the ContentHandler generates the output XML
> in a
> streaming fashion.
> My question is, would it possible to do a streaming encode from the
> encode() method
> of a binding? What I see is that when we return a encoder delegate as a
> property,
> the delegate can indeed write the large content in a streaming fashion
>
> I guess that the solution might be to return the binary encoder delegates
> in the ComplexData parent, and then have the delegate write both the
> ComplexData
> tag, and its content?
>
> Cheers
> Andrea
>
> --
> ==
> GeoServer Professional Services from the experts! Visit
> http://goo.gl/NWWaa2 for more information.
> ==
>
> Ing. Andrea Aime
> @geowolf
> Technical Lead
>
> GeoSolutions S.A.S.
> Via Poggio alle Viti 1187
> 55054 Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax: +39 0584 1660272
> mob: +39 339 8844549
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> _______________________________________________
> Geoserver-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>
>
--
Gabriel Roldán
Software Developer | Boundless
[email protected]
@gabrielroldan <https://twitter.com/gabrielroldan>
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel