flymis/WebRoot/dojojs/src/io/RhinoIO.js

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*
	Copyright (c) 2004-2006, The Dojo Foundation
	All Rights Reserved.

	Licensed under the Academic Free License version 2.1 or above OR the
	modified BSD license. For more information on Dojo licensing, see:

		http://dojotoolkit.org/community/licensing.shtml
*/

dojo.provide("dojo.io.RhinoIO");

dojo.require("dojo.io.common");
dojo.require("dojo.lang.func");
dojo.require("dojo.lang.array");
dojo.require("dojo.string.extras");

dojo.io.RhinoHTTPTransport = new function(){
		this.canHandle = function(req){
			// We have to limit to text types because Rhino doesnt support 
			// a W3C dom implementation out of the box.  In the future we 
			// should provide some kind of hook to inject your own, because
			// in all my projects I use XML for Script to provide a W3C DOM.
			if(!dojo.lang.inArray((req.mimetype.toLowerCase() || ""),
				["text/plain", "text/html", "text/javascript", "text/json", "application/json"])){
				return false;
			}
			
			// We only handle http requests!  Unfortunately, because the method is 
			// protected, I can't directly create a java.net.HttpURLConnection, so
			// this is the only way to test.
			if(req.url.substr(0, 7) != "http://"){
				return false;
			}
			
			return true;
		}

		function doLoad(req, conn){
			var ret;
			if (req.method.toLowerCase() == "head"){
				// TODO: return the headers
			}else{
				var stream = conn.getContent();
				var reader = new java.io.BufferedReader(new java.io.InputStreamReader(stream));

				// read line-by-line because why not?
				var text = "";
				var line = null;
				while((line = reader.readLine()) != null){
					text += line;
				}

				if(req.mimetype == "text/javascript"){
					try{
						ret = dj_eval(text);
					}catch(e){
						dojo.debug(e);
						dojo.debug(text);
						ret = null;
后面还有 87 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。