Skip to content

Commit cd7e914

Browse files
committed
COLDBOX-1187 #resolve
Removal of uniqueUrls boolean indicator for URL routing, since Pretty URLs are now the standard. This rerouting feature needs to be removed.
1 parent ae89b66 commit cd7e914

File tree

4 files changed

+3
-135
lines changed

4 files changed

+3
-135
lines changed

system/web/routing/Router.cfc

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ component
2222
****************************************************************/
2323

2424
property
25-
name ="cachebox"
25+
name ="cachebox"
2626
inject ="cachebox"
2727
delegate="getCache";
2828
property
2929
name ="controller"
30-
inject ="coldbox"
30+
inject ="coldbox"
3131
delegate="relocate,runEvent,runRoute";
3232
property name="flash" inject="coldbox:flash";
3333
property name="logBox" inject="logbox";
@@ -56,14 +56,6 @@ component
5656
*/
5757
property name="namespaceRoutingTable" type="struct";
5858

59-
/**
60-
* Flag to enable unique or not URLs
61-
*/
62-
property
63-
name ="uniqueURLS"
64-
type ="boolean"
65-
default="false";
66-
6759
/**
6860
* Flag to enable/disable routing
6961
*/
@@ -172,8 +164,6 @@ component
172164
variables.namespaceRoutingTable = {};
173165
// Loose matching flag for regex matches
174166
variables.looseMatching = false;
175-
// Flag to enable unique or not URLs
176-
variables.uniqueURLs = false;
177167
// Enable the interceptor by default
178168
variables.enabled = true;
179169
// Detect extensions flag, so it can place a 'format' variable on the rc

system/web/services/RoutingService.cfc

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,6 @@ component extends="coldbox.system.web.services.BaseService" accessors="true" {
157157
arguments.event.setSESBaseURL( variables.router.composeRoutingUrl() );
158158
}
159159

