如何将文件从小程序发送到gwt服务器?

如何将文件从小程序发送到gwt服务器?,gwt,servlets,file-upload,applet,gwt-rpc,Gwt,Servlets,File Upload,Applet,Gwt Rpc,我正在尝试将一个文件从小程序发送到我的服务器GWT。在另一个应用程序JSF中,我将使用servlet打开一个HTTP连接 如何使whit成为GWT服务器?我试图在web.xml中插入servlet,但它似乎被忽略了 我需要使用远程服务吗?我该怎么办 下面是web.xml中applet和servlet映射的代码 URL urlDoServlet = new URL("http://192.168.3.100:8080/gwtapp/conection?action=send"); Http

我正在尝试将一个文件从小程序发送到我的服务器GWT。在另一个应用程序JSF中,我将使用servlet打开一个HTTP连接

如何使whit成为GWT服务器?我试图在web.xml中插入servlet,但它似乎被忽略了

我需要使用远程服务吗?我该怎么办

下面是web.xml中applet和servlet映射的代码

URL urlDoServlet = new URL("http://192.168.3.100:8080/gwtapp/conection?action=send");    
HttpURLConnection conexaoComServlet = (HttpURLConnection) urlDoServlet.openConnection();    

conexaoComServlet.setDoOutput(true);
conexaoComServlet.setDoInput(true);
conexaoComServlet.setUseCaches(false);
conexaoComServlet.setDefaultUseCaches(false);

File doc = new File(file);
conexaoComServlet.setRequestMethod("POST");
conexaoComServlet.setRequestProperty("Content-Type", "application/octet-stream");
FileInputStream fis = new FileInputStream(doc);
BufferedInputStream bis = new BufferedInputStream(fis);

BufferedOutputStream bos = new BufferedOutputStream(conexaoComServlet.getOutputStream());
int read;
byte[] buffer = new byte[8192];
while((read = bis.read(buffer)) != -1)
{
    bos.write(buffer, 0, read);
}
bis.close();
fis.close();

bos.flush();
bos.close();

// get the answer.
ObjectInputStream ois = new ObjectInputStream(conexaoComServlet.getInputStream());
boolean bool = (Boolean) ois.readObject();
ois.close();
conexaoComServlet.getResponseMessage();
conexaoComServlet.disconnect();


连接servlet
br.com.gwtap.server.servlets.ConectionFileServlet
连接servlet
/gwtapp/连接

试着用
/gwtap/consection
替换
/gwtap/consection
并告诉我们它是否有效:)

试着用
/gwtap/consection
替换
/consection
并告诉我们它是否有效:)

我已经找到了一个新的实现,并且:

在我的小程序上

new URL(path + "proj/servlet/MyServlet");

我已经找到了一个新的实现,其中包括:

在我的小程序上

new URL(path + "proj/servlet/MyServlet");

“我正试图将一个文件从一个小程序发送到我的服务器GWT。在另一个应用程序JSF中,我将打开一个与我的servlet的HTTP连接。如何使它成为一个GWT服务器?我试图在web.xml中插入我的servlet,但它似乎被忽略了。”“我正试图将一个文件从小程序发送到我的服务器GWT。在另一个应用程序JSF中,我将使用servlet打开一个HTTP连接。如何使whit成为GWT服务器?我试图在web.xml中插入servlet,但它似乎被忽略了。“Ty。我将web.xml中的URL替换为/conction,让我对/gwtap/conction的调用生效。Ty为此。我将web.xml中的URL替换为/conction,让我对/gwtap/conction的调用生效。
new URL(path + "proj/servlet/MyServlet");