我的Play中有一个网址!应用程序,路线HTML或XLSX取决于在URL中传递的扩展,具有路由线,如: -为什么这个网址没有从Play打开!框架1.2.4?
# Calls
GET /calls.{format} Call.index
所以calls.html呈现页面,calls.xlsx下载Excel文件(使用玩Excel模块)。从浏览器,cURL请求等,所有工作正常。
我现在想要能够创建一个电子邮件,并有Excel附加到它,但我不能拉附件。下面是我第一次尝试的基本版本: -
public static void sendReport(List<Object[]> invoicelines, String emailaddress) throws MalformedURLException, URISyntaxException
{
setFrom("Telco Analysis <[email protected]>");
addRecipient(emailaddress);
setSubject("Telco Analysis report");
EmailAttachment emailAttachment = new EmailAttachment();
URL url = new URL("http://localhost:9001/calls.xlsx");
emailAttachment.setURL(url);
emailAttachment.setName(url.getFile());
emailAttachment.setDescription("Test file");
addAttachment(emailAttachment);
send(invoicelines);
}
,但它只是不拉URL的内容,它只是坐在那里没有任何错误消息,随着Chrome的页面微调会和领带了Web服务器(直到来自另一个浏览器/机器的请求看起来没有得到服务)。如果我发送没有附件的电子邮件,一切都很好,所以这只是拉动文件看起来是问题。
到目前为止,我已经尝试过上述方法,我试过Play的WS webservice库,我试过手动制作的HttpRequests等。如果我指定另一个URL(例如http://www.google.com)它工作得很好。
任何人都可以协助?
良好的假设;-)我怀疑这是正确的答案,并会验证当我回到我的桌子 – 2012-08-10 12:38:12