я пытаюсь вызвать сервлет из апплета ниже, это код вызова
ObjectOutputStream outputToServlet = null;
try {
//String xmlToSign = this.getParameter("xmltosign");
String xmlToSign ="<?xml version=\"1.0\" encoding=\"UTF-8\"?> <root> <name> hello world</name></root> ";
URL signServlet = new URL("http://localhost:8084/SignXMLDemo/mtservlet");
URLConnection servletConnection = signServlet.openConnection();
servletConnection.setDoInput(false);
servletConnection.setDoOutput(true);
servletConnection.setUseCaches(false);
servletConnection.setDefaultUseCaches(false);
servletConnection.setRequestProperty("Content-Type", "application/octet-stream");
outputToServlet = new ObjectOutputStream(servletConnection.getOutputStream());
String encodedValue = new BASE64Encoder().encode(xmlToSign.getBytes());
outputToServlet.writeObject(encodedValue);
outputToServlet.flush();
outputToServlet.close();
JOptionPane.showMessageDialog(this, "XML successfully signed and sent to server.");
} catch (Exception ex) {
JOptionPane.showMessageDialog(this, ex.getMessage());
} finally {
try {
outputToServlet.close();
} catch (IOException ex) {
Logger.getLogger(SignApplet.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
проблема с кодом заключается в том, что сервлет не вызывается, может ли кто-нибудь помочь в этом, чего мне не хватает в коде,URL-адрес правильный, так как он может быть вызван из браузера, который я использую, т. Е. 9 машин Windows 7.
Абдул Халик