Forums Register Login

single code base responding to multiple urls?

+Pie Number of slices to send: Send
I am putting together an application that will be used by different companies. I would like to be able to figure out which company is accessing my application based on url. This would allow me to load company specific information (eg skin). For example:

mydomain.com/companyA
mydomain.com/companyB

even the following would work:

mydomain.com/myApp/companyA
mydomain.com/myApp/companyB

Problem is, I don't know if this can be done. Is there a better way of achieving this goal?

Regards,

Joshua
+Pie Number of slices to send: Send
You could certainly map multiple contexts to the same app and use the context path to differentiate. That wouldn't prevent companies from using each others URLs, but they'd have to know about them to do so.

Without more info, it's difficult to try to suggest alternatives.
+Pie Number of slices to send: Send
Thanks for the reply!

In short, I am looking to have one code base serve multiple organizations. When they hit my site, I need to distinguish which organization is which so I may "skin" the applicaion appropriately.

Configuring the application to listen to multiple contexts should work. I would like to avoid tweaking the deployment settings every time I need to add a new organization though.

Any other suggestions?
+Pie Number of slices to send: Send
One of the apps I work on sounds like it has similar requirements.

The login credentials not only include a username and a password, but a company id as well. Anyone logging in to a company gets a particluar "skin" as well as any company-specific perferences applied to their accounts. The company id is kept in the user's session along with their user credentials.

Pretty simple. Everything is database-driven, and the usernames are name-spaced to the company (in other words, the same username can be used in different companies).
+Pie Number of slices to send: Send
Bear,

Problem is, not everyone is required to log in. People are required to log in to change data. Not everyone has this privilege. This complicates things considerbly. Any other ideas?

Regards,

Joshua
+Pie Number of slices to send: Send
Without a login, your options are obviously more restricted.

Does everyone "come in" through the same page? If each "company" had a unique start page, you could tag the session (or register a cookie) there. But that approach could run into trouble if people bookmark pages within the app and not enter through the "start" page.

Your original idea of mapping multiple contexts to the same app should also be workable. There's just something about relying on the context path for identification that violates my architectural sensibilities.

Anyone else want to weigh in with some ideas? Or explain why my "goo-o-meter"* should not be going off for the context path idea?

* "goo" being my highly scientific and precise term for anything that violates my architectural sensibilities. As in, "keep the goo off the pages".
+Pie Number of slices to send: Send
Bear,

Thanks again for the reply. I understand the "goo-o-meter" completely.

Another idea was to make it a build/deploy problem. Create multiple wars deployed to their own context, each with a different startup parameter indicating the appropriate organization that would let the rest of the application figure out which organization it should be dealing with.

I am still not getting a good vibe from any of these solutions. Any other thoughts?

Regards,

Joshua
+Pie Number of slices to send: Send
if you can require people to use different URLs, you can give everyone a company ID or something, so they would come in through .../yourapp/?id=12345. With a long enough ID, this is relatively secure from guessing (so-called security by obscurity). They don't need to remember the ID, after all, they can bookmark it. Of course, you'd still need a cookie/a session, unless you want to include the ID in every URL afterwards.
And when my army is complete, I will rule the world! But, for now, I'm going to be happy with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 840 times.
Similar Threads
is this session problem?
Integrating Tomcat and Apache - URL Problem
[CompanyA] Pune Or [CompanyB] Pune...For 2 Yrs JAVA/J2EE
Query on Job Offer from [CompanyA] & [CompanyB]
Suggestion regarding joining [CompanyA] or [CompanyB] in Mumbai
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 23:56:28.