Installing the Image Transformation servlet in a Java Web application
To make the Image Transformation servlet work in Java, add Contextual Image Delivery resources to your API (in-process) Server Role. Because this is a deprecated and discouraged setup, you can only get the resources from SDL Customer Support.
Procedure
- Contact SDL Customer Support to obtain the WAR file for the Image Transformation servlet, called context-image-war.war
- Navigate to the WEB-INF\lib\ subdirectory of your target folder.
- Copy all files in this folder into the WEB-INF\lib\ folder of your API (in-process) Web application.
- If you want to run the image transformer against a customized URL, access the WEB-INF/classes/ folder of your Web application.
- Open cd_ambient_conf.xml for editing.
- In the
<ExcludedPaths>section, add a subelement<Path>/CUSTOM/PATH</Path>, where /CUSTOM/PATH refers to the customized URL that you want the image transformer to run against. - Save and close cd_ambient_conf.xml.
- In the root folder of your Web application, open web.xml for editing.
- Create a new
servletsection with the following contents (you can also copy-paste this section from the file web.xml located in the installation media folder configuration/samples/):<servlet> <servlet-name>imageTransformer</servlet-name> <servlet-class>com.sdl.context.image.servlet.ImageTransformerServlet</servlet-class> </servlet> - Create a new
servlet-mappingsection with the following contents (you can also copy-paste this section from the file web.xml located in the installation media folder configuration/samples/):<servlet-mapping> <servlet-name>imageTransformer</servlet-name> <url-pattern>/CUSTOM/PATH/*</url-pattern> </servlet-mapping>where /CUSTOM/PATH refers to the customized URL that you want the image transformer to run against. If you do not want to create a customized URL, set
<url-pattern>to*. - Save and close web.xml.
- If your Web application server is WebSphere, use the WebSphere administrative console to instruct your Web module classloaders to search for classes in the application first. To do so, set the Web module classloader mode to the value
PARENT_LAST. For more information, refer to the following WebSphere documentation resource: Administer classloaders using the WebSphere administrative console. - If your Web application server is WebSphere, in the folder WebSphere/Liberty/usr/servers/defaultServer/, do the following in the file server.xml:
- Check for the line
<feature>javaee-7.0</feature>(in thefeatureManagersection). If you see it, add the line<feature>cdi-1.0</feature>and save and closeserver.xmlto commit your changes. - Ensure that the file contains an
applicationMonitorelement with itsupdateTriggerattribute set todisabled.
- Check for the line
- Start or restart the Web application.