Using the Ajax proxy


The Ajax proxy is distributed as an optional Web archive file (WAR) that can be installed directly into an application or combined with an existing application enterprise archive (EAR) file. The usage depends on your goals.

If you are developing an application that uses Ajax that must support cross site scripting because you are accessing data from one or more remote sites, you might embed the Ajax proxy WAR file as part of your application. If you have multiple applications that are accessing the same remote site, you might deploy the Ajax proxy as a standalone WAR file, and allow multiple applications to access it.



Getting started

You can apply the Ajax proxy in multiple ways. The following two scenarios demonstrate how you might use the Ajax proxy. The steps are covered in further detail in the document.

(Option 1) Using a proxy embedded as part of your JavaTM EE application

As a servlet, the proxy can be embedded in your Java EE application and deployed with the application. Embedding the proxy with the application supports proxy deployment with the application in a ready-to-run configuration. You might choose to embed the Ajax proxy in your application if you are building an application that combines the content from one or more service endpoints in an Ajax-based application.

  1. Modify your application.xml file to include the AjaxProxy Servlet. Typically, if you already have an EAR file created, then you can associate the Ajax proxy for IBM® WebSphere Application Server WAR file with your EAR project, and Eclipse completes the rest.
  2. Modify the proxy-config.xml file to define URI context paths, URLs, and policies that the proxy supports.
  3. Build your application with the Ajax proxy servlet and deploy the application.

(Option 2) Using a proxy as a stand-alone Web application

As a servlet, the proxy can run as a standard Web application. Other applications can use the proxy to broker requests.

  1. Modify the proxy-config.xml file to define URI context paths and polices that the proxy supports.
  2. Deploy the Ajax proxy for IBM WebSphere Application Server WAR file to your application server.

Locating the Ajax proxy application Web archive file (WAR)

The first step is locating the Ajax proxy WAR file.

Modify the proxy-config.xml file for the Ajax proxy

The proxy-config.xml file is located in the WEB-INF/ directory of the AjaxProxy.war file and controls how the proxy behaves when a client side request is passed to the proxy. The proxy-config.xml file is loaded during the servlets initialization phase, you must restart the servlet for changes to take effect. The section, WEB-INF/proxy-config.xml file discusses how to control the behavior of the proxy.



Terms of Use | Feedback