Currently I have a method that is loading a PDF into an HTML page. The PDF is dynamically created after retrieving data from the database. Now, what I would like to do, is before the view of the PDF is loaded, I'd like to show a page that lets the user know that the information is being loaded.

ActionParams:

@using (Html.BeginForm("PreLoaderView", "Report", FormMethod.Post, new {
    @target = "_blank"
}))


Controller:

public ActionResult PreLoaderView(TestViewModel viewModel) {
    return View(viewModel);
}

public ActionResult SolicitorActionReport_Load(TestViewModel viewModel) {
    var cultivationModel = new CultivationModel(viewModel, ConstituentRepository, CampaignRepository);
    var cultivationData = cultivationModel.GetCultivationActivityData();
    var reportParamModel = new List&lt;ReportParamModel&gt;
                                   {
                                       new ReportParamModel() {AgencyName = SelectedUserAgency.AgencyName, StartDate = viewModel.StartDate, EndDate = viewModel.EndDate}
                                   };
    return FileContentPdf("Constituent", "CultivationActivityManagement", cultivationData, reportParamModel, new List&lt;FundraisingAppealMassSummary&gt;(), new List&lt;FundraisingAppealPortfolioSummary&gt;());
    return Content(viewModel.SolicitorType);
}


PreLoaderView:

@model Report.SolicitorActionParamsViewModel

@{
    ViewBag.Title = "Cultivation Activity";
}
&lt;script type="text/javascript"&gt;
    $(function () {
        $.ajax({
            url: '@Url.Action("SolicitorActionReport_Load", "Report", @Model)',

            complete: function() {
                $('#progress').hide();
            },
            error: function() {
                alert('oops');
            }
    });
    });
&lt;/script&gt;

&lt;div align="center"&gt;
    &lt;img id="progress" src="~/Content/images/loading.GIF"&gt;
    &lt;div id="result"&gt;
        &lt;embed width="100%" height="800px" src="http://localhost/YP/Report/SolicitorActionReport_Load"type="application/pdf"&gt;
    &lt;/div&gt;
&lt;/div&gt;


So, from the PreLoaderView, I'd like to pass the @Model back to the controller for use with the SolicitorActionReport_Load(). Is this possible to do?


Question: Java ServiceLoader with multiple Classloaders
Answer: This question seem to be more complicated than I first anticipated. As I see
it, there are 3 possible strategies for dealing with ServiceLoaders.


Use a static ServiceLoader instance and only support loading classes from
the same classloader as the one holding the ServiceLoader reference. This
would work when


The service configuration and implementation are in a shared classloader
and all child classloaders are using the same implementation. The example
in the documentation is geared towards theis use case.

Or
Configuration and implementation are put into each child classloader and
deployed along each webapp in WEB-INF/lib.


In this scenario it is not possible to deploy the service in a shared classloader
and let each webapp choose its own service implementation.
Initialize the ServiceLoader on each access passing the context classloader of
the current thread as the second parameter. This approach is taken be the JAXP
and JAXB apis, although they are using their own FactoryFinder implementation
instead of ServiceLoader. So it is possible to bundle a xml parser with a webapp
and have it automatically get picked up for example by DocumentBuilderFactory#newInstance.

This lookup has a performance impact, but in the case of xml parsing
the time to look up the implementation is small compared to the time needed to
actually parse a xml document. In the library I'm envisioning the factory
itself is pretty simple so the lookup time would dominate the performance.
Somehow cache the implementation class with the context classloader as the key.
I'm not entirely sure if this is possible in all the above cases without
causing any memory leaks.


In conclusion, I will probably be ignoring this problem and require that the library
gets deployed inside each webapp, i.e. option 1b above.