Use URL templates to link Legacy REST Web Services URLs to JSPs. URL templates use regular expressions to recognize input parameters and pass them to a JSP.
URL templates are Nucleus components that are used by the URL recoding feature of the Oracle ATG Web Commerce platform. See comprehensive information about that feature in the ATG Platform Programming Guide.
To create a URL template component, add a URL template properties file in the configuration path for the Legacy REST Web Services. For example, you could configure a URL template in the file shown below.
<ATG10dir>/home/servers/servername
/localconfig/atg/rest/processor/templates/MyTemplate.properties
An example URL template component properties file is shown below.
The
urlTemplateFormat
property defines the application path of the URL that Legacy REST Web Services clients will access. It includes a comma separated list of parameters that the client must supply.The URL format must begin with
/rest/service
. After that, it must contain the Nucleus path of an existing component in your application. It does not matter which component you choose.The
indirectRegex
property matches parameters that are supplied in the URL application path. The URL recoding feature will pass these parameters to the JSP.The
regexElementList
property provides information about each parameter. The two parameters shown in this example are a repository item identifier and a simple string.The
forwardUrlTemplateFormat
property configures the JSP file that the Legacy REST Web Services interface will invoke. The application path includes the context root of the Web application (mymodule
in the example). It also includes each parameter that was identified in the URL template as URL parameters that will be passed to the JSP.
$class=atg.repository.seo.IndirectUrlTemplate # Url template format urlTemplateFormat=/rest/service/atg/AnyComponent/{item.id},{mystring} # Regex that matches above format indirectRegex=.*/rest/service/atg/AnyComponent/([^/].*?),([^/].*?)$ # Regex elements regexElementList=item | id | /atg/AnyComponent\:product, mystring | string # Forward Url template forwardUrlTemplateFormat=/mymodule/WEB-INF/rest/myRestJsp.jsp? productId\={item.id}&myString\={mystring} # Web App registry webAppRegistry=/atg/registry/WebApplicationRegistry
Note: See comprehensive information about configuring the URL recoding feature of the Oracle ATG Web Commerce platform in the ATG Platform Programming Guide.