katura
katura

Reputation: 2237

Is it possible to call a servlet on my domain from another domain?

I have a VPS. My website is on that vps, and I would like to have my client's websites on there as well, which is no problem.

I want to have my servlets under my domain and have the client's websites make requests to those servlets so I can avoid duplication of data. In other words, I would prefer to have the servlets all in one location (on my domain) instead of placing copies of those servlets under each domain for a client.

The question is this - is it possible to call the servlets on my domain (or context) from another domain (context)?

If so, how is this done?

Upvotes: 1

Views: 699

Answers (1)

Lincoln
Lincoln

Reputation: 3191

So you have one set of Servlets hosting functionality/content for a number of domains? You can do this by routing all of your domains to the same IP/host/server and then determine the requesting domain at runtime. An example of this can be seen here:

https://github.com/ocpsoft/rewrite/blob/master/showcase/multi-domain/src/main/java/com/ocpsoft/rewrite/showcase/domain/DomainRewriteConfiguration.java

This is using a URL/request rewriting tool to determine the name of a domain, and load data accordingly.

If this isn't your problem, then I guess I'm not really sure what you are asking!

Upvotes: 1

Related Questions