Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

URL query  RSS feed

 
Jignesh Gohel
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

Is it possible to create two differnt URL objects in a same program???.
I have made two servlets one for my user authentication & another for posting messages to the server.

And for that from my client side a standalone program made in swing i have created two URLS which i have to use it for reading an ObjectInputStream coming from authentication sevlet & write an ObjectOutputStream to posting message servlet respectively.

Both the servlets name are mapped in an web.xml file.

Now i'm able to call my authentication servlet & also i'm able to create connection with another servlet also.I'm getting the messages to be printed in authentication servlet for the verification purpose on the Apache's console but the second servlet is not printing any messages i have added to its code for the verification purpose on the server's console

So please tell me what could be wrong in my code.

Thanking you,
Jignesh
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jignesh Gohel:
hello,
So please tell me what could be wrong in my code.


What code?
 
Jignesh Gohel
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello sir,

This is the code for my Client-side :

Client.java



Now i've created two URLs to communicate with as mentioned previously.

The code for both the servlets are as follows

LoginServlet.java(the authentication servlet)




The code for second servlet MainServlet.java((the message posting servlet) is as follows:



The problem is that MainServlet.java is nothing shoewing on the server's console although from the Client.java every stmt is executing successfully.

Please reply

Thanking you,
Jignesh
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you're only reading one byte.


I think you'll want to perform the read from within a loop.
Something like:

 
Jignesh Gohel
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply sir once again.

Its not working .I'm not even able to get into the doPost() & print " Inside doPost".

On the coomand propmt from where i'm running my standlone application there i'm able to get every message ie

successfully connected
Inside connect method
Thread created
Inside run()
Name: java
Inside sendClientLogin()
Inside sendMessageToServer()
After sending message to the server


AND on the server console only LoginServlet's message are being printed.

Sir what might be wrong within the code & how to approach now.
Please help me sort out this problem.

Thanking you,
Jignesh
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!