java - Standard Input/Output ignoring content -
i have writtten code accepts user input console , stores file on desktop. works fine when run program on ide. run on network (xinetd exact) when enter "localhost" on browser, xinetd redirects std input/output displayed on browser. in case, user input entered via console displayed on browser: here code:
public static void main(string[] args) throws ioexception { arraylist<string> output = new arraylist<>(); try (bufferedwriter bw = new bufferedwriter(new filewriter(new file("c:\\users\\anthony\\desktop\\out.txt"))); bufferedreader br = new bufferedreader(new inputstreamreader(system.in))){ system.out.println("enter text"); for(string in=br.readline(); !in.equals(""); in=br.readline()){ bw.write(in); output.add(in); } system.out.println(output); } system.out.println("zugriff aufgezeichnet"); }
when run on network: 1) i'm prompted enter text browser not wait input , gives out general http get-request message this:
enter text [get / http/1.1, host: localhost, user-agent:mozilla/5.0 (x11; ubuntu; linux x86_64; rv:41.0) gecko/20100101 firefox/41.0, accept:text/html,application/xhtml+xml, application/xml;q=0.9,*/*;q=0.8, accept-language: en-us,en;q=0.5, accept-encoding:gzip, deflate, connection:keep-alive cache-control:max-age=0] zugriff aufgezeichnet
this shows html request being saved arraylist , nothing else (since did not chance input console). chance enter console before outputted. after "enter text", await user input.
Comments
Post a Comment