Solved

How to use Jboss as a webserver serving static files

Posted on 2014-01-27
9
6,682 Views
Last Modified: 2014-03-02
Hi,

Is it possible to use Jboss as  a webserver+appserver too. I have a requirement where the client wants Jboss as both for servlets and for static content.

our application has few jpgs and static files which need to be served.
In apache we do the follwoing to make it working, now not sure how shall I map it in Jboss so that it will work without apache too.

DocumentRoot "E:/MYAPP/Resource/Html"

Alias /images/ "E:/MYAPP/Resource/images/"
<Directory "E:/MYAPP/Resource/images">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
Alias /classes/ "E:/MYAPP/WEB-INF/lib/"
<Directory "E:/MYAPP/WEB-INF/lib">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>


Can all above apache configuration be done in Jboss itself. Please do let me know the steps to do it in Jboss.
0
Comment
Question by:Ramakanta Sahoo
  • 4
  • 2
9 Comments
 
LVL 35

Expert Comment

by:Gary Patterson
ID: 39813823
jboss contains a web server, so there is no reason you can't use it to serve static content.

Maybe this will help?

https://support.eapps.com/index.php?/Knowledgebase/Article/View/209/65/user-guide---jboss-deployment-in-standalone-mode-without-apache

- Gary Patterson
0
 
LVL 4

Author Comment

by:Ramakanta Sahoo
ID: 39814186
Thanks for the link. it might be silly to ask, but I could not figure out how to map static files in jboss like images..
can you please explain the exact configuration i need to add into jboss to enable the conf's i have specified above for apache.

Thanks
0
 
LVL 4

Author Comment

by:Ramakanta Sahoo
ID: 39814286
I got something like <JBOSS_HOME>/server/<config-name>/deploy/jboss-web.deployer/server.xml

<Host name="localhost" ...>
<!-- ADD static images DIRECTORY -->
<Context path="/images" docBase="/home/pgib/images" reloadable="true">
</Context>
<!-- The rest of your Host entity -->
</Host>

but not sure how to enable content compression and caching.. here.
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 35

Expert Comment

by:Gary Patterson
ID: 39830467
If setting up Apache in front isn't an option, you could use a cache filter:

http://community.jaspersoft.com/wiki/setting-cache-filter-tomcat-or-jboss-static-files


For compression:

https://community.jboss.org/message/640764
0
 
LVL 27

Expert Comment

by:mrcoffee365
ID: 39830686
I'm pretty sure you don't have to do anything.  Caching images in jboss is an interesting thing to do but not required.  It's also not required to do that for anything else.
0
 
LVL 4

Accepted Solution

by:
Ramakanta Sahoo earned 0 total points
ID: 39847086
Currently below is the status:

We were able to load images via creating context roots in context.xml file like below:
<Context cookies="true" crossContext="true" path="/images" appBase="" docBase="D:/jboss-eap-5.1/jboss-as/server/default/deploy/ROOT.war/images" debug="99" reloadable="true" allowLinking="true">

<InstanceListener>org.jboss.web.tomcat.security.RunAsListener</InstanceListener>

</Context>

so the images load when we access http://hostname:8080/si_image/logo.jpg 

But we have multiple alias where we need to load js and html files too so not sure how to add multiple context paths in context.xl file. We tried and it failed. Can any one let us know how to do it.

One more thing is how to create a document root in Jboss so that the HTML files will be able to load. Please do let me know the steps?
0
 
LVL 4

Author Closing Comment

by:Ramakanta Sahoo
ID: 39898335
It was a half done solution which I have mentioned and still working on it.
0

Featured Post

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
What You Need to Know when Searching for a Webhost Provider
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

749 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