当前位置:首页 » 文件管理 » 前端上传超时

前端上传超时

发布时间: 2022-10-09 11:58:50

‘壹’ 前端会话超时,异常怎么处理

)普通http请求的session超时。
b)异步http请求的session超时,使用ext后大部分的界面刷新都是异步的ajax请求。

不管是那种类型的http请求总是可以由一个过滤器来捕捉。
分类:普通http请求的header参数中没有x-requested-with:XMLHttpRequest头信息,而异步的有。
其实对于常见的ajax框架,header中还有标示自己身份的header信息。

对于普通的http请求,发现session超时后直接重定向到一个超时页面,显示访问超时。
对于异步http请求,其实有两种处理方式,第一种:发现session超时后则向请求的response中写入特定的超时头信息,客户端ajax对象检测
头信息,发现有超时状态标志后调用显示超时信息的javascript方法,提示用户访问超时。
第二种:发现session超时后,添加respone报错信息 ,在前端通过ext的requestexception事件来监听是否会话超时。

‘贰’ 前端session超时,后台数据库查询连接还在执行

如果需要查询结果增加timeout,时间就行。如果不需要,主动终止查询,后台的查询session会处于inactive状态,kill掉就行,这样就无此连接了。如果经常需要,编写储存过程脚本。下面是参考:
CREATE OR REPLACE PROCEDURE "KILL_SESSION" AS
v_sid number;
v_serial number;
killer varchar2(1000);
CURSOR cursor_session_info is select sid,serial# from v$session where type!='BACKGROUND' and status='INACTIVE' and last_call_et>2700 and username='ICWEB' and machine='orc';
BEGIN
open cursor_session_info;
loop
fetch cursor_session_info into v_sid,v_serial;
exit when cursor_session_info%notfound;

