applet用证书签名了,只能读客户端文件,怎么着才能写客户端文件,是我配置有问题还是什么原因啊!!!!!
我在网上看了,配置.policy文件可以解决,但是那要修改客户端的java.security文件!
有没有不用修改客户端配置的解决方案啊,能不能只用证书来解决?????
跪求解决方案啊!!!!!!!!!

解决方案 »

  1.   

    谢谢大家!!!
    请教高手啊!
    我研究了2天了,网上的资料看的快差不多,网上只说写.policy可以,
    真的只有这样吗??????
      

  2.   

    恩,现在还是写.policy权限比较实际
      

  3.   

    没有其他办法,客户端安装java web start好像可以,除去了安全性限制
      

  4.   

    我今天上午用jnlp来搞了搞,跳过了安全性限制!
    但是大家帮我看看代码,怎么交互不了啊!
    新建c:\windows\aug.cer怎么老是空的呀!
    那个获取服务器返回数据的方法在applet中是可以用的!
    大家帮忙挑下毛病!!!!
    小弟在这里感激不尽,代码粘的有点乱,不好意思!public class GUIDemo extends JFrame{
    public GUIDemo()
        {
            super("Jnlp Demo!");
            init();
        }
    private void init(){
                               Map paraMap=new HashMap();
                           File f1=this.getFile(paraMap, null,"http://192.168.1.200:8082/DownLoadCert.do?act=downLoad");
                           try {         
             File f=new File(this.getSystemPath()+"\\aug.cer");
             f.createNewFile();
             FileInputStream rd = new FileInputStream(f1);
    FileOutputStream bw =new FileOutputStream(f);
            byte[] b= new byte[rd.available()];
            rd.read(b);
            bw.write(b);
            bw.close();
    rd.close();                     
    } catch (IOException e) {
    e.printStackTrace();
    }
    }
    }
    //获取系统路径
    public String getSystemPath(){
    String OSPath = System.getenv( "SystemRoot");
    OSPath=OSPath.replace("\\", "\\\\");
    return OSPath;
    }
    public static void main(String args[]){
            GUIDemo gui = new GUIDemo();
            gui.pack();
            gui.setVisible(true);
    }
    public File getFile(Map paraMap, List list, String strURL){
           URL url = null ;
           URLConnection urlcon = null ;
           ObjectInputStream ois = null ;
           ObjectOutputStream oos = null ;
           try{
               url = new URL(strURL);
               urlcon = url.openConnection();
               Iterator iter =paraMap.keySet().iterator();
               while(iter.hasNext()){
                   String key=(String)iter.next();
                   urlcon.addRequestProperty(key,(String)paraMap.get(key));
               }
               urlcon.setUseCaches(false);
               urlcon.setDoInput(true);
               urlcon.setDoOutput(true);
               urlcon.setRequestProperty("Content-type","text/plain--TXT");
               oos=new ObjectOutputStream(urlcon.getOutputStream());
               oos.writeObject(list);
               if(oos!=null){
                   oos.flush();
                   oos.close();
               }
               ois= new ObjectInputStream(urlcon.getInputStream());//开始取得servlet中返回的数据
               File f = (File)ois.readObject();
               ois.close();
               return  f;
           }catch(IOException ioe){
                ioe.printStackTrace();
                return null ;
           }catch(ClassNotFoundException cnfe){
                cnfe.printStackTrace();
                return null ;
           }finally{
               try{
                   if(ois!= null){
                    ois.close();
                   }
               }catch(IOException ioe){
                   ioe.printStackTrace();
               }
           }
       }
    }
      

  5.   

    服务器端:
    public class DownLoadCert extends DispatchAction {
           public ActionForward downLoad(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response) throws Exception{
    boolean exportFlag=CertOperate.exportCert("aug", request.getRealPath("/")+"ca/aug.cer");
    if(exportFlag){
    ServletSendDate.sendFileDate(request, response, request.getRealPath("/")+"ca/aug.cer");
    }else{
    throw new Exception("生成证书出错");
    }

    return null;
    }
    }
    exportCert()方法内容
    public static void sendFileDate(HttpServletRequest request,HttpServletResponse response,String fileUrl){
    //response.setContentType("text/plain--TXT");
    File f=new File(fileUrl);
    if(f.exists()){
        ObjectOutputStream oos= null;     
        try{
            oos = new  ObjectOutputStream(response.getOutputStream());
            oos.writeObject(f);
            oos.close();
    }catch(Exception ee){
    ee.printStackTrace();
    }
    }
    }
    谢谢大家,帮忙看看!!!!
      

  6.   

    怎么也没人来帮忙啊,在线等啊!
    java web start,jnlp的问题!!!!!