160-
// Check for invalid URLs if in strict mode via unique URLs
161-
if ( variables.router.getUniqueURLs() ) {
162-
checkForInvalidURL(
163-
cleanedPaths[ "pathInfo" ],
164-
cleanedPaths[ "scriptName" ],
165-
arguments.event
166-
);
167-
}
168-
169160
// Extension detection if enabled, so we can do cool extension formats
170161
if ( variables.router.getExtensionDetection() ) {
171162
cleanedPaths[ "pathInfo" ] = detectExtension( cleanedPaths[ "pathInfo" ], arguments.event );
@@ -888,98 +879,6 @@ component extends="coldbox.system.web.services.BaseService" accessors="true" {
888879
return returnString;
889880
}
890881

891-
/**
892-
* Check for invalid URL's
893-
*
894-
* @route The incoming route
895-
* @script_name The cgi script name
896-
* @event The event object
897-
*/
898-
private function checkForInvalidURL(
899-
required route,
900-
required script_name,
901-
required event
902-
){
903-
var handler = "";
904-
var action = "";
905-
var newpath = "";
906-
var rc = event.getCollection();
907-
908-
/**
909-
Verify we have uniqueURLs ON, the event var exists, route is empty or index.cfm
910-
AND
911-
if the incoming event is not the default OR it is the default via the URL.
912-
**/
913-
if (
914-
structKeyExists( rc, variables.eventName )
915-
AND
916-
( arguments.route EQ "/index.cfm" or arguments.route eq "" )
917-
AND
918-
(
919-
rc[ variables.eventName ] NEQ variables.defaultEvent
920-
OR
921-
( structKeyExists( url, variables.eventName ) AND rc[ variables.eventName ] EQ variables.defaultEvent )
922-
)
923-
) {
924-
// New Pathing Calculations if not the default event. If default, relocate to the domain.
925-
if ( rc[ variables.eventName ] != variables.defaultEvent ) {
926-
// Clean for handler & Action
927-
if ( structKeyExists( rc, variables.eventName ) ) {
928-
handler = reReplace( rc[ variables.eventName ], "\.[^.]*$", "" );
929-
action = listLast( rc[ variables.eventName ], "." );
930-
}
931-
// route a handler
932-
if ( len( handler ) ) {
933-
newpath = "/" & handler;
934-
}
935-
// route path with handler + action if not the default event action
936-
if ( len( handler ) && len( action ) ) {
937-
newpath = newpath & "/" & action;
938-
}
939-
}
940-
941-
// Debugging
942-
if ( variables.log.canDebug() ) {
943-
variables.log.debug(
944-
"SES Invalid URL detected. Route: #arguments.route#, script_name: #arguments.script_name#"
945-
);
946-
}
947-
948-
// Setup Relocation
949-
var httpRequestData = getHTTPRequestData();
950-
var relocationUrl = "#arguments.event.getSESbaseURL()##newpath##serializeURL( httpRequestData.content, arguments.event )#";
951-
952-
if ( httpRequestData.method eq "GET" ) {
953-
cflocation( url = relocationUrl, statusCode = 301 );
954-
} else {
955-
cflocation( url = relocationUrl, statusCode = 303 );
956-
}
957-
}
958-
}
959-
960-
/**
961-
* Serialize a URL when invalid
962-
*
963-
* @formVars The incoming form variables
964-
* @event The event object
965-
*/
966-
private function serializeURL( formVars = "", required event ){
967-
var vars = arguments.formVars;
968-
var rc = arguments.event.getCollection();
969-
970-
for ( var key in rc ) {
971-
if ( NOT listFindNoCase( "route,handler,action,#variables.eventName#", key ) ) {
972-
vars = listAppend( vars, "#lCase( key )#=#rc[ key ]#", "&" );
973-
}
974-
}
975-
976-
if ( len( vars ) eq 0 ) {
977-
return "";
978-
}
979-
980-
return "?" & vars;
981-
}
982-
983882
/**
984883
* Clean up some IIS funkyness where query string is found in the path info. We basically clean it up and add the query string into the RC scope
985884
*

test-harness/config/Router.cfc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
component {
22

33
function configure(){
4-
setUniqueURLs( false );
54
// setFullRewrites( false );
65

76
route( "/bar" ).toModuleRouting( "resourcesTest" );

tests/suites/eventCachingCollisions/config/routes.cfm

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,6 @@ NOTE: The interceptor will create a new setting called: sesBaseURL with this val
2323
<cfset setEnabled(true)>
2424

2525
<!---
26-
This determines if non-ses urls should be routed back to ses.
27-
In other words, if someone goes to http://localhost/index.cfm?event=home.main
28-
should we redirect (301, permanently moved) to the ses url:
29-
http://localhost/index.cfm/home/main ?
30-
31-
This will also make sure that any trailing index pages get redirected as well, so
32-
if you go to http://localhost/home/index it would redirect to http://localhost/home
33-
if index is your framework action default.
34-
35-
For SEO purposes it's always best to have one URL for everything, not 3!
36-
--->
37-
<cfset setUniqueURLs(false)>
38-
39-
<!---
40-
The Base URL for your site. This will only be used for forwarding requests if
41-
UniqueURLs is enabled and for creating the new Application settings:
42-
43-
- sesBaseURL
44-
- htmlBaseURL
45-
4626
If you want your URLs to look like http://localhost/handler/action then you should
4727
put "http://localhost" here. For this option you'll need .htaccess or isapi rewrite support.
4828
@@ -128,4 +108,4 @@ NOTE: The interceptor will create a new setting called: sesBaseURL with this val
128108

129109

130110
<!--- STANDARD COLDBOX COURSES, DO NOT MODIFY UNLESS YOU DON'T LIKE THEM --->
131-
<cfset addRoute(":handler/:action?")>
111+
<cfset addRoute(":handler/:action?")>

0 commit comments

Comments
 (0)