Hi,

to get artefacts from our Artifactory (2.6.4 rev. 13153) I'm using groovy and 
the rest api. To do this I create a RESTClient

def server = new RESTClient()
server.headers['Authorization'] = 'Basic '+ (myUser + ':' + 
myPwd).getBytes('iso-8859-1').encodeBase64()
server.parser.'application/vnd.org.jfrog.artifactory.search.GavcSearchResult+json'
 = server.parser.'application/json'

I use this server to do a query (def resp = server.get(uri: config.server + 
"/$query"))

Later I use it to get my artefact using

def res
res =server.get(uri: "$uri")
new File(myFilename) << res.data

where uri ist something like 
http://myArtifactory/artifactory/features-versions/path/artifact.zip

This works nearly every time (>99 %). But in some rare cases the 
server.get(uri: "$uri") results in
java.io.EOFException
     java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:246)
     java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:236)
     java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:140)
     java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:56)
     java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:65)
     
groovyx.net.http.GZIPEncoding$GZIPDecompressingEntity.getContent(GZIPEncoding.java:73)
     org.apache.http.util.EntityUtils.consume(EntityUtils.java:83)
     
org.apache.http.conn.BasicManagedEntity.ensureConsumed(BasicManagedEntity.java:99)
     
org.apache.http.conn.BasicManagedEntity.consumeContent(BasicManagedEntity.java:112)
     groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:515)
     groovyx.net.http.RESTClient.get(RESTClient.java:118)
     groovyx.net.http.RESTClient$get.call(Unknown Source)

Using the internet browser I can download the artefact using the uri used for 
the get statement without any problem.

Thanks for your help!

Frank

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Artifactory-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/artifactory-users

Reply via email to