Logo Search packages:      
Sourcecode: jaminid version File versions  Download package

String com::prolixtech::jaminid_examples::HelloWorldServer::demultiplex ( Request  connRequest,
Response  connResponse 
) [inline]

the main function of the oracle, is to demux the request and produce an output that is relative to the request.

in this example, it is a static HTML, that is all we care about for now.

Parameters:
connRequest 
connResponse 
Returns:
the output

Reimplemented from com::prolixtech::jaminid::ContentOracle.

Definition at line 25 of file HelloWorldServer.java.

References com::prolixtech::jaminid::Request::getHeader(), com::prolixtech::jaminid::Request::getIPAddressString(), com::prolixtech::jaminid::Request::getLocation(), com::prolixtech::jaminid::Request::getParamMap(), com::prolixtech::jaminid::Request::getParamOrNull(), and com::prolixtech::jaminid::Daemon::tearDown().

                                                                          {
        if(connRequest.getParamOrNull("details")!=null){
            StringBuffer a = new StringBuffer();
            a.append("<h1>Details about your request</h1>");
            a.append("<h3>Location</h3>");
            a.append(connRequest.getLocation()); 
            a.append("<h3>Parameters</h3>");
            a.append(connRequest.getParamMap());
            a.append("<h3>Client</h3>");
            a.append("IP Address: ");
            a.append(connRequest.getIPAddressString());
            a.append("<BR>");
            a.append(connRequest.getHeader());
            
            return a.toString();
        }
        if(connRequest.getLocation().endsWith("exit")){
            System.out.println("Exiting!");
            daemon.tearDown();
        }
        
        return HELLO;
        
    }


Generated by  Doxygen 1.6.0   Back to index