Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to use Jboss as a webserver serving static files

Posted on 2014-01-27
9
Medium Priority
?
7,315 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

722 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