Re: [Simpleweb-Support] Simpleweb Shutting Down Connection Unexpecteadly During HTTP POST
Brought to you by:
niallg
From: Niall G. <gal...@ya...> - 2008-09-18 16:55:39
|
Hi, How do you create the WebServerThread? Also, is it possible to send some code to demonstrate this. I will take a look. I have tested with pretty large files and never seen a problem. Also, what are the JVM arguments you use? Thanks, Niall --- On Thu, 9/18/08, nik...@go... <nik...@go...> wrote: > From: nik...@go... <nik...@go...> > Subject: [Simpleweb-Support] Simpleweb Shutting Down Connection Unexpecteadly During HTTP POST > To: sim...@li... > Date: Thursday, September 18, 2008, 4:45 PM > Hi, > > I am trying to do a HTTP-POST while attaching a file and > sending it to > an instance of the simpleweb server. Everything works fine > as long as > the attached file is not very large (2k is okay for > example) but as > soon as I am dealing with larger files (4MB) simpleweb > unexpecteadly > shuts down the connection without reading the whole file. > > This is how my client (apache httpclient 3.1) looks like: > > > === client === > > HttpClient client = new HttpClient(); > PostMethod httppost = new > PostMethod("http://localhost:8080/aaa"); > File f = new File("D:/largefile"); > BufferedReader inputStream = null; > > try { > Part[] parts = {new FilePart(f.getName(), > f)}; > httppost.setRequestEntity(new > MultipartRequestEntity(parts, httppost.getParams())); > > client.executeMethod(httppost); > > if (httppost.getStatusCode() == > HttpStatus.SC_OK) { > InputStream in = > httppost.getResponseBodyAsStream(); > inputStream = new > BufferedReader(new InputStreamReader(in)); > String line; > while ((line = inputStream.readLine()) > != null) { > System.out.println(line); > } > } else { > System.out.println("Unexpected > failure: " + httppost.getStatusLine().toString()); > } > } catch (FileNotFoundException e) { > ... > > === end client === > > The client never gets past the executeMethod since while > executing the > method the server disconnects. > > And this is how the (very simple) server looks like: > > === server === > > public static void server() throws Exception { > Container container = new > WebserverThread(); > Connection connection = new > SocketConnection(container); > SocketAddress address = new > InetSocketAddress(8080); > > connection.connect(address); > > } > > public void handle(Request request, Response > response) { > > ... > > } > > === end server === > > The actual handle method is never invoked because the > webserver just > closes the connection as described before. I've also > tried out a HTTP > PUT with similar problems. > > Any clue what I am doing wrong here? > > > Thanks in advance > > nik39 > > > -- > Best regards, > nik.thirtynine > mailto:nik.thirtynine > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK > & win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support |