Alexander Hakim

Greenhorn
+ Follow
since Oct 04, 2014
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alexander Hakim

Hi Ulf;

Seems it is working now, i am able to compare the two string files (the string from the text file and the client request string that i declared as above 'command') with simple java code .contains, using this am able to refuse if the request contains bad word.

thanks
Okay;

What if i store the list of undesirable words in variables inside the code? Do you think i need to change my code from handling text to handling binary data? Can you give me a sample code of doing this please, or reading materials?

thanks
Hello Ulf;

Thanks for your attention toward my problem;

Below is my code, i have text file called test.txt that i used to store the restricted URL texts and i write the code below to read from the text file, now i am expected to compare the request from the client with the text in my text file. how can i compare two BufferedReaders? One buffereReader for the client request and one buffereReader for the text file.

Thanks for your help;

The reason why i want to write it my self is because i have a small project in my Networking course and i am required to develop my own web proxy server that blocks undesirable web address.

I would appreciate if i can see the implementation(coding) part of what you tried to explain above.

Thanks again for your help;
Sorry, i think i got your point now:

I am not looking for already built in software like what you mentioned "Muffin" or others like "Net Nanny". The thing is i want to write my own solution to restrict access to Web content, and i want to develop web proxy server using Java.
My dear;

I don't know if my English is not clear, may be because it is my second language. What i want is, there is a web proxy server java code which i posted it above, i want to modify it with the above features i listed. And i am looking for a help so that the above code will fulfill my requirements.

I hope now you understand my point:

Thanks/
Yes i am discussing about an existing topic. You can look at the previous topic "Proxy Server in Java", Topic Starter "omkar patkar". I also post my question there but i didn't get a reply. I don't have any special reason to start my discussion as a new topic, if it is wrong, am sorry for that. Now let us refer to our previous topic "Proxy Server in Java", and lets discuss about my question there.

Sorry for the wrong thing i did

Thanks;
I am new to this forum, I have only one account which is i am using now. And this is my account which i will use going forward.

I have a task to solve about "Web proxy server using Java", I was searching and reading in the internet and i found this forum interesting and i crate a profile today to keep discussing with professionals.

The reason i start the discussion from scratch is because i though it is a different scope from what other people had been discussing in the previous topic, so that i can clearly understand the solution for my questions. If you

think this is wrong, we can keep discussing in the existing proxy topic like Muffin.


thank you for help;
Hello Ulf Dittmer;

Actually I did also put my question in the already started profile by omkar patkar about proxy server. I am sorry not to put the code in the "code" tag,

Looking for the help;

Thanks;
Hello everyone:

For our previous topic about "Proxy Server in Java" I want to add the following futurities

The web proxy server to filters out and blocks requests for undesirable URLs, using HTTP redirection to display an error page.

I want the user to select the proxy port (i.e. the port number should not be hard coded)

The proxy should be smart in selection of what HTTP content should be searched for the forbidden keywords. For example, you probably agree that it is not wise to search inside compressed or other non-text-based HTTP content such as graphic files, etc.

Also i want to make sure it is compatible with all major browsers (e.g. Internet Explorer, Mozilla Firefox, Google Chrome, etc.)

Here is the code;


package ProxyServer;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class MyProxyServer
{

public static final int portNumber = 8888;

public static void main(String[] args)
{
MyProxyServer myProxyServer = new MyProxyServer();
myProxyServer.start();
}
public void start()
{
System.out.println("Starting the MyProxyServer ...");
try
{

ServerSocket serverSocket = new ServerSocket(MyProxyServer.portNumber,1);

/*File file = new File("test.txt");
FileOutputStream fileOutputStream = new FileOutputStream(file);

PrintStream printStream = new PrintStream(fileOutputStream);*/

while(true)
{
System.out.println("Inside while loop ");
Socket clientSocket = serverSocket.accept();
System.out.println("Connection to MyProxyServer is "+clientSocket.isConnected());

InputStreamReader inputStreamReader = new InputStreamReader(clientSocket.getInputStream());

BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String command = bufferedReader.readLine();


//printStream.print(command);

//bufferedReader.close();
System.out.println("Client has asked to ....\n"+command);

if(command.equals("Cancel"))
{
System.out.println("Shutting down the server ...");
break;
}

// iterate over all the lines following the GET/POST request
String meta = null;
while((meta = bufferedReader.readLine()).length() > 0)
{
System.out.println(meta);
}
bufferedReader.close();
/*printStream.close();
fileOutputStream.close();*/
}



} catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}



With my best regards;
Hello every one;

Can we modify the above web proxy server to Block requests for undesirable URLs, using HTTP redirection to display an error page. How can we do that?

Regards/