akamai / netstoragekit-java Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
NetStorage.setmd
doesn't appear in the FileStorage version of the API. What should be the results of using this?
CMS example is using constructor setting useSSL to false.
Default value should be always true, to prevent stealing of user name and password during insecure communication.
Now: public NetStorage(String hostname, String username, String key) {
this(hostname, username, key, false);
}
Should be:
public NetStorage(String hostname, String username, String key) {
this(hostname, username, key, true);
}
How to read the content or file from the Netstorage path through web access ??
Can you please add support for proxy per connection.
I know we can set proxy at jvm level through
but for this we have to synchronise all the threads. set and unset proxy for every connection(when connecting to other services)
this will lead to bottleneck of traffic.
so support for proxy per connection level would be much appreciated.
Looks like list
is not support and there is a TODO comment related to it in the current code.
It's currently not possible to set the desired encoding for the stat
action when using NetStorage.java
. Suggesting adding a new stat
method to NetStorage.java
with an additional parameter Map<String, String> additionalParams
(same as for the dir
action).
We have multiple threads to upload files simultaneously to netstorage from two different hosts.
Most of the time it performs well, but sometimes it will throw Communication Error.
Is there any enhancement related to it in the TODO list?
Caused by: com.akamai.netstorage.NetStorageException: Communication Error
at com.akamai.netstorage.NetStorageCMSv35Signer.execute(NetStorageCMSv35Signer.java:359) ~[NetStorageKit-3.6.6.jar:?]
at com.akamai.netstorage.NetStorageCMSv35Signer.execute(NetStorageCMSv35Signer.java:364) ~[NetStorageKit-3.6.6.jar:?]
at com.akamai.netstorage.NetStorage.execute(NetStorage.java:68) ~[NetStorageKit-3.6.6.jar:?]
... 141 more
Caused by: java.net.SocketException: Socket closed
at java.net.SocketInputStream.socketRead0(Native Method) ~[?:1.8.0_232]
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[?:1.8.0_232]
at java.net.SocketInputStream.read(SocketInputStream.java:171) ~[?:1.8.0_232]
at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[?:1.8.0_232]
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465) ~[?:1.8.0_232]
at sun.security.ssl.InputRecord.read(InputRecord.java:503) ~[?:1.8.0_232]
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:975) ~[?:1.8.0_232]
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:933) ~[?:1.8.0_232]
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105) ~[?:1.8.0_232]
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[?:1.8.0_232]
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) ~[?:1.8.0_232]
at java.io.BufferedInputStream.read(BufferedInputStream.java:345) ~[?:1.8.0_232]
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:735) ~[?:1.8.0_232]
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678) ~[?:1.8.0_232]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1593) ~[?:1.8.0_232]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498) ~[?:1.8.0_232]
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) ~[?:1.8.0_232]
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:352) ~[?:1.8.0_232]
at com.akamai.netstorage.NetStorageCMSv35Signer.validate(NetStorageCMSv35Signer.java:270) ~[NetStorageKit-3.6.6.jar:?]
at com.akamai.netstorage.NetStorageCMSv35Signer.execute(NetStorageCMSv35Signer.java:348) ~[NetStorageKit-3.6.6.jar:?]
at com.akamai.netstorage.NetStorageCMSv35Signer.execute(NetStorageCMSv35Signer.java:364) ~[NetStorageKit-3.6.6.jar:?]
at com.akamai.netstorage.NetStorage.execute(NetStorage.java:68) ~[NetStorageKit-3.6.6.jar:?]
Currently, in order to use this API, you have to communicate with a concrete class, NetStorage. For testing purposes, it'd be easier to use an interface so that we can mock it.
Typically, Maven projects do not have a non-SNAPSHOT version in their pom.xml file. When you cut a release, you remove the "-SNAPSHOT" and create a tag for that release. Using the maven-release-plugin makes this very simple:
https://maven.apache.org/maven-release/maven-release-plugin/
Also, uploading this jar file to Maven Central would make using this API so much easier (there's another issue open for this already). Right now, we have to build and deploy this to our own Nexus server.
Seeing the following error when the filename contains a space:
Exception in thread "main" com.akamai.netstorage.NetStorageException: com.akamai.netstorage.NetStorageException: Communication Error
at com.akamai.netstorage.NetStorage.execute(NetStorage.java:71)
at com.akamai.netstorage.NetStorage.upload(NetStorage.java:258)
at com.akamai.netstorage.NetStorage.upload(NetStorage.java:287)
at com.akamai.netstorage.NetStorage.upload(NetStorage.java:265)
at ns.uploadToAkamai(ns.java:33)
at ns.doIt(ns.java:38)
at ns.main(ns.java:19)
Caused by: com.akamai.netstorage.NetStorageException: Communication Error
at com.akamai.netstorage.NetStorageCMSv35Signer.execute(NetStorageCMSv35Signer.java:359)
at com.akamai.netstorage.NetStorageCMSv35Signer.execute(NetStorageCMSv35Signer.java:364)
at com.akamai.netstorage.NetStorage.execute(NetStorage.java:68)
... 6 more
Caused by: com.akamai.netstorage.NetStorageException: Unexpected Response from Server: 400 Bad Request
{null=[HTTP/1.1 400 Bad Request], Cache-Control=[max-age=0, no-cache, no-store], Server=[Apache], Connection=[close], Pragma=[no-cache], Expires=[Thu, 16 Aug 2018 21:51:34 GMT], Date=[Thu, 16 Aug 2018 21:51:34 GMT], Content-Type=[text/html; charset=iso-8859-1]}
at com.akamai.netstorage.NetStorageCMSv35Signer.validate(NetStorageCMSv35Signer.java:281)
at com.akamai.netstorage.NetStorageCMSv35Signer.execute(NetStorageCMSv35Signer.java:348)
... 8 more
%
In the NetStorage class, you have:
public String hostName;
public String username;
public String key;
public Boolean useSSL;
This, along with the fact that there is no interface, provides a nightmare for when you want to share this thing in your application with other folks. These fields can be modified by anyone.
in com.akamai.netstorage.DefaultCredential
require getName and and getKey have @OverRide
in com.akamai.netstorage.NetStorageCMSv35Signer
require couple methods have @OverRide
in com.akamai.netstorage.Utils
readIniSection method, need to put Scanner into try also, otherwise you have memory leak for the unclosed resource
Also there is no lib folder for this project, need to find hamcrest-core-1.3.jar by myself
Hi @colinbendell ,
I was try the NetStorageKit-Java library to upload an image. Since this library assists in the interaction with Akamai's NetStorage CMS API and all the API actions require CPCode.
How do we pass CP code to an action while using this library?
In the readme file we have a command
java -classpath build/classes CMS -a dir -u user1 -k 1234abcd example.akamaihd.net/1234
Is 1234(for example) after Netstorage HTTP API domain the CP Code ?
Thanks,
Radha Krishna N
Hi Team - As the API gives /dir to list down all contents within the same directory. Can you create another method which will list down all contents within a directory along with its sub-directory contents recursively. I Please let me know your thoughts.
Could you please publish NetStorage to the global maven repository? It would be nice to have it there, but not work with it locally.
Please add support for a configurable proxy. I've changed my local code to use a hard-coded proxy, but it would be good to have an option to pass it in via a constructor.
As per https://developer.akamai.com/learn/NetStorage/NetStorage.html
“Third, you can properly partition your upload job, and open multiple parallel upload connections, to increase your aggregated throughput. Once your content is uploaded, it’s replicated quickly to another geographic location, and readily available from another part of the world.”
Can somebody suggest if there is any API available on this regard?
Hello,
I am using the SDK for uploading to netstorage through an API Manager with an URL such as this one:
devUrl.apim.company.com/netstorage
( The APIM is configured to redirect to an akamai URL(myhostname.akamaihd.net
). )
This URL is used as the hostname when constructing the Credential object, however it seems like the path(/netstorage
) is kept when calling Netstorage, since I am getting UnknownHostExceptions.
Directly calling the HTTP API without the SDK with the above URL works without any issues.
Thanks in advance
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.