Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

suggestions required to block certain sites  RSS feed

 
somashaker goud
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to block particular sites to view only one hour in day using java.

As per my understanding trigger a demon thread which should block requested site but I didn't find info to block site(url) using java.

Only suggestions are expected no need of code (since I want to make my hands dirty )
 
Paul Clapham
Sheriff
Posts: 22203
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Who told you that a "demon thread" was a useful idea to do that? I'm not surprised you didn't find any related information.

But let's go back a bit and clarify your requirement before looking for better ideas. First of all, who do you propose to block? And what do you propose to block them from? I ask because there are several interpretations of what you posted. For example you might want to block only me from viewing Google and Wikipedia and my public library except between 10 and 11 pm each day. Or you might have a web site and you want to block everybody from viewing it except between 10 and 11 pm each day.

Or you might have a different definition for "only one hour in day" instead of the one I used there, although that's probably going to be less important in choosing a technology for implementing this blocking thing.

So please post again with a more detailed description of your requirements; it's not a good idea to decide on a solution if you don't understand the requirements, and we certainly can't understand the requirements from your brief description. And if you have a link to a site which recommends a "demon thread", that would be interesting to see too.
 
somashaker goud
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul for replying.

When coming to my requirements , I want to block social media sites like facebook and twitter from 10AM to 11 AM everyday and the reason for going by demon thread is , I want to start some process and leave it aside so that it it will run forever at background and try to block those sites for specific period of time.
 
Junilu Lacar
Sheriff
Posts: 10884
158
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is your intent to block access to those sites from your location? Or is it the other way around, that somehow, sites like facebook and twitter are making requests to your site and you want to block those?
 
Paul Clapham
Sheriff
Posts: 22203
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One other thing... You posted this question under "Servlets" which suggests that you want to do something which can be installed in your web site. That also suggests that you aren't just talking about something to prevent somebody from using their browser to connect to Facebook. Which it seems like you might be asking for that.

But maybe you didn't mean that when you chose the Servlets forum?
 
Paul Clapham
Sheriff
Posts: 22203
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
somashaker goud wrote:... and the reason for going by demon thread is , I want to start some process and leave it aside so that it it will run forever at background...


It's easy to start a process and let it run forever; just code it so that it never terminates. Daemon threads are unnecessary if that's your goal.
 
Tim Moores
Saloon Keeper
Posts: 3564
77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This doesn't sound like something Java would play a role in - rather like something you would configure at the router or firewall level.

There will be ways around it using a VPN, so I won't comment on the efficacy of what you propose.
 
somashaker goud
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@junulu - I want block them fro my location

@Tim- what you said is right(it canbe done using firewall) but i wanted to know cant it be done using java
 
Tim Moores
Saloon Keeper
Posts: 3564
77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are various ways to accomplish this, and with some of them it's possible to use Java for at least part of the solution. Unfortunately, those will be the ones more easily circumvented. So I think you will be better off doing it the easy way without Java :-)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!