Results 1 to 4 of 4

Thread: Elegant way to enable/disable remoting

  1. #1
    Join Date
    Jun 2010
    Posts
    3

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jun 2010
    Posts
    3

    Default 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?

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

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

    Quote 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>
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •