Note that there are some explanatory texts on larger screens.

plurals
  1. POHTTP POST not working.Getting Not Found error
    primarykey
    data
    text
    <p>I am trying to Post a .txt file to a local tomcat webserver that i have on my system. But when i try to do a post then i get a Error: Not Found. The source file is present but even after that i get this error. Can you please let me know what i am doing wrong here. i have pasted my code below.</p> <pre><code> File file = new File("C:\\xyz\\test.txt"); URL url = new URL("http://localhost:8080/process/files"); urlconnection = (HttpURLConnection) url.openConnection(); urlconnection.setDoOutput(true); urlconnection.setDoInput(true); urlconnection.setRequestMethod("POST"); BufferedOutputStream bos = new BufferedOutputStream(urlconnection.getOutputStream()); BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); int i; // read byte by byte until end of stream while ((i = bis.read()) &gt;0) { bos.write(i); } bos.close(); System.out.println(((HttpURLConnection)urlconnection).getResponseMessage()); } catch(Exception ae) { ae.printStackTrace(); } try { InputStream inputStream; int responseCode=((HttpURLConnection)urlconnection).getResponseCode(); if ((responseCode&gt;= 200) &amp;&amp;(responseCode&lt;=202) ) { inputStream = ((HttpURLConnection)urlconnection).getInputStream(); int j; while ((j = inputStream.read()) &gt;0) { System.out.println("------ TESTING ------"); } } else { inputStream = ((HttpURLConnection)urlconnection).getErrorStream(); } ((HttpURLConnection)urlconnection).disconnect(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } </code></pre> <p>Can you please let me know what is going wrong here. I am scratching my head on this for a long time now.</p> <p>Thanks Vikeng</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload