怪异问题,请大家帮助 SERVLET request.getInputStream 得不到值
代码如下:import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import lotus.domino.*;
public class UploadServlet extends HttpServlet {
Vector threadGroup=new Vector();
int threadcount=0;
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException
{
String dbname=request.getParameter("dbname").trim();
String docid=request.getParameter("docid").trim();
String path="C:\\Embed\\";
String file=null;
String filename=null;
String userIP=request.getRemoteAddr();
String type=request.getContentType();
String msg,temp$;
FileOutputStream fileOut=null;
boolean flag;
boolean start=false;
boolean filewrite=false;
byte[] buf=new byte[1024];
byte[] temp;
int len,len2,len3,index;
ServletInputStream in = request.getInputStream();
try{
File filepath=new File(path);
if(!filepath.exists()){
flag=filepath.mkdir();
}
int fi=type.indexOf("boundary=");
String boundary=type.substring(fi+9);
len=in.readLine(buf,0,buf.length);
msg=new String(buf,0,len);
len3=0;
int nn=0;
while(true){
if((!start)&&(!filewrite)){
index=msg.indexOf(boundary);
if(index!=-1){
start=true;
}
len =in.readLine(buf, 0, buf.length);
if(len==-1){
break;
}
msg=new String(buf,0,len);
}
if(filewrite){
temp=new byte[1024];
len2=in.readLine(temp,0,temp.length);
msg=new String(temp,0,len2);
index=msg.indexOf(boundary);
if(index==-1){
len3+=len;
fileOut.write(buf,0,len);
}else{
filewrite=false;
len3+=len-2;
fileOut.write(buf,0,len-2);
}
buf=new byte[1024];
len=len2;
for(int i=0;i<len;i++){
buf[i]=temp[i];
}
}
if(start){
index=msg.indexOf("name=");
if(index!=-1){
start=false;
filewrite=true;
temp$=msg.substring(index+"name=\"".length());
file=temp$.substring(0,temp$.indexOf("\""));
file=file.substring(file.lastIndexOf("\\")+1);
filename=path+file;
fileOut=new FileOutputStream(filename);
len=in.readLine(buf,0,buf.length);
msg=new String(buf,0,len);
}else{
break;
}
}
nn+=1;
}
fileOut.close();
}
catch(IOException e){
//System.out.println(e);
//System.out.println(e.getMessage());
}
response.setStatus(response.SC_NO_CONTENT) ;
}
}
} --------------------编程问答-------------------- len=in.readLine(buf,0,buf.length);
这行读过来是空的 --------------------编程问答-------------------- len=in.readLine(buf,0,buf.length);
这个LEN为1024,
msg=new String(buf,0,len);
这个MSG的长度也是1024,但内容是空的
为什么啊?谁可以解决!
--------------------编程问答-------------------- 我的环境是在DOMINO下,在DOMINO r5.10 可以,一切正常,但在DOMINO r7 下同样的SERVLET程序就不好用了,
补充:Java , Web 开发