Migrate IBM WebSphere Application Server Web Application Extension or Binding Files

Updated -

Summary

IBM WebSphere Application Server provides proprietary features and configurations within a series of *.xmi files. The web application extensions are specified in the ibm-web-ext.xmi file. This article describes how to map the most common attributes to configurations settings in Red Hat JBoss Enterprise Application Platform 6 and 7.

Map WebSphere Extension Attributes to JBoss EAP

autoresponseEncoding and autorequestEncoding

Attribute Description

In WebSphere, the Web container does not automatically set request and response encodings and response content types. To enable the server to set the encoding value and content type, set the autoResponseEncoding and autoRequestEncoding attribute values to true.

JBoss Equivalent

In JBoss, you can override the character encoding used to decode the URI bytes at the server or at the request level using one of following procedures.

Modify the Settings at the Server Level Using the Management CLI
  1. Open a command prompt for your operating system and connect to the Management CLI using the following command.

    For Linux: $ /bin/jboss-cli.sh --connect
    For Windows: C:\>\bin\jboss-cli.bat --connect
    

    You should see the following result output:

    Connected to standalone controller at localhost:9999
    
  2. Set the encoding at the server level:

    /system-property=org.apache.catalina.connector.URI_ENCODING:add(value=UTF-8)
    /system-property=org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING:add(value=true)
    

    You should see the following response after each command:

    {
        "outcome" => "success",
    }
    
Modify the Settings at the Request or Response Level

If you prefer, you can create a javax.servlet.Filter class to enforce character encoding for specific request and response content:

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
    response.setContentType("text/html; charset=UTF-8");
    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");
    chain.doFilter(request, response);
}

reloadingEnabled and reloadInterval

Attribute Description

WebSphere uses these properties to enable automatic reloading of web applications when application files have changed.

JBoss Equivalent

In JBoss EAP 6 and 7, automatic reloading is configured in the deployment-scanner subsystem of the server configuration file. You can enable automatic deployment of exploded archives and set the timer interval to check for updated files. You can also configure the server to monitor deployments to external directories. For more information about the deployment scanner, see the section entitled
Deploy with the Deployment Scanner in the Administration and Configuration Guide for Red Hat JBoss Enterprise Application Platform.

You can use the Management CLI to modify the deployment scanner configuration settings. The following examples show how modify and view the current deployment-scanner settings.

Modify the Deployment Scanner Settings to Enable Automatic Deployment of an Exploded Archive # {#deployment-scanner-enable-auto-deployment)
  1. Open a command prompt for your operating system and connect to the Management CLI using the following command.

    For Linux: $ /bin/jboss-cli.sh --connect
    For Windows: C:\>\bin\jboss-cli.bat --connect
    

    You should see the following result output:

    Connected to standalone controller at localhost:9999
    
  2. Navigate to the default scanner in the deployment-scanner subsystem:

    cd subsystem=deployment-scanner/scanner=default
    
  3. Type the following command to set the auto-deploy-exploded attrbute to true.

    :write-attribute(name=auto-deploy-exploded,value=true)
    

    You should see the following response:

    {
        "outcome" => "success",
    }
    
  4. Specify the scanner interval in milliseconds between checks for file updates.

    :write-attribute(name=scan-interval,value=10000)
    

    You should see the following response:

    {
        "outcome" => "success",
    }
    
Modify the Deployment Scanner Settings to Track an External Folder for Updates
  1. Open a command prompt for your operating system and connect to the Management CLI using the following command.

    For Linux: $ /bin/jboss-cli.sh --connect
    For Windows: C:\>\bin\jboss-cli.bat --connect
    

    You should see the following result output:

    Connected to standalone controller at localhost:9999
    
  2. Specify an external folder to monitor for updates.

    :write-attribute(name=path,value=home/username/external-deployments)
    :write-attribute(name=auto-deploy-exploded,value=true)
    

    You should see the following response:

    {
        "outcome" => "success",
        "response-headers" => {
            "operation-requires-reload" => true,
            "process-state" => "reload-required"
        }
    }
    
  3. To view the current setting in the Managment CLI, type:

    :read-resource
    

    You should see the following response:

    {
        "outcome" => "success",
        "result" => {
            "auto-deploy-exploded" => true,
            "auto-deploy-xml" => true,
            "auto-deploy-zipped" => true,
            "deployment-timeout" => 60,
            "path" => "home/username/external-deployments",
            "relative-to" => "jboss.server.base.dir",
            "scan-enabled" => true,
            "scan-interval" => 10000
        }
    }
    
  4. The deployment-scanner subsystem in the server configuration file now contains the new settings

    <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
        <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="10000" auto-deploy-exploded="true"/>
    </subsystem>
    

