@@ -67,88 +67,89 @@ public IHttpHandler GetHandler(HttpContext context, string requestType, string u
6767
6868 string relativeURL = context . Request . AppRelativeCurrentExecutionFilePath ;
6969 string fname = relativeURL . Substring ( relativeURL . LastIndexOf ( '~' ) + 2 ) ;
70- String cname1 = ( fname . Contains ( "." ) ) ? fname . Substring ( 0 , fname . LastIndexOf ( '.' ) ) : fname ;
70+ string cname1 = ( fname . Contains ( "." ) ) ? fname . Substring ( 0 , fname . LastIndexOf ( '.' ) ) : fname ;
7171 string cname0 = cname1 . ToLower ( ) ;
72- string actualPath = "" ;
73-
72+ string mainNamespace ;
73+ string assemblyName , cname ;
74+ string actualPath ;
7475 if ( cname0 == "gxoauthlogout" )
7576 {
76- return new GeneXus . Http . GXOAuthLogout ( ) ;
77+ return new GXOAuthLogout ( ) ;
7778 }
7879 else if ( cname0 == "gxoauthuserinfo" )
7980 {
80- return new GeneXus . Http . GXOAuthUserInfo ( ) ;
81+ return new GXOAuthUserInfo ( ) ;
8182 }
8283 else if ( cname0 == "gxoauthaccesstoken" )
8384 {
84- return new GeneXus . Http . GXOAuthAccessToken ( ) ;
85+ return new GXOAuthAccessToken ( ) ;
8586 }
8687 else if ( cname0 == "gxmulticall" )
8788 {
88- return new GeneXus . Http . GXMultiCall ( ) ;
89+ return new GXMultiCall ( ) ;
8990 }
90- string assemblyName , cname ;
91- if ( GXAPIModule . serviceInPath ( pathTranslated , actualPath : out actualPath ) )
91+ else if ( HttpHelper . GamServicesInternalName . Contains ( cname0 ) )
92+ {
93+ mainNamespace = HttpHelper . GAM_NSPACE ;
94+ }
95+ else
9296 {
93- string nspace ;
94- Config . GetValueOf ( "AppMainNamespace" , out nspace ) ;
95- String objClass = GXAPIModule . servicesBase [ actualPath ] ;
96- //
97- String objectName = GetObjFromPath ( cname0 , actualPath ) ;
98- String objectNameUp = GetObjFromPath ( cname1 , actualPath ) ;
99- //
100- Dictionary < string , object > routeParms ;
101- if ( GXAPIModule . servicesMapData . ContainsKey ( actualPath ) )
97+ if ( ! Config . GetValueOf ( "AppMainNamespace" , out mainNamespace ) )
98+ mainNamespace = "GeneXus.Programs." ;
99+
100+ if ( GXAPIModule . serviceInPath ( pathTranslated , actualPath : out actualPath ) )
102101 {
103- bool IsServiceCall = GetSMap ( actualPath , objectName , objectNameUp , requestType , out string mapName , out string mapRegExp , out routeParms ) ;
104- if ( IsServiceCall )
102+ string nspace ;
103+ Config . GetValueOf ( "AppMainNamespace" , out nspace ) ;
104+ string objClass = GXAPIModule . servicesBase [ actualPath ] ;
105+ //
106+ string objectName = GetObjFromPath ( cname0 , actualPath ) ;
107+ string objectNameUp = GetObjFromPath ( cname1 , actualPath ) ;
108+ //
109+ Dictionary < string , object > routeParms ;
110+ if ( GXAPIModule . servicesMapData . ContainsKey ( actualPath ) )
105111 {
106- if ( ! String . IsNullOrEmpty ( mapName ) && GXAPIModule . servicesMap [ actualPath ] . TryGetValue ( mapName , out SingleMap value ) )
112+ bool IsServiceCall = GetSMap ( actualPath , objectName , objectNameUp , requestType , out string mapName , out string mapRegExp , out routeParms ) ;
113+ if ( IsServiceCall )
107114 {
108- String tmpController = objClass ;
109- String asssemblycontroller = tmpController ;
110- if ( objClass . Contains ( "\\ " ) )
115+ if ( ! string . IsNullOrEmpty ( mapName ) && GXAPIModule . servicesMap [ actualPath ] . TryGetValue ( mapName , out SingleMap value ) )
111116 {
112- tmpController = objClass . Substring ( objClass . LastIndexOf ( "\\ " ) + 1 ) ;
113- String addNspace = objClass . Substring ( 0 , objClass . LastIndexOf ( "\\ " ) ) . Replace ( "\\ " , "." ) ;
114- asssemblycontroller = addNspace + "." + tmpController ;
115- nspace += "." + addNspace ;
117+ string tmpController = objClass ;
118+ string asssemblycontroller = tmpController ;
119+ if ( objClass . Contains ( "\\ " ) )
120+ {
121+ tmpController = objClass . Substring ( objClass . LastIndexOf ( "\\ " ) + 1 ) ;
122+ string addNspace = objClass . Substring ( 0 , objClass . LastIndexOf ( "\\ " ) ) . Replace ( "\\ " , "." ) ;
123+ asssemblycontroller = addNspace + "." + tmpController ;
124+ nspace += "." + addNspace ;
125+ }
126+ GxContext gxContext = GxContext . CreateDefaultInstance ( ) ;
127+ object handler = ClassLoader . FindInstance ( asssemblycontroller , nspace , tmpController , new Object [ ] { gxContext } , null ) ;
128+
129+ gxContext . HttpContext = context ;
130+ GxRestWrapper restWrapper = new Application . GxRestWrapper ( handler as GXBaseObject , context , gxContext , value . ServiceMethod , value . VariableAlias , routeParms ) ;
131+ return restWrapper ;
116132 }
117- GxContext gxContext = GxContext . CreateDefaultInstance ( ) ;
118- object handler = ClassLoader . FindInstance ( asssemblycontroller , nspace , tmpController , new Object [ ] { gxContext } , null ) ;
119-
120- gxContext . HttpContext = context ;
121- GxRestWrapper restWrapper = new Application . GxRestWrapper ( handler as GXBaseObject , context , gxContext , value . ServiceMethod , value . VariableAlias , routeParms ) ;
122- return restWrapper ;
123133 }
124- }
125- else
126- {
127- if ( requestType . Equals ( HttpMethod . Options . Method ) && ! String . IsNullOrEmpty ( actualPath ) && GXAPIModule . servicesMapData . ContainsKey ( actualPath ) )
134+ else
128135 {
129- return new OptionsApiObjectRequestHandler ( actualPath , objectName , mapRegExp ) ;
136+ if ( requestType . Equals ( HttpMethod . Options . Method ) && ! string . IsNullOrEmpty ( actualPath ) && GXAPIModule . servicesMapData . ContainsKey ( actualPath ) )
137+ {
138+ return new OptionsApiObjectRequestHandler ( actualPath , objectName , mapRegExp ) ;
139+ }
130140 }
131- }
141+ }
142+ return null ;
132143 }
133- return null ;
134144 }
135- else
145+ assemblyName = cname0 ;
146+ cname = cname0 ;
147+ if ( cname . EndsWith ( "_bc_ws" ) )
136148 {
137- {
138- assemblyName = cname0 ;
139- cname = cname0 ;
140- }
141- if ( cname . EndsWith ( "_bc_ws" ) )
142- {
143- cname = cname . Substring ( 0 , cname . Length - 3 ) ;
144- assemblyName = cname ;
145- }
149+ cname = cname . Substring ( 0 , cname . Length - 3 ) ;
150+ assemblyName = cname ;
146151 }
147- string mainNamespace , className ;
148- if ( Config . GetValueOf ( "AppMainNamespace" , out mainNamespace ) )
149- className = mainNamespace + "." + cname ;
150- else
151- className = "GeneXus.Programs." + cname ;
152+ string className = mainNamespace + "." + cname ;
152153
153154 Type objType = GetHandlerType ( assemblyName , className ) ;
154155 if ( objType == null )
@@ -190,7 +191,7 @@ public IHttpHandler GetHandler(HttpContext context, string requestType, string u
190191 }
191192 else
192193 {
193- handlerToReturn = ( IHttpHandler ) System . Web . UI . PageParser . GetCompiledPageInstance ( url , pathTranslated , context ) ;
194+ handlerToReturn = System . Web . UI . PageParser . GetCompiledPageInstance ( url , pathTranslated , context ) ;
194195 }
195196 return handlerToReturn ;
196197 }
@@ -199,7 +200,7 @@ public string GetObjFromPath(string cname, string apath)
199200 {
200201 if ( cname . LastIndexOf ( "/" ) == ( cname . Length - 1 ) )
201202 cname = cname . Substring ( 0 , cname . Length - 1 ) ;
202- String objectName = cname . Remove ( 0 , apath . Length ) ;
203+ string objectName = cname . Remove ( 0 , apath . Length ) ;
203204 return objectName ;
204205 }
205206
@@ -302,7 +303,7 @@ internal static Type GetHandlerType(string assemblyName, string className)
302303 try
303304 {
304305
305- objType = GeneXus . Metadata . ClassLoader . FindType ( assemblyName , className , null ) ;
306+ objType = ClassLoader . FindType ( assemblyName , className , null ) ;
306307 if ( objType == null )
307308 objType = Assembly . Load ( assemblyName ) . GetType ( className ) ;
308309 }
0 commit comments