Results 1 to 13 of 13
  1. #1
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default [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..

  2. #2
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Plz help me for solve the problme

  3. #3
    vglass is offline Member
    Join Date
    Jul 2007
    Posts
    14
    Rep Power
    0

    Default

    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
    }

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    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.

  5. #5
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    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

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Add a menu item on your GUI menu. After that add an action listener to that menu item and call your method there.

  7. #7
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    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..

    Java 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
    Java Code:
    
    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....

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    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.

  9. #9
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    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

  10. #10
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    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

  11. #11
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Mir View Post
    Plz help me sir.....plz
    Thxs for help....

  12. #12
    h3ckf1r3 is offline Member
    Join Date
    Jun 2008
    Posts
    11
    Rep Power
    0

    Default

    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

  13. #13
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by h3ckf1r3 View Post
    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.....

Similar Threads

  1. Code to connect to a web site
    By suji in forum Networking
    Replies: 1
    Last Post: 02-15-2008, 05:05 PM
  2. Site hacked
    By tim in forum Suggestions & Feedback
    Replies: 3
    Last Post: 02-02-2008, 10:47 AM
  3. How can I get a RealMedia file from a web site?
    By emesol0 in forum Networking
    Replies: 0
    Last Post: 01-24-2008, 08:01 PM
  4. Printing all IP address of a site
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-24-2007, 08:38 PM
  5. Non Blocking Network
    By mathias in forum Networking
    Replies: 1
    Last Post: 08-07-2007, 07:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •