Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to implement java.net API for disabling network connection  RSS feed

 
manisha veeranki
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to make a social network control system as a web application. I want to block certain sites from free access to it. I would like to know how can i implement java.net API to disable the connection. If there are some other ways with which i can get my idea working please suggest. Thank you.
 
Claude Moore
Ranch Hand
Posts: 862
8
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In other words, you want to implement a proxy server with content filtering features, right? Looks like a quite complex task to start from scratch. Did you evaluate any opensourced project to start from?
 
A.J. Côté
Ranch Hand
Posts: 417
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Claude Moore wrote:In other words, you want to implement a proxy server with content filtering features, right? Looks like a quite complex task to start from scratch. Did you evaluate any opensourced project to start from?


I agree, simple IP tables or other flavor of host firewall rules should do the trick and insure the web server doesn't get hit unnecessarily.

Nevertheless, it possible to maintain a database of blocked IP addresses, user agents, etc. at the application level. The source IP address and all headers should be available through the javax.servlet.http.HttpServletRequest
 
A.J. Côté
Ranch Hand
Posts: 417
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A.J. Côté wrote:
Claude Moore wrote:In other words, you want to implement a proxy server with content filtering features, right? Looks like a quite complex task to start from scratch. Did you evaluate any opensourced project to start from?


I agree, simple IP tables or other flavor of host firewall rules should do the trick and insure the web server doesn't get hit unnecessarily.

Nevertheless, it possible to maintain a database of blocked IP addresses, user agents, etc. at the application level. The source IP address and all headers should be available through the javax.servlet.http.HttpServletRequest


More: You would use a javax.servlet.Filter and analyze the values from the javax.servlet.http.HttpServletRequest and take appropriate action in the doFilter(ServletRequest request, ServletResponse response, FilterChain chain) method

I have actually done this to maintain a white list because it was too complicated to have every member host modify their firewall rules.
 
Claude Moore
Ranch Hand
Posts: 862
8
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A.J. Côté wrote:

More: You would use a javax.servlet.Filter and analyze the values from the javax.servlet.http.HttpServletRequest and take appropriate action in the doFilter(ServletRequest request, ServletResponse response, FilterChain chain) method

I have actually done this to maintain a white list because it was too complicated to have every member host modify their firewall rules.


That's ok, but to make the whole thing working you need nevertheless to configure each host to use your application as proxy - otherwise, each host would navigate free. Besides this, I usually wonder why one should code by hand a proxy when is by far easier to get an open source proxy, configurate and work with it, except of course when you want doing some experience with networking or experiment Java or other languages.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!