Solved

JSP -> FTP Program improvement

Posted on 2004-04-02
6
284 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:bohnman
Comment Utility
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
Comment Utility
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
Comment Utility
Ok,  yeah, that is pretty much what I am doing today.  I will split the points.  Thanks for the help.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In this article, I will show you HOW TO: Create your first Windows Virtual Machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, the Windows OS we will install is Windows Server 2016.
A safe way to clean winsxs folder from your windows server 2008 R2 editions
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now