RE: [coldbox:10932] Can a hybrid web app be built?

I don’t know what you mean by a “none mvc app”, but I assume you have the two following basic options:

Option 1:

Change to URLs to something like

domain.com/app/appName
domain.com/user/userName

and then create two routes accordingly.

Option 2

Route all requests to the same handler and look for an app or a user with that name at run time and decide which one the is being requested. If a username is the same as one of your app names, you’ll need to decide which one takes precedence.

In both cases, I’m assuming you have a rewrite rule that adds index.cfm back in and that all requests are processed by ColdFusion (as opposed to some other rewrite engine)

You could do this entirely with a rewrite engine if the routes were all static, but I assume they are not and need to be dynamic and based on a database.

Does that answer your question?

Thanks!

~Brad

Nich,

URL Rewriting will allow you to do all sorts of funky stuff. Just list your known apps first in your rewrite rules in IIS, Apache or any other solution.

Incoming: domain.com/app1/ → rewrite to → domain.com/apps/app1/index.cfm
Incoming: domain.com/app3/ → rewrite to → domain.com/apps/app2/index.cfm

Incoming: domain.com/app2/ → rewrite to → domain.com/apps/app3/index.cfm

Then, you can use a general mapping to pass all other requests to your MVC ColdBox Application.
Incoming: domain.com/ → rewrite to → domain.com/index.cfm

So long as you have difference Application.cfc/cfm files in your /apps/app1 directory you will not be bound to the ColdBox framework. This is the same solution presented by Brad but you don’t need to organize your URLs into categories like /user/*** or /apps/***.

Aaron

Thank you guys for your input. Got some more Q's or clarifications.

Notes:
- By a none mvc app, I mean a traditional app that is not using any
framework
- These apps have their own Application.cfc's
- No user will share the same name as the app dir
- users will need to access their profile via domain.com/usename
- Users profile page is dynamically generated from the database
- Hosted on IIS 7.5

Just a recap, one option is to have the apps located in an apps folder
i.e. domain.com/apps/app1

Then add a ReWrite rule that takes domain.com/app1 to domain.com/apps/
app1

But if the applications will not have the same name as the users, then
the applications can stay in the wwwroot folder, then add a static
route to each app, right?

So, for me to have SES url's and have user profiles be accessed via
domain.com/username, I'll have to implement

http://wiki.coldbox.org/wiki/URLMappings.cfm

and

http://coldbox.org/forgebox/view/Reserved-Routes

Question: Supposing that the contact page is found in domain.com/
contact it would mean that no user or application should be named
'contact' right?

While this is so, how will coldbox know if it is a page or if it is a
username or user profile? Will I need to add a route for each page
then dynamically route the rest to load the user profile.

Would this be the way forward?:
- No username or page or app should share the same name
- Statically route apps & pages
- dynamically route the rest to user profiles

Sounds like you got the idea.

Yes, as long as your application is in /whatever-your-app-is-called and that directory has its own Application.cfc AND your rewrite rules check to make sure there is not a physical directory before rewriting to /index.cfm your applications should work just fine.

Also, I contributed an interceptor to the community about 2 years ago to help solve the problem of usernames matching your application name. You can download the reserved routes interceptor here http://www.coldbox.org/forgebox/view/Reserved-Routes and read the blog post here: http://aarongreenlee.com/share/reserved-routes-coldbox-interceptor. Implementing this will help you avoid usernames that match your static routes (like /contact or /app1).

-Aaron Greenlee

Hi Aaron, I am learning the interceptor, and was looking at your post and the coldbox forgebox, but I could not find the reservedRoutes.cfc file and it shows 404 error…i am missing anything? Thanks for your help and contributions! -Tony

That is no good!

Luis,
This Forgebox download has gone missing: http://www.coldbox.org/forgebox/view/Reserved-Routes

Hopeful, it is isolated.

Aaron, that points to a code depot in svn I think that does not exist. Did you have this elsewhere?

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano