Announcement Announcement Module
Collapse
No announcement yet.
Spring HttpInvoker: how to replace serviceUrl at runtime? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring HttpInvoker: how to replace serviceUrl at runtime?

    The issue is discussed couple of times, but I was not able to find a solution that solves our problem.
    We have the following HttpInvoker service that takes the remote URL from Database:
    Code:
    @Service("exampleService")
    public class ExampleHttpInvoker extends HttpInvokerProxyFactoryBean {
    
        @Resource
        private DBService service;
    
        @PostConstruct
        public void init() throws ConfigurationException {
    
            String url = service.getURL();
            this.setServiceUrl(url);
            this.setServiceInterface(RemoteInterface.class);
            this.setHttpInvokerRequestExecutor(new CommonsHttpInvokerRequestExecutor());
            afterPropertiesSet();
    
        }
    
    }
    The URL can be changed between remote calls.
    How to replace serviceUrl at runtime?
    We can not use Session or Request scope since the service is not Web aware.
    Any help will be appreciated.

  • #2
    My clarification: I would be able to solve my problem if I would able to create the ExampleHttpInvoker before each remote call or upon DB modification. In Spring is possible to use @Scope(“request”) or @Scope(“session”), but these options are valid only in the context of a web-aware Spring ApplicationContext. I am looking for a way to recreate my ExampleHttpInvoker singleton.
    Any help will be appreciated.

    Comment

    Working...
    X