コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Dictionary <string, string> param = PluginBuilderFactory.getProperties(Request);
            PluginBuilder pb = PluginBuilderFactory.newPluginBuilder(Request);

            // Adding - if necessary - CORS headers
            com.wiris.system.service.HttpResponse res = new com.wiris.system.service.HttpResponse(this.Response);
            String origin = this.Request.Headers.Get("origin");

            pb.addCorsHeaders(res, origin);

            Response.ContentType = "application/x-javascript";

            string r = pb.getConfiguration().getJavaScriptConfiguration();

            outVar(Response, "createimagePath", "createimage");
            outVar(Response, "showimagePath", "showimage");
            outVar(Response, "editorPath", "editor");
            outVar(Response, "CASPath", "cas");
            outVar(Response, "createimagePath", "createimage");
            outVar(Response, "createcasimagePath", "createcasimage");
            outVar(Response, "getmathmlPath", "getmathml");
            outVar(Response, "servicePath", "service");
            this.Response.Write(r);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PluginBuilder  pb       = PluginBuilderFactory.newPluginBuilder(Request, Response);
            ParamsProvider provider = pb.getCustomParamsProvider();
            String         digest   = provider.getParameter("formula", null);
            String         mml      = provider.getParameter("mml", null);

            if (digest == null && mml == null)
            {
                throw new Exception("Missing parameters 'formula' or 'mml'.");
            }
            // Backwards compatibility
            // showimage.php?formula.png --> showimage.php?formula
            // because formula is md5 string, remove all extensions.
            if (digest != null && digest.LastIndexOf(".") >= 0)
            {
                digest = digest.Substring(0, digest.LastIndexOf("."));
            }
            Dictionary <string, string> param = PluginBuilderFactory.getProperties(Request);
            // Adding - if necessary - CORS headers
            HttpResponse res    = new HttpResponse(this.Response);
            String       origin = this.Request.Headers.Get("origin");

            pb.addCorsHeaders(res, origin);
            if (pb.getConfiguration().getProperty("wirispluginperformance", "xml").IndexOf("true") != -1)
            {
                String useragent = provider.getParameter("useragent", "");
                if (useragent.IndexOf("IE") != -1)
                {
                    pb.getConfiguration().setProperty("wirisimageformat", "png");
                }
                else
                {
                    pb.getConfiguration().setProperty("wirisimageformat", "svg");
                }

                Response.ContentType = "application/json";
                Response.AddHeader("Cache-Control", "public, max-age=3600");
                if (digest == null)
                {
                    pb.newRender().showImage(digest, mml, provider);
                    digest = pb.newRender().computeDigest(mml, provider.getParameters());
                }
                string r = pb.newRender().showImageJson(digest, "en");
                if (r.IndexOf("warning") != -1)
                {
                    Response.AddHeader("Cache-Control", "no-cache, no-store, must-revalidate");
                }
                Response.Write(r);
            }
            else
            {
                byte [] bs = pb.newRender().showImage(digest, mml, provider);
                Response.ContentType = pb.getImageFormatController().getContentType();
                Response.OutputStream.Write(bs, 0, bs.Length);
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PluginBuilder pb = PluginBuilderFactory.newPluginBuilder(Request, Response);

            // Adding - if necessary - CORS headers
            HttpResponse res    = new HttpResponse(this.Response);
            String       origin = this.Request.Headers.Get("origin");

            pb.addCorsHeaders(res, origin);

            string test = pb.newTest().getTestPage();

            Response.ContentType = "text/html; charset=utf-8";
            Response.Write(test);
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Dictionary <string, string> param = PluginBuilderFactory.getProperties(Request);
            PluginBuilder pb = PluginBuilderFactory.newPluginBuilder(Request, Response);

            // Adding - if necessary - CORS headers
            HttpResponse res    = new HttpResponse(this.Response);
            String       origin = this.Request.Headers.Get("origin");

            pb.addCorsHeaders(res, origin);

            string r = pb.newCas().createCasImage(param["image"]);

            this.Response.Write(r);
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PluginBuilder  pb       = PluginBuilderFactory.newPluginBuilder(Request, Response);
            ParamsProvider provider = pb.getCustomParamsProvider();
            String         formula  = provider.getRequiredParameter("formula");

            // Adding - if necessary - CORS headers
            HttpResponse res    = new HttpResponse(this.Response);
            String       origin = this.Request.Headers.Get("origin");

            pb.addCorsHeaders(res, origin);

            byte[] bs = pb.newCas().showCasImage(formula, provider);
            Response.ContentType = "image/png";
            Response.OutputStream.Write(bs, 0, bs.Length);
        }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PluginBuilder  pb       = PluginBuilderFactory.newPluginBuilder(Request, Response);
            ParamsProvider provider = pb.getCustomParamsProvider();
            String         service  = provider.getRequiredParameter("service");
            String         r        = pb.newTextService().service(service, provider);

            // Adding - if necessary - CORS headers
            HttpResponse res    = new HttpResponse(this.Response);
            String       origin = this.Request.Headers.Get("origin");

            pb.addCorsHeaders(res, origin);

            Response.ContentType = "application/json";
            Response.Write(r);
        }
