Solved

How to use Jboss as a webserver serving static files

Posted on 2014-01-27
9
6,043 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 34

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 34

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 26

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now