Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to use Jboss as a webserver serving static files

Posted on 2014-01-27
9
Medium Priority
?
7,640 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
7 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
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…
Suggested Courses

783 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