|
|
Welcome to the Java Forums.
You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:
- have access to post topics
- communicate privately with other members (PM)
- not see advertisements between posts
- have the possibility to earn one of our surprises if you are an active member
- access many other special features that will be introduced later.
Registration is fast, simple and absolutely free so please, join our community today!
If you have any problems with the registration process or your account login, please contact us.
|
|

06-05-2008, 03:28 PM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
|
[SOLVED] Site Blocking
Hello Sir
i have Http proxy server code,which is runing good.All "HTTP" open under the proxy server.But I want to block some site.I don't know technique of blocking.Plz give me example link or code or tips...
Plz help me
Thxs in Advance..
|
|

06-06-2008, 07:04 AM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
|
Plz help me for solve the problme
|
|

06-11-2008, 12:08 AM
|
|
Member
|
|
Join Date: Jul 2007
Posts: 14
|
|
|
Normally to block a site you just need to know the URL to block, typically the hostname. Using java.net.URL class you can check the domain used for a URL.
e.g.
URL url = new URL(address);
String host = url.getHost();
if(host.equals(blockedDoman) {
// perform deny code here
}
|
|

06-11-2008, 04:38 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,036
|
|
|
Mir, as I said one of the earlier thread, first you should have the list of sites which you want to block. Then implement a access denied method on such.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. (Close on September 4, 2008)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

06-11-2008, 10:05 AM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by Eranga
Mir, as I said one of the earlier thread, first you should have the list of sites which you want to block. Then implement a access denied method on such.
Thxs for help me
Now I am abel to block the site from list. But problem is that i want to do this action through menuitem...
So how can i do this
|
|

06-11-2008, 10:07 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,036
|
|
|
Add a menu item on your GUI menu. After that add an action listener to that menu item and call your method there.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. (Close on September 4, 2008)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

06-11-2008, 10:16 AM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by Eranga
Add a menu item on your GUI menu. After that add an action listener to that menu item and call your method there.
I add GUI menu...ok i am sending you menu code..
if (evt.target instanceof Button)
{
if(evt.target == button) {
hide();
dispose();
return true;
}
else if(evt.target == site) {
ArrayList <String> asq;
px= new Proxy("");
asq=px.GetSite();
String a3=px.geUrlStr();
String un;
for(int j=0;j<asq.size();j++)
{
un=asq.get(j);
if(a3.contains(un))
{
JOptionPane.showMessageDialog(null," In");
}
else
{
JOptionPane.showMessageDialog(null," out");
}
}
this is not working but same code is here which is working proxy class
for(int j=0;j<ArTemp.size();j++)
{
nu=ArTemp.get(j);
if(un.contains(nu))
{
JOptionPane.showMessageDialog(null," In");
return; // Here is difference
}
else
{
JOptionPane.showMessageDialog(null,"out");
}
}
In This code i mark "return" which is blocking site to go next part. In the menuitem code "return " is not working..
Plz help me....
|
|

06-11-2008, 10:42 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,036
|
|
|
In simple word what you have to do is, make a list with blocking URL. Every time a user entered a URL compared it with the list. If you found such a thing in the list, block the whole process.
I can't see in your code have tried such a thing.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. (Close on September 4, 2008)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

06-11-2008, 10:49 AM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by Eranga
In simple word what you have to do is, make a list with blocking URL. Every time a user entered a URL compared it with the list. If you found such a thing in the list, block the whole process.
I can't see in your code have tried such a thing.
Sir ,not blocking whole process.It is blocking only those url which is found in list.
Yes is compared each time with new url and list of url.
Plz help me
|
|

06-11-2008, 11:16 AM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by Eranga
In simple word what you have to do is, make a list with blocking URL. Every time a user entered a URL compared it with the list. If you found such a thing in the list, block the whole process.
I can't see in your code have tried such a thing.
Plz help me sir.....plz
|
|

06-23-2008, 07:56 AM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by Mir
Plz help me sir.....plz
Thxs for help....
|
|

07-02-2008, 06:59 PM
|
|
Member
|
|
Join Date: Jun 2008
Posts: 7
|
|
|
dude reposting a milion times wont help you. you have to search on google. read other threads and see if they help. Also a really good program will take things and put them together to make what you want happen
|
|

07-03-2008, 07:04 AM
|
|
Senior Member
|
|
Join Date: Mar 2008
Posts: 447
|
|
Originally Posted by h3ckf1r3
dude reposting a milion times wont help you. you have to search on google. read other threads and see if they help. Also a really good program will take things and put them together to make what you want happen
ok h3ckf1r3
i got your point.....
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|