Hi;
I have a question about applet-servlet communication.
I have a servlet that retries data from a database in one big fat
string. It then sends that string to the applet to be displayed.
This works fine when I send the string as a string.
It works ALMOST fine when I send string all at once as an object.
Smaller strings make it through, but larger ones ( 165kb ) don't get
sent.
I want this to work as I think that sending a string as an entire object
is quicker, am I wrong?
The error message I get is:
=============================================================================
java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTP(Compiled Code)
at sun.net.www.http.HttpClient.parseHTTP(Compiled Code)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Compiled
Code)
at HttpMessage.sendGetMessage(HttpMessage.java:37)
=============================================================================
Here is the code that sends the info from the servlet
"sSummaryStatement" is the string I retrieve from the database with the
servlet and the string that I send back to the applet:
Thanks in advance for any insights.
Steve
==========================
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
//What Do We Need To Do?
sAction = req.getParameter("Action");
if( sAction.equals("GetSumStat") == true )
{
// Get sGrantNo To Look Up A Summary Statement By
sGrantNo = req.getParameter("Grant_No");
sSummaryStatement = getSummaryStatement(sGrantNo);
//Send Summary Statement To The Applet
ObjectOutputStream out = new
ObjectOutputStream(res.getOutputStream());
out.writeObject(sSummaryStatement);
}// end if GetSumStat
=======================================
Here is the code that recieves the info in the applet:
=======================================
private String getDbDataFromServlet(Properties props)
{
String sInfoFromDbServlet = new String();
StringBuffer sbResult = new StringBuffer();
try // Getting The Servlet To Get Info For Us From The DB
{
// Make The URL To Call Up Our Servlet At
//URL url = new
URL("http://softdev.nimh.nih.gov/servlet/SummaryStatementManagerServlet");
// Create An HttpMessage Obj
HttpMessage msg = new HttpMessage(url);
//Send a GET to the servlet, passing "props" as a query string,
//Get the RESPONSE as an ObjectInputStream
InputStream in = msg.sendGetMessage(props);
ObjectInputStream result = new ObjectInputStream(in);
Object obj = result.readObject();
sInfoFromDbServlet = (String)obj;
return sInfoFromDbServlet;
}// end try
catch ( Exception e )
{
e.printStackTrace();
return " From The Applet: No Information Retrieved From The Servlet";
}// end catch
}//end function getDbDataFromServlet()
==========
Thanks in advance!
Steve
The Java Resource Dump:
http://www.geocities.com/RainForest/Canopy/4774/Java/
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html