Kobe,

In my understanding everything looks fine in your approach.

Summarizing the execution flow will look like this:
- client sends a request "http:/some.host.com/get/myigfs/data/content.gif";
- server receives the request and gets IGFS file system name (myigfs) and a path to a file to return (data/content.gif) from it; - server code gets a reference to IgniteFIleSystem named "myigfs" and opens IgfsInputStream to the content path; - reads data from IgfsInputStream and writes it back to response's OutputStream


--
Denis

On 1/13/2016 7:31 PM, Kobe wrote:
Denis,

I am afraid I do not understand how I can convert the two elements:


              IgniteFileSystem fs = ignite.fileSystem("myigfs");

             // Image path.
             IgfsPath workDir = new IgfsPath("/data/content.gif");
into a URL that the client can consume.

The only thought I have is that I could  open IgfsInputStream and stream it
into HttpConnection OutputStream after setting the appropriate content-type
like so:


// Open input stream to the image in IGFS ...
      IgniteFileSystem fs = ignite.fileSystem("myigfs");
             IgfsPath myImage = new IgfsPath("/data/content.gif");
   IgfsInputStream inps = fs.open(myImage);

byte[] buf = new byte[4096];
int len = -1;

// Read from IGFS input stream and stuff into servlet response output
stream
while ((len = inStream.read(buf)) != -1) {
     outStream.write(buf, 0, len);
}

outStream.flush();
outStream.close();
Is there a better way?

thanks again for your assistance.

/Kobe





--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/How-is-igfs-URL-resolved-tp2142p2545.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to