RTFEditorKit rtfEditor = new RTFEditorKit(); rtfEditor.write(connect.getOutputStream(),doc, 0, doc.getLength());
********************サーブレット側*********************
ServletContext application = this.getServletContext(); StyleContext sc = new StyleContext(); DefaultStyledDocument doc = new DefaultStyledDocument(sc);
ServletInputStream input = request.getInputStream(); RTFEditorKit rtfEditor = new RTFEditorKit(); FileOutputStream out = new FileOutputStream(application.getRealPath("/WEB-INF/test.rtf"));
ServletContext application = this.getServletContext();
StyleContext sc = new StyleContext();
DefaultStyledDocument doc = new DefaultStyledDocument(sc);
ByteArrayInputStream input = new ByteArrayInputStream(msg.getBytes());
RTFEditorKit rtfEditor = new RTFEditorKit();
FileOutputStream out = new FileOutputStream(application
.getRealPath("/WEB-INF/test.rtf"));
java.security.AccessControlException: access denied (java.net.SocketPermission localhost:8080 connect,resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at client.RTFDocumentServerClientApplet.init(RTFDocumentServerClientApplet.java:53)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
/**
* Servlet implementation class for Servlet: TestRTFServlet
*
*/
public class TestRTFServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
static final long serialVersionUID = 1L;
byte text[] = new byte[list.size()];
Iterator<Byte> iterator = list.iterator();
int i=0;
while(iterator.hasNext()){
text[i++]=(Byte)iterator.next();
}
ByteArrayInputStream in = new ByteArrayInputStream(text);
RTFEditorKit rtfEditor = new RTFEditorKit();
FileOutputStream out = new FileOutputStream(application.getRealPath("/WEB-INF/test.rtf"));