コード例 #7
0
ファイル: resource.aspx.cs プロジェクト: nhanth191/AppBook
        protected void Page_Load(object sender, EventArgs e)
        {
            PluginBuilder  pb       = PluginBuilderFactory.newPluginBuilder(Request);
            ParamsProvider provider = pb.getCustomParamsProvider();
            String         resource = provider.getRequiredParameter("resourcefile");

            // Adding - if necessary - CORS headers
            HttpResponse res    = new HttpResponse(this.Response);
            String       origin = this.Request.Headers.Get("origin");

            pb.addCorsHeaders(res, origin);

            ServiceResourceLoader resourceLoader = pb.newResourceLoader();

            Response.ContentType = resourceLoader.getContentType(resource);
            Response.Write(resourceLoader.getContent(resource));
        }
コード例 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PluginBuilder  pb       = PluginBuilderFactory.newPluginBuilder(Request);
            ParamsProvider provider = pb.getCustomParamsProvider();

            // Adding - if necessary - CORS headers
            com.wiris.system.service.HttpResponse res = new com.wiris.system.service.HttpResponse(this.Response);
            String origin = this.Request.Headers.Get("origin");

            pb.addCorsHeaders(res, origin);

            Response.ContentType = "application/json";
            String variableKeys = provider.getRequiredParameter("variablekeys");
            String r            = pb.getConfiguration().getJsonConfiguration(variableKeys);

            this.Response.Write(r);
        }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PluginBuilder  pb       = PluginBuilderFactory.newPluginBuilder(Request, Response);
            ParamsProvider provider = pb.getCustomParamsProvider();
            String         lang     = provider.getParameter("lang", "en");

            // Adding - if necessary - CORS headers
            HttpResponse res    = new HttpResponse(this.Response);
            String       origin = this.Request.Headers.Get("origin");

            pb.addCorsHeaders(res, origin);

            String r = pb.newEditor().editor(lang, provider);

            Response.ContentType = "text/html; charset=utf-8";
            Response.Write(r);
        }
コード例 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PluginBuilder  pb                 = PluginBuilderFactory.newPluginBuilder(Request);
            ParamsProvider provider           = pb.getCustomParamsProvider();
            Dictionary <string, string> param = PluginBuilderFactory.getProperties(Request);

            // Adding - if necessary - CORS headers
            HttpResponse res    = new HttpResponse(this.Response);
            String       origin = this.Request.Headers.Get("origin");

            pb.addCorsHeaders(res, origin);

            CleanCache cleanCache = pb.newCleanCache();

            cleanCache.init(provider);
            string output = cleanCache.getCacheOutput();

            Response.ContentType = cleanCache.getContentType();
            Response.Write(output);
        }
コード例 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PluginBuilder  pb       = PluginBuilderFactory.newPluginBuilder(Request, Response);
            ParamsProvider provider = pb.getCustomParamsProvider();
            String         mml      = provider.getRequiredParameter("mml");

            if (mml == null)
            {
                throw new Exception("Missing parameter 'mml'.");
            }


            // Adding - if necessary - CORS headers
            HttpResponse res    = new HttpResponse(this.Response);
            String       origin = this.Request.Headers.Get("origin");

            pb.addCorsHeaders(res, origin);

            string r = pb.newRender().createImage(mml, provider, null);

            this.Response.Write(r);
        }
コード例 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PluginBuilder  pb       = PluginBuilderFactory.newPluginBuilder(Request, Response);
            ParamsProvider provider = pb.getCustomParamsProvider();
            String         latex    = provider.getParameter("latex", null);
            String         digest   = provider.getParameter("formula", null);

            if (digest == null || digest.Length == 0)
            {
                digest = Request.Params["md5"];
            }

            // Adding - if necessary - CORS headers
            HttpResponse res    = new HttpResponse(this.Response);
            String       origin = this.Request.Headers.Get("origin");

            pb.addCorsHeaders(res, origin);

            String r = pb.newTextService().getMathML(digest, latex);

            Response.ContentType = "text/plain; charset=utf-8";
            Response.Write(r);
        }
コード例 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PluginBuilder pb = PluginBuilderFactory.newPluginBuilder(Request, Response);

            // Adding - if necessary - CORS headers
            HttpResponse res    = new HttpResponse(this.Response);
            String       origin = this.Request.Headers.Get("origin");

            pb.addCorsHeaders(res, origin);

            // If called from another spot, please set the Request (can be null), "pluginFolder" and "pluginUrl" (can be relative)
            //PluginBuilder pb = PluginBuilderFactory.newPluginBuilder(Request, "E:\\develop\\PLUGINS\\editors\\generic", "http://localhost:50026");

            TextService text = pb.newTextService();
            Dictionary <string, string> p = new Dictionary <string, string>();

            string s      = "<html><body><b>Formula: </b><math><mfrac><mi>x</mi><mn>1000</mn></mfrac></math></body></html>";
            String output = pb.newTextService().filter(s, p);

            // Sent the output
            Response.ContentType = "text/html; charset=utf-8";
            Response.Write(output);
        }
コード例 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Dictionary <string, string> param = PluginBuilderFactory.getProperties(Request);
            PluginBuilder  pb             = PluginBuilderFactory.newPluginBuilder(Request, Response);
            AccessProvider accessProvider = pb.getAccessProvider();

            if (accessProvider != null && !accessProvider.requireAccess())
            {
                return;
            }

            // Adding - if necessary - CORS headers
            com.wiris.system.service.HttpResponse res = new com.wiris.system.service.HttpResponse(this.Response);
            String origin = this.Request.Headers.Get("origin");

            pb.addCorsHeaders(res, origin);

            Response.ContentType = "application/json";

            string r = pb.getConfiguration().getJavaScriptConfigurationJson();

            this.Response.Write(r);
        }