This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Accessing Remote Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Accessing Remote Files" Watch "Accessing Remote Files" New topic
Author

Accessing Remote Files

Rohit Koundinya
Greenhorn

Joined: Jul 25, 2006
Posts: 3
Hi,

i am facing a problem in accessing Remote files.
My application has developed in java as well as in .net.
from .net side the users selects some images and stores in the particular location say Images folder.
now i want to access that image folder from our java. in jave i am using jsp and servlets.
i am using Tomcat as our web server and .net application is working on IIS server.
Both are in different locations.
i want to show the images selected by users in my web application dynamically when the user access my web application.
i am not able to find the format of the image. the image is either jpg or gif or png or bmp.
i am getting just image name from the MSSQL excluding the image format.
Please help me in this. How to solve this problem?

Thanks in advance,

==Rohitk==
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
i am getting just image name from the MSSQL excluding the image format.

are you sure that there isn't another column in your MSSQL table to store the image extension?


MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Insert image name with its extension. Otherwise you will end up writing code to figuring out the image extension/format.

Or I wonder if you can use wild card to search the image and after getting one get its extension. Obviously, assuming no duplicates. I have never done this. Not sure just an idea.
Rohit Koundinya
Greenhorn

Joined: Jul 25, 2006
Posts: 3
Hi,

we dont have any table fields with the image extensions.

Thanks,
==Rohitk==
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

How is the .NET side determining the image type?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Rohit Koundinya
Greenhorn

Joined: Jul 25, 2006
Posts: 3
Hi,

Thanks for answering my problems.
For the .net side people the folder is local to them.
They retrieving the image name from the DB and checking with the files which are in the folder.
They are taking that files in an array and iterating with the image name by giving the file extensions.
if anything is matching they are simply placing the image.
where as for us it is different machine.
i think my webserver should talk to IIS server.

Thanks,
==Rohitk==
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If there is no way for you to keep the extensions, then you will probably need to examine the binary files to determine their type.

A Google search with keywords "Magic Numbers" should get you going in the right direction.
 
Consider Paul's rocket mass heater.
 
subject: Accessing Remote Files
 
Similar Threads
Subdomain question
Images keep re-downloading when re-visiting page
Blocking access to images
blocking access to images
Problem in accessing the local files & folders in web application