Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

An application talking to a Servlet... problem!

 
Vanchi Nathan
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

Spec..:
currently i have an Java application trying to send a String data to a Servlet that must receive and save it as a file in the server side. The problem is there occurs an Server 500 error..



Can anyone figure why this comes... My application code is as follows:
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It could be this line:

When doing a URLConnection you should NEVER close a stream until the response has been read. Use flush() to make sure the request is sent. The reason being that close() causes the socket to be closed.
Bill
 
Vanchi Nathan
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello William,

Thanks for the response....very

My servlet is a simple one and it works when i invoke by a browser...(codes below):

...the problem is with the code in the following java application...(codes below):

The error i get is as follows:


I don't know why the application is not served by the doGet method instead it tell "Unknown Source"...

pl. help...
 
Vanchi Nathan
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correction please..What i stated..
I don't know why the application is not served by the doGet method instead it tell "Unknown Source"...

actually not with doGet method but by doPostmethod..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic