Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

Migrate Oracle WebLogic Server Proprietary Servlet Annotations to Red Hat JBoss Enterprise Application Platform 6 or 7

Updated on

Request a new translation or translation update

A translation for your language preference does not exist. Click below to request a translation for your selected language.

Submit request

Summary

Oracle WebLogic Server provides its own proprietary servlet and filter annotations for dependency injection. If the application uses them, they must be replaced with the standard Java EE 6 or Java EE 7 Servlet annotations. This article describes how to replace Oracle WebLogic Server proprietary servlet annotations with the standard Java EE annotations.

Map WebLogic Annotations Standard Java EE Servlet Annotations

The following table contains a mapping of Oracle WebLogic Server annotations to the corresponding standard Java EE annotation.

Map Oracle WebLogic Server Servlet Annotations to Standard Java EE Servlet Annotations

WebLogic Annotation Java EE Equivalent Java EE Import
@WLServlet @WebServlet javax.servlet.annotation.WebServlet
@WLFilter @WebFilter javax.servlet.annotation.WebFilter
@WLInitParam @WebInitParam javax.servlet.annotation.WebInitParam

When you replace an annotation, be sure to modify its attributes to conform to the standard attribute names.

You must also remove the WebLogic imports and JAR.

You can find more information about how to replace each annotation and map its attributes in the following sections:

For more information about Java EE Servlet annotations, see the javax.servlet.annotation Javadoc.

Replace the Proprietary WebLogic @WLServlet Annotation

You must replace the proprietary WebLogic @WLServlet annotation with the standard Java EE @WebServlet equivalent. Before you replace the code, you must understand how to map the attribute values. The following table shows the mapping of the WebLogic @WLServlet annotation attributes to the Java EE @WebServlet equivalents.

Map WebLogic @WLServlet to @WebServlet

WebLogic Attribute Name Java EE Equivalent Comments
String displayName String displayName Display name for the Servlet
String description String description Servlet description
String icon String smallicon
String largeicon
The icon location
String name String name The Servlet name
WLInitParam[] initParams WebInitParam[] initParams Servlet initialization parameters
int loadOnStartup int loadOnStartup Whether the Servlet should load on server start
String runAs No equivalent attribute The run-as user for the Servlet
Although there is no Java EE equivalent, there are 3 options for its replacement.
  • Use the javax.annotation.security.RunAs annotation in the class file.
  • Define the run-as element for the Servlet in the application's web.xml file.
  • Define the run-as element in a application's web-fragments.xml file.See sections 8.2.1 through 8.2.3 of the Servlet 3.0 specification for further information about web-fragments.
String[] mapping String[] urlPatternsString[] value The Servlet url pattern

This is an example of WebLogic code that uses the @WLServlet annotation:

import weblogic.servlet.annotation.WLServlet;

@WLServlet (
    name = "catalog",
    runAs = "SuperEditor"
    initParams = { 
        @WLInitParam (name="catalog", value="spring"),
        @WLInitParam (name="language", value="English")
     },
     mapping = {"/catalog/*"}
)
public class MyCatalogServlet extends HttpServlet { . . . }

This is the equivalent code that uses the standard @WebServlet annotation:

import javax.annotation.security.RunAs;
import javax.servlet.annotation.WebServlet;

@WebServlet (
    name = "catalog", 
    initParams = { 
        @WebInitParam (name="catalog", value="spring"),
        @WLInitParam (name="language", value="English")
    },
    urlPatterns = "/catalog/*"
)
@RunAs("SuperEditor")
public class MyCatalogServlet extends HttpServlet { . . . }

Replace the Proprietary WebLogic @WLFilter Annotation

You must replace the proprietary WebLogic @WLFilter annotation with the standard Java EE @WebFilter equivalent. Before you replace the code, you must understand how to map the attribute values. The following table shows the mapping of the WebLogic @WLFilter annotation attributes to the Java EE @WebFilter equivalents.

Map WebLogic @WLFilter to @WebFilter

WebLogic Attribute Name Java EE Equivalent Comments
String displayName String displayName Display name for the Servlet
String description String description Servlet description
String icon String smallicon
String largeicon
The icon location
String name String name The Servlet name
WLInitParam[] initParams WebInitParam[] initParams Servlet initialization parameters
String[] mapping String[] urlPatterns
String[] value
The Servlet url pattern
No equivalent attribute DispatcherTypes[] dispatcherTypes The dispatcher types to which the filter applies
No equivalent attribute String[] servletNames The names of the servlets to which the filter applies

This is an example of WebLogic code that uses the @WLFilter annotation:

import weblogic.servlet.annotation.WLFilter;
import weblogic.servlet.annotation.WLInitParam;

@WLFilter (
    name = "catalogFilter",
    initParams = { @WLInitParam(name="catalog", value="winter") }
    mapping = {"/catalog/*"}
)
public class MyFilter implements Filter { . . . }

This is the equivalent code that uses the standard @WebFilter annotation:

import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;

@WebFilter (
    filterName = "catalogFilter",
    initParams = { @WebInitParam(name="catalog", value="winter") }
    urlPatterns = {"/catalog/*"}
)
public class MyFilter implements Filter { . . . }

Replace the Proprietary WebLogic @WLInitParam Annotation

You must replace the proprietary WebLogic @WLInitParam annotation with the standard Java EE @WebInitParam equivalent. Before you replace the code, you must understand how to map the attribute values. The following table shows the mapping of the WebLogic @WLInitParam annotation attributes to the Java EE @WebInitParam equivalents.

Map WebLogic @WLInitParam to @WebInitParam

WebLogic Attribute Name Java EE Equivalent Comments
String name String name Name of the initialization parameter
String value String value Value of the initialization parameter
No equivalent attribute String description Optional description of the initialization parameter

This is an example of WebLogic code that uses the @WLInitParam annotation:

import weblogic.servlet.annotation.WLFilter;
import weblogic.servlet.annotation.WLInitParam;

@WLFilter (
    name = "catalogFilter",
    initParams = { @WLInitParam(name="catalog", value="winter") }
    mapping = {"/catalog/*"}
)
public class MyFilter implements Filter { . . . }

This is the equivalent code that uses the standard @WebInitParam annotation:

import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;

@WebFilter (
    filterName = "catalogFilter",
    initParams = { @WebInitParam(name="catalog", value="winter", description="winter catalog") }
    urlPatterns = {"/catalog/*"}
)
public class MyFilter implements Filter { . . . }

This solution is part of Red Hat's fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Red Hat LinkedIn YouTube Facebook X, formerly Twitter

Quick Links

Help

Site Info

Related Sites

© 2026 Red Hat