Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Web logic server file direct download

 
sujith delpachithra
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i am new to weblogic server.
i want my web clients to direct download file in a weblogic server. like sun app server docroot.
Users should be able to type "http://url.com/test.txt" to download the files. if any one knows how to do this, please help me.

thanks,
sujith.
 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use virtual directory mapping to accomplish this. (weblogic.xml tag)

http://edocs.bea.com/wls/docs103/webapp/weblogic_xml.html#wp1039396

[]s
 
sujith delpachithra
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the reply.

in order to your reply, i tried editing weblogic.xml file. but it didn't work.

suppose i have a file in "d:\test\t.pdf".
i used the below code fragment to achieve you proposed.but i was failed.

<virtual-directory-mapping>
<local-path>D:/</local-path>
<url-pattern>/test/*</url-pattern>
<url-pattern>*.pdf</url-pattern>
</virtual-directory-mapping>


please, help me with more details.

thanks again
 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is the url you're using to get the file?

Long time since I've done this.. but as far as I remember....

You'll problably need to add the pattern you've mapped with url-pattern tag to your url, like: http://localhost/test/yourFile.pdf

When pointing in weblogic.xml file try to pass complete path from files like:



Let me know if worked, ok???

[]s
 
sujith delpachithra
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which "weblogic.xml" file should i edit? in weblogic server there are a few files calles as "weblogic.xml".
waiting for kind response
thanks
 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The one used inside your application. If you don't have one you should create it inside WEB-INF/weblogic.xml same directory as web.xml

[]s
 
sujith delpachithra
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wow, great.
it works

thanks a lot.
 
kanthu kanumuri
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have another issue in this area. I am able to download the files, but the file size is zero bytes everytime i download. It is happening for any file extension. Tried .docx,.txt and .zip file.

Can some one please let me know about any additional configuration to resolve this.

-kanthu
 
sujith delpachithra
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you have to set FILE Content type in http response.

contentType = "image/jpeg";

Google for more ............
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic