Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

JSP -> FTP Program improvement

Folks,

I have a web application that accesses secure binary data files on a ftp server.  (Requires a user name and password)

[CLIENT}  -- request for data file -- >  [WEBSPHERE SERVER]  -- query data file -->  [FTP Server On HOST SYSTEM]
[FTP Server On HOST SYSTEM]  -- returns data file --> [WEBSPHERE SERVER] -- returns data file  --> [CLIENT]

I would like to reduce it too
[CLIENT}  -- request for data file -- >  [WEBSPHERE SERVER]  -- query data file -->  [FTP Server On HOST SYSTEM]
[FTP Server On HOST SYSTEM]  -- returns data file  --> [CLIENT]

How can I stream the data past the web server as opposed to through it.  Is it possible??
0
bohnman
Asked:
bohnman
  • 2
  • 2
  • 2
2 Solutions
 
searlasCommented:
Not exactly, but you can send a redirect:

<% response.sendRedirect("ftp://ftp.mozilla.org"); %>

direct to a file:
<% response.sendRedirect("ftp://ftp.mozilla.org/some/file"); %>

That ends up looking like:
[CLIENT]  -- request for data file -- >  [WEBSPHERE SERVER]  -- query data file -->  send redirect -> [CLIENT]
[CLIENT] -- request data file -- > [FTP Server On HOST SYSTEM]  --  [CLIENT]
0
 
searlasCommented:
Just noticed the username/password requirement.  You can redirect and include username and password, which would be idiocy.

So, no.  You cannot do this. (AFAIK)
0
 
KuldeepchaturvediCommented:
can't really bypass the web server...
case is.. client requested the web server so its web servers responsibility to respond to the request...
and web server requested the host... so host will be talking to web server only...!!
and I do not think its a bad idea at all!!!
in fact its a good implementation to keep the host hidden from the client....

you might redirect the stream thats coming from host to the outputstream of the request that web server have recieved from the client.....

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
bohnmanAuthor Commented:
Could you explain this a little more... I am not sure I understand what you mean

>>   you might redirect the stream thats coming from host to the outputstream of the request that web server have recieved from the client.....

0
 
KuldeepchaturvediCommented:
well that depends how you are doing the ftp from your web server...
you might be making an external process to do the ftp in a directory and then reading the file in servlet to send it over to the client...
instead you can make a url ftp connection to the host..
like
ServletOutputStream out=response.getOutputStream();
sun.net.ftp.FtpClient fc = new FtpClient(yourhost);
fc.login(user,pwd);
fc.binary();
sun.net.TelnetInputStream in = fc.get(filename);
int k=in.read();
while(k!=-1)
{
out.write(k);
k=in.read();
}
out.flush();

//done...
Ofcourse you would need to download sun.net package for this one...
0
 
bohnmanAuthor Commented:
Ok,  yeah, that is pretty much what I am doing today.  I will split the points.  Thanks for the help.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now