使用Java阻止某个网站 [英] Block a certain website using Java

查看:95
本文介绍了使用Java阻止某个网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨团队!



我正在开展一个小型(我希望如此)的项目,我正处于一个非常开始的状态。我已经google了,仍然无法开始。让我解释一下我的想法。首先,我在JTextField中输入网站的地址(比如codeproject.com)。然后在点击JButton(比如说Block)之后,我无法使用互联网浏览器打开该网站(实际上是firefox)。但是在击中另一个JButton(比如Unblock)后,我通常可以访问该网站。我刚才知道使用java很难做到这一点。使用C ++可能是更好的选择。我的系统是Windows 7,我的项目似乎是一个过滤器。假设您有一个黑名单,不希望从该列表中访问任何网站。



任何建议都将不胜感激!



提前致谢!

Hi team!

I'm working on a small (i hope so) project and I'm in a very begginning. I've googled around and still couldn't get started. Let me explain my idea. First I type a website's address (let say codeproject.com) in a JTextField. Then after hitting on a JButton (let say Block), I can't open that site using internet browser (firefox actually). But after hitting another JButton (let say Unblock), I can normally access the website. I've just known that it's difficult to do this using java. Using C++ is maybe a better choice. My system is windows 7 and my project seems to be a filter. Let say you have a black list and don't want any access to websites from that list.

Any advice would be appreciated!

Thanks in advance!

推荐答案

1。在WindowsXP和向上,实现您想要的一个非常简单的方法是将条目添加到您的hosts文件,以将某些域名指向localhost。请参阅此处: http://answers.yahoo.com/question/index?qid=20080120053857AAqCQgE [< a href =http://answers.yahoo.com/question/index?qid=20080120053857AAqCQgEtarget =_ blanktitle =New Window> ^ ]。

那里无需重新启动,因为从Windows9x向上更改是立即的。因为我已经读过IE缓存名称查找的地方,所以重新启动IE可能是必要的。

请记住,他会阻止整个域名。不可能仅阻止该域下的某些应用程序或网站。



2.在您的计算机上使用代理,最好是用Java编写的代理。您可以轻松地进行一些修改,以便它可以对从您的应用程序发送的消息做出反应,以阻止或取消阻止某个URL。这里有一个很好的开源代码列表,都是用Java编写的: http://proxies.xhaus.com/java/ [ ^ ]



问候,



Manfred
1. On WindowsXP and upward one very easy way to achieve what you want would be to add entries to your hosts file to point certain domain names to localhost. See here: http://answers.yahoo.com/question/index?qid=20080120053857AAqCQgE[^].
There is no need to reboot since upward from Windows9x the changes are immediate. It might be nescessary to resart IE since I've read somewhere that IE caches name lookups.
Remember though that his will block the whole domain. It is not possible to only block certain applications or websites that live under that domain.

2. Use a proxy on your machine and preferably one written in Java. You can easily make some modifications so it can react to messages sent from your application to block or unblock a certain URL. Here a nice list of Open Source Proxies that are all written in Java: http://proxies.xhaus.com/java/[^]

Regards,

Manfred


这篇关于使用Java阻止某个网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