Hi all,
I am trying out applet servlet communication and the applet is invoking the 
servlet but the responcse i get is a IO exception
anonymous wrote : Server returned HTTP response code: 405 for 
URL:http://localhost:8080/applet/servlet/DaytimeServlet. 
Here is my servlet code

public class DayTimeServlet extends HttpServlet {
  | 
  |     public DayTimeServlet() {
  |             super();
  |             // TODO Auto-generated constructor stub
  |     }
  | 
  |     
  |     public Date getDate(){
  |             return new Date();
  |     }
  |     
  |     
  |     protected void doGet(HttpServletRequest req, HttpServletResponse resp)
  |             throws ServletException,
  |             IOException {
  |             super.doGet(req, resp);
  |             System.out.println("doGet called with date-->" + 
getDate().toString());
  |             resp.setContentType("text/plain");
  |             PrintWriter out = resp.getWriter();
  |             out.println(getDate().toString());
  | 
  |             //out.flush();
  |             //out.close();
  |     }
  | 
  |     protected void doPost(
  |             HttpServletRequest request,
  |             HttpServletResponse response) throws ServletException, 
IOException {
  |             // TODO Auto-generated method stub
  |             System.out.println("doPost called");
  |             doGet(request,response);
  |             
  |     }
  | 
  | }

and here is the piece of code that connects to the se4rvlet from the applet

  |  public InputStream sendGetMessage(Properties args) throws IOException {
  |              
  |                 String argString = "";  // default
  | 
  |                 if (args != null) {
  |                   argString = "?" + toEncodedString(args);
  |                 }
  |                 URL url = new URL(servlet.toExternalForm() + argString); 
  | 
  |                 // Turn off caching
  |                 URLConnection con = url.openConnection();
  |                 con.setUseCaches(false);
  |                 con.connect();
  |                InputStream in = con.getInputStream();
  |                if(in == null)
  |                             JOptionPane.showMessageDialog(null,"Inputstream 
is null");
  |                 return in;
  |               }
  |      
This method throws an IOException...
Thanks for all the help in advance
jubs


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3907150#3907150

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3907150


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to