cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Download a zip file from Windchill server

dgraham-4
Newbie

Download a zip file from Windchill server

Does anyone know the specifics how to download a zip file from the
Windchill server?

Here's the use case.
User enters numbers into text field in JSP and hit submit. See Image 1
Code in JSP searches for documents and returns a java.util.List of
WTDocuments
The List is passed to a method that streams each WTDocuments primary
content to a zip file. See Image 3
The results of the search are displayed in the JSP with links to each
WTDoc's Primary Content. See Image 2

Steps 1 - 4 I have working well.

The final step I need is to download the zip file to the client.

The resulting zip file located in
%WT_HOME%\temp\PrimaryContentDownloads\PrimaryContent-%USERNAME%.zip

Upon submit I'd like a download window to open such as the one below.
or
Add a link in the results page to the zip file. see image 2 Any thoughts
on this?


Image 1

Results

Image 2

Image 3



David Graham
Windchill Administrator
Pro|ENGINEER Administrator
CAx Administrator


Emhart Glass Manufacturing Inc.
Emhart Glass Research Center
123 Great Pond Drive | Windsor, CT 06095 | USA
Telephone +1 (203) 376-3144 | Telefax +1 (860) 298 7397
Mobile +1 (203) 376-3144 |
3 REPLIES 3

RE: Download a zip file from Windchill server

Hi David,


the easiest way to do that is to save the ZIP file in a folder under codebase, or even under a folder that is controlled by the web server authorization check. The you can create a link to that file knowing that http://<server>/Windchill/ maps to codebase folder.


For example, you can create your zip file in <wt_home>/codebase/downloads/XXXXXX.zip, and your link to get that file should be http://<server>/Windchill/downloads/XXXXXX.zip. Anyway, it is not the "best" way.


Another option should be to create servlet that will stream the contents of the zip file, and you can put there your code to check if the user is authorized or any other thing that you need.


Regards


Iker Mendiola

Prambanan IT Services
http://www.prambanan-it.com



http://www.prambanan-it.comIker Mendiola - Prambanan IT Services

Download a zip file from Windchill server

If you're at all security conscious you don't want to just produce zip
files into codebase -- as someone else could potentially guess or
predict XXXXXX.

Instead you'd really want to either:

1. Simply produce and stream the zip file from the server.
* This is ideal as there's no extra file to worry about cleaning
up, etc.
2. If #1 is not possible, then produce a file in some other non-HTTP(S)
accessible location, place a mapping from a user-friendly logical
name to the file's physical name and location in the user's session
and then on a subsequent request translate from the user's request
for the logical name to streaming of the physical file.
* This approach means no one other than that user has the mapping
in their session and thus no one else can get at the file.
* Do note that you have to clean up the file at some point unless
you just want to fill up your disk.

--
Jess Holle

Download a zip file from Windchill server

Thanks Jess.
That was my reason for saying that the first one was not the "best" way.
Obviously it depends on the kind of information you need to dowload...


http://www.prambanan-it.comIker Mendiola - Prambanan IT Services
Announcements