distributed firewall using java code

Posted on 2010-01-01
Last Modified: 2012-05-08
I need java code using firewall.
Question by:sunda2010
    LVL 6

    Accepted Solution

    LVL 40

    Expert Comment

    Correct me if i am wrong, but firewall cannot be implemented in Java.

    So, not sure what you requirement is, but if you want to connect to an web-application behind a proxy firewall, then try the attached code

    URL url = null;
    	url = new URL(anyURL);
    	Properties props = System.getProperties();
    	//fetch the value of http.proxyHost
    	//from file   
    	props.put ( http.proxyHost, "" ) ; \\ipaddress of your proxy server
    	//fetch the value of http.proxyPort
    	//from file   
    	props.put ( http.proxyPort, "" ) ; \\port number of the proxy sever
    	//OPen the connection
    	URLConnection connection = url.openConnection();
    	//Setting the PROXYAUTHENTICATION property to the connection
    	connection.setRequestProperty ( "Proxy-Authorization", usernamepassword ) ;
    	connection.connect () ;
    	inputStream = connection.getInputStream () ;
    catch (ConnectException e) 

    Open in new window

    LVL 86

    Assisted Solution

    You can't implement a firewall in Java - it requires kernel level code and therefore native system calls. You might be able to use JNI or JNA, but there'd be no point
    LVL 86

    Expert Comment


    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    mergeTwo  challenge 13 55
    JVM encoding. How to change encoding. 27 55
    Fibonacci challenge 11 62
    endX challenge 2 33
    Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
    This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now