For information on how to configure the server to monitor updates to JSP files, see jspAttributes below.

autoLoadFilters

Attribute Description

This WebSphere setting specifies whether filters should be loaded on the startup of a web module.

JBoss Equivalent

JBoss EAP automatically loads filters on startup so there is no equivalent configuration.

mimeFilters

Attribute Description

WebSphere provides MIME filters that can direct requests to URIs within the web application based on the content type of the request.

JBoss Equivalent

To provide similar functionality in JBoss EAP, you must write a custom servlet filter, then specify it in the standard web.xml file.

fileServingAttributes

Attribute Description

The WebSphere file serving attribute properties define the behavior of how the web container serves files. These properties include the buffer size used by the web container for file serving.

JBoss Equivalent

There are no equivalent settings for input and output buffer sizing in JBoss EAP.

directoryBrowsingEnabled

Attribute Description

This WebSphere attribute allows directory browsing from within the application.

JBoss Equivalent

For security reasons, this feature is disabled by default in JBoss EAP. It can be reenabled by configuring of the static-resources in the web subsystem of the server configuration as follows.

Modify the Setting for a Standalone server using the JBoss Management CLI
  1. Open a command prompt for your operating system and connect to the Management CLI using the following command.

    For Linux: $ /bin/jboss-cli.sh --connect
    For Windows: C:\>\bin\jboss-cli.bat --connect
    

    You should see the following result output:

    Connected to standalone controller at localhost:9999
    
  2. Issue the following command:

    • In EAP 6:
        /subsystem=web/configuration=static-resources/:write-attribute(name=listings,value=true)
    
    • In EAP 7.x:
        /subsystem=undertow/servlet-container=default/setting=jsp:write-attribute(name=directory-listing,value=true)
    

    You should see the following result output:

        "outcome" => "success"
    
Modify the Setting for a Domain server using the JBoss Management CLI
  1. Open a command prompt for your operating system and connect to the Management CLI using the following command.

    For Linux: $ /bin/jboss-cli.sh --connect
    For Windows: C:\>\bin\jboss-cli.bat --connect
    

    You should see the following result output:

    Connected to domain controller at localhost:9999
    
  2. Issue the following command:

    • In EAP 6:
        /profile=full/subsystem=web/configuration=static-resources/:write-attribute(name=listings,value=true)
    
    • In EAP 7.x:
        /profile=full/subsystem=undertow/servlet-container=default/setting=jsp:write-attribute(name=directory-listing,value=true)
    

    You should see the following result output:

        "outcome" => "success"
    

serveServletsByClassnameEnabled

Attribute Description

This WebSphere attribute allows servlets to be served by fully-qualified classname.

JBoss Equivalent

There are no equivalent setting in JBoss EAP.

jspAttributes

Attribute Description

WebSphere uses this setting to configure JSP attributes.

JBoss Equivalent

In JBoss EAP, the following JSP attributes are configured in the <jsp-configuration> element of the web subsystem in the server configuration file.

Map ibm-web-ext.xmi Attributes to JBoss

