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
Server returned HTTP response code: 405 for URL:http://localhost:8080/applet/servlet/DaytimeServlet.
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); } }
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; }