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
Solved

How to use Jboss as a webserver serving static files

Posted on 2014-01-27
9
6,518 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
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Convert websphere application server default chained Certificates from 1024 to 2048 keysize or higher size and also you can change signatureAlgorithm . Please make sure Websphere Application Server fixpack 7.0.0.23 or Above. The following steps a…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

840 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