File tree 5 files changed +11
-32
lines changed
5 files changed +11
-32
lines changed Original file line number Diff line number Diff line change @@ -29,14 +29,6 @@ This package provides a platform for creating such RESTFul APIs in PHP
29
29
30
30
This section explains the configuration for this package which can be configured using config.xml
31
31
32
- #### webroot
33
- This is the path where application is deployed relative to htdocs
34
- ```
35
- if application is deployed at demo ,
36
- the url looks like http://localhost/demo/myservice
37
- and 'demo' is the webroot
38
- ```
39
-
40
32
#### serializers
41
33
Differrent type of data needs to be serialized in differrent formats based on the Accept Header in the request
42
34
Original file line number Diff line number Diff line change 1
1
{
2
- "webroot" :" " ,
3
2
"serializers" :{
4
3
"string" :{
5
4
"text/plain" :" PhpPlatform\\ RESTFul\\ Serialization\\ StringToPlainTextSerialization"
Original file line number Diff line number Diff line change 22
22
unset($ process );
23
23
}
24
24
25
-
26
25
$ requestUri = $ _REQUEST ["__route__ " ];
27
- $ _SERVER ['REQUEST_URI ' ] == $ requestUri ;
26
+ $ requestUriActual = $ _SERVER ['REQUEST_URI ' ];
27
+ $ positionOfQueryString = strpos ($ requestUriActual , '? ' );
28
+ if ($ positionOfQueryString !== false ){
29
+ $ requestUriActual = substr ($ requestUriActual , 0 ,$ positionOfQueryString );
30
+ }
31
+ $ appPathEnd = strpos ($ requestUriActual , $ requestUri );
32
+ if ($ appPathEnd !== false ){
33
+ $ appPath = substr ($ requestUriActual , 0 , $ appPathEnd );
34
+ }
35
+ $ _SERVER ['REQUEST_URI ' ] = $ requestUri ;
36
+ $ _SERVER ['PLATFORM_APPLICATION_PATH ' ] = $ appPath ;
28
37
PhpPlatform \RESTFul \Routing \Route::run ($ requestUri );
29
38
30
39
?>
Original file line number Diff line number Diff line change @@ -74,25 +74,6 @@ private static function findRoute($uri = null){
74
74
$ uri = $ _SERVER ['REQUEST_URI ' ];
75
75
}
76
76
77
- $ appPath = Settings::getSettings (Package::Name,"appPath " );
78
-
79
- if (strpos ($ appPath ,"/ " ) !== 0 ){ // prepend / if needed
80
- $ appPath = "/ " .$ appPath ;
81
- }
82
-
83
- if (strpos ($ uri ,"/ " ) !== 0 ){ // prepend / if needed
84
- $ uri = "/ " .$ uri ;
85
- }
86
-
87
- if (strpos ($ uri ,$ appPath ) !== 0 ){
88
- throw new NotFound ();
89
- }else { // real uri is after webroot
90
- $ uri = substr ($ uri ,strlen ($ appPath ));
91
- }
92
-
93
- $ _SERVER ['REQUEST_URI ' ] = $ uri ;
94
- $ _SERVER ['PLATFORM_APPLICATION_PATH ' ] = $ appPath ;
95
-
96
77
$ urlPaths = array_diff (explode ("/ " ,$ uri ),array ("" ));
97
78
98
79
$ route = Settings::getSettings (Package::Name,"routes " );
Original file line number Diff line number Diff line change @@ -22,8 +22,6 @@ static function setUpBeforeClass(){
22
22
// clear caches
23
23
SettingsCache::getInstance ()->reset ();
24
24
25
- MockSettings::setSettings ("php-platform/restful " , "webroot " , APP_PATH );
26
-
27
25
}
28
26
29
27
function setUp (){
You can’t perform that action at this time.
0 commit comments