killer:='alter system disconnect session '''||v_sid||','||v_serial||''' post_transaction immediate';
execute immediate killer;
end loop;
dbms_output.PUT_LINE(cursor_session_info%rowcount||' users with idle_time>2700s have been killed!');
close cursor_session_info;
END;
/

‘叁’ java 前端怎么设置请求超时处理

1. 单击“开始”,单击“运行”,键入 regedit,然后单击“确定”,cheap chanel handbag。
2. 在注册表中找到并单击以下项:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings
3. 在“编辑”菜单上,假期OVER,指向“新建”,然后单击“DWORD 值”。
4. 键入 KeepAliveTimeout,然后按 Enter 键。
5. 在“编辑”菜单上,单击“修改”。
6. 键入相应的超时值(以毫秒为单位),然后单击“确定”。
例如,要将超时值设置为两分钟,请键入 120000。
7. 重新启动 Internet Explorer。

‘肆’ ajax如何 实现 文件上传



程序说明

使用说明

实例化时,第一个必要参数是file控件对象:

newQuickUpload(file);


第二个可选参数用来设置系统的默认属性,包括
属性: 默认值//说明
parameter:{},//参数对象
action:"",//设置action
timeout:0,//设置超时(秒为单位)
onReady:function(){},//上传准备时执行
onFinish:function(){},//上传完成时执行
onStop:function(){},//上传停止时执行
onTimeout:function(){}//上传超时时执行

还提供了以下方法:
upload:执行上传操作;
stop:停止上传操作;
dispose:销毁程序。

varQuickUpload=function(file,options){

this.file=$$(file);

this._sending=false;//是否正在上传
this._timer=null;//定时器
this._iframe=null;//iframe对象
this._form=null;//form对象
this._inputs={};//input对象
this._fFINISH=null;//完成执行函数

$$.extend(this,this._setOptions(options));
};
QuickUpload._counter=1;
QuickUpload.prototype={
//设置默认属性
_setOptions:function(options){
this.options={//默认值
action:"",//设置action
timeout:0,//设置超时(秒为单位)
parameter:{},//参数对象
onReady:function(){},//上传准备时执行
onFinish:function(){},//上传完成时执行
onStop:function(){},//上传停止时执行
onTimeout:function(){}//上传超时时执行
};
return$$.extend(this.options,options||{});
},
//上传文件
upload:function(){
//停止上一次上传
this.stop();
//没有文件返回
if(!this.file||!this.file.value)return;
//可能在onReady中修改相关属性所以放前面
this.onReady();
//设置iframe,form和表单控件
this._setIframe();
this._setForm();
this._setInput();
//设置超时
if(this.timeout>0){
this._timer=setTimeout($$F.bind(this._timeout,this),this.timeout*1000);
}
//开始上传
this._form.submit();
this._sending=true;
},
//设置iframe
_setIframe:function(){
if(!this._iframe){
//创建iframe
variframename="QUICKUPLOAD_"+QuickUpload._counter++,
iframe=document.createElement($$B.ie?"<iframename=""+iframename+"">":"iframe");
iframe.name=iframename;
iframe.style.display="none";
//记录完成程序方便移除
varfinish=this._fFINISH=$$F.bind(this._finish,this);
//iframe加载完后执行完成程序
if($$B.ie){
iframe.attachEvent("onload",finish);
}else{
iframe.onload=$$B.opera?function(){this.onload=finish;}:finish;
}
//插入body
varbody=document.body;body.insertBefore(iframe,body.childNodes[0]);

this._iframe=iframe;
}
},
//设置form
_setForm:function(){
if(!this._form){
varform=document.createElement('form'),file=this.file;
//设置属性
$$.extend(form,{
target:this._iframe.name,method:"post",encoding:"multipart/form-data"
});
//设置样式
$$D.setStyle(form,{
padding:0,margin:0,border:0,
backgroundColor:"transparent",display:"inline"
});
//提交前去掉form
file.form&&$$E.addEvent(file.form,"submit",$$F.bind(this.dispose,this));
//插入form
file.parentNode.insertBefore(form,file).appendChild(file);

this._form=form;
}
//action可能会修改
this._form.action=this.action;
},
//设置input
_setInput:function(){
varform=this._form,oldInputs=this._inputs,newInputs={},name;
//设置input
for(nameinthis.parameter){
varinput=form[name];
if(!input){
//如果没有对应input新建一个
input=document.createElement("input");
input.name=name;input.type="hidden";
form.appendChild(input);
}
input.value=this.parameter[name];
//记录当前input
newInputs[name]=input;
//删除已有记录
deleteoldInputs[name];
}
//移除无用input
for(nameinoldInputs){form.removeChild(oldInputs[name]);}
//保存当前input
this._inputs=newInputs;
},
//停止上传
stop:function(){
if(this._sending){
this._sending=false;
clearTimeout(this._timer);
//重置iframe
if($$B.opera){//opera通过设置src会有问题
this._removeIframe();
}else{
this._iframe.src="";
}
this.onStop();
}
},
//销毁程序
dispose:function(){
this._sending=false;
clearTimeout(this._timer);
//清除iframe
if($$B.firefox){
setTimeout($$F.bind(this._removeIframe,this),0);
}else{
this._removeIframe();
}
//清除form
this._removeForm();
//清除dom关联
this._inputs=this._fFINISH=this.file=null;
},
//清除iframe
_removeIframe:function(){
if(this._iframe){
variframe=this._iframe;
$$B.ie?iframe.detachEvent("onload",this._fFINISH):(iframe.onload=null);
document.body.removeChild(iframe);this._iframe=null;
}
},
//清除form
_removeForm:function(){
if(this._form){
varform=this._form,parent=form.parentNode;
if(parent){
parent.insertBefore(this.file,form);parent.removeChild(form);
}
this._form=this._inputs=null;
}
},
//超时函数
_timeout:function(){
if(this._sending){this._sending=false;this.stop();this.onTimeout();}
},
//完成函数
_finish:function(){
if(this._sending){this._sending=false;this.onFinish(this._iframe);}
}
}

‘伍’ JAVA 前端大文件上传如何实现

如果是页面传至后台,那么页面上传文件的时候进行分片处理,如果是后台之间调用,直接代理里面分片处理。关键点,当前一片传输完毕之后,收到成功返回才开始传输下一片如果传输失败则重传当前片数,超时重传。传输时带上文件唯一标识,文件当前片数,总片数,当前片数md5校验值等。必要参数。 大致为这样,注意不要内存泄露了。

‘陆’ 微信小程序前端上传提示“上传代码失败”,怎么解决

可能是网络原因,重新上传

‘柒’ 前端面试,项目文件上传一半失败了 如何处理

前端面试,项目文件上传一半失败了的处理方法如下:
1、首先要确保论坛文件的完整性,不要少传了某个文件,有好多人把upload.inc文件当做文本文件删掉,所以导致无法上传,不能上传表现为上传框那里显示一白条,其实下面有字的,按鼠标左键往下拉可以拉出详细出错原因;
2、选择正确的上传组件,一般服务器都支持无组件上传的,如果你选择了服务器不允许的上传组件,也是不能上传;
3、检查上传目录是否真实存在,如果不存在,你在上传时总是会提示请选择正确的文件,再检查此文件夹是否有Internet来宾用户的写入权,如果只是存在,没有写入权限同样也是显示请选择正确的文件;
4、再检查你上传的文件大小是否超过了允许上传的文件大小,首先检查后台用户组设置中每一用户组允许上传的文件大小,如果设置正确仍然不能上传过大的文件,请与空间商联系,需要在空间上修改;

‘捌’ 前端数据提交问题

前端可以让用户通过typeName选择,但提交数据时必须是id,否则如果有同名的typeName后台是绝对无法区分的,即使是上帝也没办法。
比如前端是用下拉框来选择userType的,那么可以这样:
<select name="userType">
<option value="这里放id">这里放typeName</option>
<option value="这里放id">这里放typeName</option>
......
</select>
这样的话用户选择时看到的是typeName,但上传时则是id

热点内容
压缩机选型手册 发布:2024-10-08 05:24:37 浏览:620
java主机名 发布:2024-10-08 05:12:55 浏览:117
华意压缩待遇 发布:2024-10-08 05:04:07 浏览:465
jsp上传图片存到数据库 发布:2024-10-08 05:04:06 浏览:73
分卷压缩解压速度 发布:2024-10-08 04:45:16 浏览:847
冰雪单职业辅助哪个好安卓 发布:2024-10-08 04:40:06 浏览:663
iqz3哪个配置好一点 发布:2024-10-08 04:34:07 浏览:761
二战时期的电报密码叫什么 发布:2024-10-08 04:34:06 浏览:619
神武手游什么队伍配置最好 发布:2024-10-08 04:19:05 浏览:421
seer数据库 发布:2024-10-08 04:18:47 浏览:478