当前位置: 技术问答>java相关
谁知道怎么做到跟远程的网页同步的问题
来源: 互联网 发布时间:2015-10-02
本文导语: 初步的想法用applet将本地的网页连接发到远程主机, 但不知道技术上是否可行? 具体怎么操作 | 向bdsc()学习! | 去www.java.com上翻翻 | 而远程的程序怎样控...
初步的想法用applet将本地的网页连接发到远程主机,
但不知道技术上是否可行?
具体怎么操作
但不知道技术上是否可行?
具体怎么操作
|
向bdsc()学习!
|
去www.java.com上翻翻
|
而远程的程序怎样控制其ie 同样打开一个这样的连接。
Runtime.getRuntime().exec("IEXPLORE.EXE " + url);
传送可以用socket直接传文本, 如果远端是web可以用http
Runtime.getRuntime().exec("IEXPLORE.EXE " + url);
传送可以用socket直接传文本, 如果远端是web可以用http
|
1.用frame, 应该有windows.frame.location吧(我不知道你自己试)
2.自己写个jni程序吧
2.自己写个jni程序吧
|
可行,不过会有安全限制,很麻烦的。
|
你的初步想发就会受到安全限制。
applet不能访问除自身以外的服务器。
除非用自身的代理。
感觉用applet来做真的很麻烦。
applet不能访问除自身以外的服务器。
除非用自身的代理。
感觉用applet来做真的很麻烦。
|
能不能把问题具体描述一下,远程的网页中需要同步的是一部分数据还是所有的数据?如果是一部分数据,你试试下面的行不行:
需要同步的数据做在Applet里,做成多线程的,走http协议跟服务器上servlet连接,这样就没什么安全限制了,我知道申银万国的股票实时分析图就是这样做的。
需要同步的数据做在Applet里,做成多线程的,走http协议跟服务器上servlet连接,这样就没什么安全限制了,我知道申银万国的股票实时分析图就是这样做的。
|
document.write("");
document.write("");
import javax.swing.*;
import java.awt.*;
public class test extends JApplet {
public test() {
getRootPane().putClientProperty("defeatSystemEventQueueCheck",
Boolean.TRUE);
}
public void init() {
String strL = getParameter("url");
JLabel label = new JLabel(
"You are successfully running a Swing applet!" +
strL);
label.setHorizontalAlignment(JLabel.CENTER);
label.setBorder(BorderFactory.createMatteBorder(1,1,2,2,Color.black));
getContentPane().add(label, BorderLayout.CENTER);
}
}
|
applet不允许你做这些的,
As the applet overview lesson mentioned, existing applet viewers (including Web browsers) impose the following restrictions:
Applets cannot load libraries or define native methods.
Applets can use only their own Java code and the Java API the applet viewer provides. At a minimum, each applet viewer must provide access to the API defined in the java.* packages.
An applet cannot ordinarily read or write files on the host that is executing it.
The JDK Applet Viewer actually permits some user-specified exceptions to this rule, but Netscape Navigator 2.0, for example, does not. Applets in any applet viewer can read files specified with full URLs, instead of by a filename. A workaround for not being to write files is to have the applet forward data to an application on the host the applet came from. This application can write the data files on its own host. See Working with a Server-Side Application for more examples.
An applet cannot make network connections except to the host that it came from.
The workaround for this restriction is to have the applet work with an application on the host it came from. The application can make its own connections anywhere on the network. See Using a Server to Work Around Security Restrictions for an example.
An applet cannot start any program on the host that is executing it.
Again, an applet can work with a server-side application instead.
An applet cannot read certain system properties.
See Reading System Properties for more information.
As the applet overview lesson mentioned, existing applet viewers (including Web browsers) impose the following restrictions:
Applets cannot load libraries or define native methods.
Applets can use only their own Java code and the Java API the applet viewer provides. At a minimum, each applet viewer must provide access to the API defined in the java.* packages.
An applet cannot ordinarily read or write files on the host that is executing it.
The JDK Applet Viewer actually permits some user-specified exceptions to this rule, but Netscape Navigator 2.0, for example, does not. Applets in any applet viewer can read files specified with full URLs, instead of by a filename. A workaround for not being to write files is to have the applet forward data to an application on the host the applet came from. This application can write the data files on its own host. See Working with a Server-Side Application for more examples.
An applet cannot make network connections except to the host that it came from.
The workaround for this restriction is to have the applet work with an application on the host it came from. The application can make its own connections anywhere on the network. See Using a Server to Work Around Security Restrictions for an example.
An applet cannot start any program on the host that is executing it.
Again, an applet can work with a server-side application instead.
An applet cannot read certain system properties.
See Reading System Properties for more information.
|
有一个问题: 客户端连接是以socket打开的,那没有什么难题:socket+线程就可以了。但通信数据怎么解决?如果不是socket打开的时候有什么要求?
我觉得楼主没有把问题说明清楚。
我觉得楼主没有把问题说明清楚。
|
这个有很多种方法,不知道你服务器是什么操作系统,不知道你会不会别的语言?如果是Linux这种,可以用java编写一个服务器程序,在那运行,如果权限有限可以用servlet,象servlet也要以运行的象applacation一样。
|
用远程脚本。
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。