0

I have deployed ajax proxy app on websphere . I have made my configuration in proxy-config.xml.

This working as expected but the problem is I have to keep this configuration file with in EAR file, This block me to use the same EAR on different envoirnment as configuration will be different on different env.

I have tried keeping in some shared liabrary but its not geting picked up by application. I have pass it in classpath but still its not working.

So my question is How can i keep proxy-config.xml out of EAR file so that I can use same EAR to be deployed on all enviornment.

1 Answers1

0

Can't comment yet... but since you reference WebSphere , Ajax Proxy and mention proxy-config.xml - I assume you are using the ajax proxy from the web 2.0 (and mobile) feature pack and will attempt to answer. The only way I know to reference a proxy config outside the ear/war file is to override ProxyServlet and use the setCustomConfig method ( see below). This gets the proxy config out of the ear/war, but you'd need to differentiate where to load the file from the different environments, but this should get you closer to a solution.

 package marktest;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
 import com.ibm.ws.ajaxproxy.servlet.ProxyServlet;

 public class ExtendedProxyServlet extends ProxyServlet {

  @Override
  public void init(final ServletConfig config) throws ServletException {

          setCustomConfig("C:/files/proxy-config.xml");  
          super.init(config);
  }
}

And web.xml

<servlet>
    <servlet-name>ProxyServlet</servlet-name>
    <servlet-class>marktest.ExtendedProxyServlet</servlet-class>
</servlet>  
<servlet-mapping>
    <servlet-name>ProxyServlet</servlet-name>
    <url-pattern>/proxy/*</url-pattern>         
</servlet-mapping>
marknesb
  • 41
  • 1