Search code examples
iishttphandlerjboss5.x

Develop handler for JBoss 5 Application server


We are trying to rewrite an IIS web server handler for JBoss 5 app server, but I could not find the similar concept for JBoss. Could you, please, give some advice or direction how we should implement the handler, or what should we google for?

To be clear, the final goal is to have an application which does not need a name in url in order to be invoked and runs every time I access just the IP address or server name. e.g. http://13.10.15.48

The application (handler) should grab the request, process it and pass over to other default handlers or web server.

Should I search for Tomcat handlers instead?

Thanks in advance.


Solution

  • By default JBoss has a the root context point to a default app. In order to point you application to the root context you need to do the following

    If you are deploying you application as a WAR file, the add the following content to your /WEB-INF/jboss-web.xml (if it does not already exist)

    <?xml version="1.0" encoding="UTF-8"?>
    <jboss-web>
        <context-root>/</context-root>
    </jboss-web>
    

    If you are deploying your application as an EAR file, then you need to set the context-root in your /META-INF/application.xml file as follows

    <application version="5" xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
          http://java.sun.com/xml/ns/javaee
          http://java.sun.com/xml/ns/javaee/application_5.xsd">
    
       ...
    
       <module>
          <web>
             <web-uri>my-webapp.war</web-uri>
             <context-root>/</context-root>
          </web>
       </module>
    </application>
    

    For more information please refer [1]

    Hope this helps.

    Good luck!

    [1] https://community.jboss.org/wiki/HowDoIOverrideTheWebContextRoot