6666import org .wso2 .carbon .ui .tracker .AuthenticatorRegistry ;
6767import org .wso2 .carbon .ui .transports .FileDownloadServlet ;
6868import org .wso2 .carbon .ui .transports .FileUploadServlet ;
69+ import org .wso2 .carbon .ui .transports .fileupload .FileUploadExecutorManager ;
6970import org .wso2 .carbon .ui .util .UIAnnouncementDeployer ;
7071import org .wso2 .carbon .user .core .service .RealmService ;
7172import org .wso2 .carbon .utils .ConfigurationContextService ;
@@ -228,6 +229,14 @@ public void start(BundleContext context) throws Exception {
228229 uiResourceRegistry .setDefaultUIResourceProvider (
229230 uiBundleDeployer .getBundleBasedUIResourcePrvider ());
230231
232+ // Create FileUploadExecutorManager early and register it as an OSGi service
233+ // This must be done BEFORE uiBundleDeployer.deploy() so that bundles with
234+ // FileUploadExecutor configurations can be processed properly
235+ ConfigurationContext contextForUpload = isLocalTransportMode ? serverConfigContext : clientConfigContext ;
236+ FileUploadExecutorManager fileUploadExecutorManager =
237+ new FileUploadExecutorManager (context , contextForUpload , webContext );
238+ context .registerService (FileUploadExecutorManager .class .getName (), fileUploadExecutorManager , null );
239+
231240 HttpContext commonContext =
232241 new CarbonSecuredHttpContext (context .getBundle (), "/web" , uiResourceRegistry , registry );
233242
@@ -251,12 +260,8 @@ public void start(BundleContext context) throws Exception {
251260 context .registerService (Servlet .class , fileDownloadServlet , fileDownloadServletProperties );
252261
253262 // Register file upload servlet using HTTP Whiteboard pattern
254- Servlet fileUploadServlet ;
255- if (isLocalTransportMode ) {
256- fileUploadServlet = new FileUploadServlet (context , serverConfigContext , webContext );
257- } else {
258- fileUploadServlet = new FileUploadServlet (context , clientConfigContext , webContext );
259- }
263+ // Use the already-created fileUploadExecutorManager
264+ Servlet fileUploadServlet = new FileUploadServlet (context , contextForUpload , webContext , fileUploadExecutorManager );
260265 Dictionary <String , String > fileUploadServletProperties = new Hashtable <>();
261266 fileUploadServletProperties .put (HttpWhiteboardConstants .HTTP_WHITEBOARD_SERVLET_PATTERN ,
262267 "/carbon/fileupload/*" );
0 commit comments