Solved

JSP -> FTP Program improvement

Posted on 2004-04-02
6
286 Views
Last Modified: 2010-04-01
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
Comment
Question by:bohnman
  • 2
  • 2
  • 2
6 Comments
 
LVL 7

Expert Comment

by:searlas
ID: 10742228
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
 
LVL 7

Assisted Solution

by:searlas
searlas earned 250 total points
ID: 10742242
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
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 250 total points
ID: 10742291
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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:bohnman
ID: 10742465
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
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10742843
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
 

Author Comment

by:bohnman
ID: 10743656
Ok,  yeah, that is pretty much what I am doing today.  I will split the points.  Thanks for the help.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the biggest threats facing all high-value targets are APT's.  These threats include sophisticated tactics that "often starts with mapping human organization and collecting intelligence on employees, who are nowadays a weaker link than network…
Binary Differential Replication, What it is, how it works and how it differs from standard delta file replication
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question