• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Static files deployment with changing jboss config files

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

My issue is on deploying static files in JBoss 4.

I have a folder (external to JBoss) which will have all static files (html, swf, etc). I have deployed a servlet in deploy folder which need invoke a html file in that folder (I cannot read that file as stream, as that folder contains 100s of files which are accessible internally).

I have modified jboss-service.xml making that external folder as a war folder but our Architect suggests not to modify any jboss config files.

Please help me how to configure the external static files without changing any jboss config files. Is there any docBase I can set in any file within my application context.

Thanks in advance.

Regards
Bala
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to our JBoss forum.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

bala kam wrote:Please help me how to configure the external static files without changing any jboss config files.


How do you expect JBoss AS to find an external directory if you cannot modify any of the configuration files to look there? Why do you think that the configuration files are text files, and not binary? They were set up that way so that you can modify them.
 
bala kam
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Peter Johnson wrote:

bala kam wrote:Please help me how to configure the external static files without changing any jboss config files.


How do you expect JBoss AS to find an external directory if you cannot modify any of the configuration files to look there? Why do you think that the configuration files are text files, and not binary? They were set up that way so that you can modify them.



Atleast if I deploy a servlet in deploy and is it possible set the parameter in web.xml or jboss-web.xml and refer to that static location. Is this possible.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, neither web.xml nor jboss-web.xml contain such a setting. By the way, docs/dtd/jboss-web_5_0.dtd contains descriptions of all the settings in jboss-web.xml.

You could write a servlet that provides access to an external directory and send all requests for static data to that servlet.
 
bala kam
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Peter Johnson wrote:No, neither web.xml nor jboss-web.xml contain such a setting. By the way, docs/dtd/jboss-web_5_0.dtd contains descriptions of all the settings in jboss-web.xml.

You could write a servlet that provides access to an external directory and send all requests for static data to that servlet.



Thank you for your reply. Can you please help me with code of accessing external directory static files via Servlet. Would appreciate your help.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here are some hints/suggestions:

1) Route all requests for static/* to your servlet

2) Place the relative file name in the URL and have the servlet extract it. Example: http://localhost:8080/myapp/static/docs/instr.pdf yields the relative directory docs/instr.pdf

3) Use a context-param to set the external directory base location

4) The servlet will have to understand the various file types that it will serve and set the content type properly. For example, for the file in item 2 above you would use:

response.setContentType("application/pdf");

5) Have the servlet open the file and send it to the response buffer. You might have to mess with the max buffer size (I have only done this for smaller files).
 
bala kam
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure will do. Thank you so much for your help and response.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic