Announcement Announcement Module
Collapse
No announcement yet.
Elegant way to enable/disable remoting Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Elegant way to enable/disable remoting

    I am going to use Spring remoting to call some of my application's methods from an external client in my development environment. In the production environment however, remoting should be disabled and I'm looking for an elegant way to do this.
    A colleague told me I might be able to find the servlet responsible for the remoting, make a sub class and override the doGet / doPost. Based on a flag in a properties file it would do either super.doGet / super.doPost or else nothing.
    Would this be a feasible approach? Suggestions for any other solution are welcome.

  • #2
    There is no servlet for the remoting so that solution is not going to work.

    Move remoting configuration to a seperate xml in the file system, leave this xml blank for production and configured for all other environments.

    Comment


    • #3
      Elegant way to enable/disable remoting

      Unfortunately we are not allowed to have a different XML file depending on the environment. There should be one WAR/EAR that is deployable in any environment. All variations between environments should be expressed in properties files. Would it be feasible to have my package contain two XML files (one with and one without remoting configuration) and decide upon which one to use based on a property?

      This colleague insists on the extending-approach. He suggest that we extend the handleRequest method of the HttpInvokerServiceExporter class. Would this be an other option?

      Comment


      • #4
        Where did I suggest that you had to package that xml file in the war?

        Originally posted by mdeinum
        Move remoting configuration to a seperate xml in the file system, leave this xml blank for production and configured for all other environments.
        You can load an xml file from ANYWHERE... Put it next to your properties file and instead ofloading it from the classpath use a file: prefix to load it from the file system. That way you don't need to hack away on classes, extend anything, create some nasty factorybean/selection mechanism.

        Code:
        <context-param>
          <param-name>contextConfigLocation</param-name>
          <param-value>/WEB-INF/applicationContext.xml,file:/opt/app/conf/remoting-context.xml</param-value>
        </context-param>

        Comment

        Working...
        X