Attribute Name Description Default Value
check-interval Check interval for JSP updates using a background thread. 0
development Enable the development mode, which gives more information when an error occurs. false
disabled Enable the JSP container. false
display-source-fragment When a runtime error occurs, attempts to display corresponding JSP source fragment. true
dump-smap Write SMAP data to a file. false
error-on-use-bean-invalid-class-attribute Enable errors when using a bad class in useBean false
generate-strings-as-char-arrays Generate String constants as char arrays. false
java-encoding Specify the encoding used for Java sources. UTF-8
keep-generated Keep the generated Servlets. true
mapped-file Map to the JSP source. true
modification-test-interval Minimum amount of time between two tests for updates, in seconds. 4
recompile-on-fail Retry failed JSP compilations on each request. false
scratch-dir Specify a different work directory. N/A
smap Enable SMAP true
source-vm Source VM level for compilation. 1.5
tag-pooling Enable tag pooling. true
target-vm Target VM level for compilation. 1.5
trim-spaces Trim some spaces from the generated Servlet. false
x-powered-by Enable advertising the JSP engine in x-powered-by true
Modify the Deployment Scanner Settings
  1. Open a command prompt for your operating system and connect to the Management CLI using the following command.

    For Linux: $ /bin/jboss-cli.sh --connect
    For Windows: C:\>\bin\jboss-cli.bat --connect
    

    You should see the following result output:

    Connected to standalone controller at localhost:9999
    
  2. Enable development mode:

    • In EAP 6:
        /subsystem=web/configuration=jsp-configuration:write-attribute(name=development,value=true)
    
    • In EAP 7.x:
        /subsystem=undertow/servlet-container=default/setting=jsp:write-attribute(name=development,value=true)
    

    You should see the following result output:

    {
        "outcome" => "success",
        "response-headers" => {
            "operation-requires-reload" => true,
            "process-state" => "reload-required"
        }
    }                
    
  3. Set the scan interval to detect JSP file changes:

    • In EAP 6:
        /subsystem=web/configuration=jsp-configuration/:write-attribute(name=check-interval,value=30)
    
    • In EAP 7:
       /subsystem=undertow/servlet-container=default/setting=jsp:write-attribute(name=check-interval,value=30)
    

    You should see the following response:

    {
        "outcome" => "success",
        "response-headers" => {
            "operation-requires-reload" => true,
            "process-state" => "reload-required"
        }
    }                
    
  4. Reload the server configuration.

    :reload
    

    You should see the following response:

    {
        "outcome" => "success",
        "response-headers" => {"process-state" => "reload-required"}
    }
    
  5. To view the current settings in the Management CLI, navigate to the jsp-configuration in the web or undertow subsystem.

    • In EAP 6:
        cd subsystem=web/configuration=jsp-configuration
    
    • In EAP 7:
        cd subsystem=undertow/servlet-container=default/setting=jsp
    
  6. Then type the following command:

    :read-resource
    

    You should see the following response:

    {
        "outcome" => "success",
        "result" => {
            "check-interval" => 30,
            "development" => true,
            "disabled" => false,
            "display-source-fragment" => true,
            "dump-smap" => false,
            "error-on-use-bean-invalid-class-attribute" => false,
            "generate-strings-as-char-arrays" => false,
            "java-encoding" => "UTF8",
            "keep-generated" => true,
            "mapped-file" => true,
            "modification-test-interval" => 4,
            "recompile-on-fail" => false,
            "scratch-dir" => undefined,
            "smap" => true,
            "source-vm" => "1.5",
            "tag-pooling" => true,
            "target-vm" => "1.5",
            "trim-spaces" => false,
            "x-powered-by" => true
        }
    }
    
    1. The web/undertow subsystem in the server configuration file now contains the new settings.
    • Web subsystem in EAP 6:

      <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
          <configuration>
              <jsp-configuration development="true" check-interval="30"/>
          </configuration>
          <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
          <virtual-server name="default-host" enable-welcome-root="true">
              <alias name="localhost"/>
              <alias name="example.com"/>
          </virtual-server>
      </subsystem>
      
    • Undertow subsystem in EAP 7:

      <subsystem xmlns="urn:jboss:domain:undertow:7.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other">
          <buffer-cache name="default"/>
          <server name="default-server">
              <ajp-listener name="ajp" socket-binding="ajp"/>
              <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
              <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
              <host name="default-host" alias="localhost">
                  <location name="/" handler="welcome-content"/>
                  <http-invoker security-realm="ApplicationRealm"/>
              </host>
          </server>
          <servlet-container name="default" directory-listing="false">
              <jsp-config development="true" check-interval="30"/>
              <websockets/>
          </servlet-container>
          <handlers>
              <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
          </handlers>
      </subsystem>
      

defaultErrorPage

Attribute Description

This WebSphere attribute specifies the URI of a page or servlet to use as the default error page for the web application.

JBoss Equivalent

JBoss EAP 6 supports the standard Java Servlet 3.0 specification, so you simply define the <error-page> in the web.xml file as follows:

<error-page>
   <location>/general-error.html</location>
</error-page>

servletCacheConfigs

Attribute Description

WebSphere provides configuration for caching the output of servlets and JSP pages to its dynamic cache.

JBoss Equivalent

To provide similar functionality in JBoss EAP you use a simple ServletFilter and caching provider, such as JBoss Data Grid.

additionalClasspath

Attribute Description

This property allows users to specify an additional classpath to reference resources outside the WEB-INF/ directory.

JBoss Equivalent

JBoss EAP 6 and 7 use a modular class loading system. You can use the jboss-deployment-structure.xml file or define a custom module to load class dependencies that are external to the deployment. For more information, see Create or Modify Files That Control Class Loading in JBoss EAP in the Migration Guide for Red Hat JBoss Enterprise Application Platform 6.4.

Comments