を受信:メールを受信するためのApp Engineと私はここにドキュメントを働いているメール
http://code.google.com/appengine/docs/java/mail/overview.html#Receiving_Mail_in_Java
。以下は私のサーブレットさ:
package mailserver;
import java.io.IOException;
import java.util.Properties;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.internet.MimeMessage;
import javax.servlet.http.*;
public class MailHandlerServlet extends HttpServlet {
public void doPost(HttpServletRequest req,
HttpServletResponse resp)
throws IOException {
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
MimeMessage message = null;
try {
message = new MimeMessage(session, req.getInputStream());
} catch (MessagingException e) {
e.printStackTrace();
}
resp.setContentType("text/plain");
resp.getWriter().println(message);
}
}
私のappengine-XML:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>myapp</application>
<version>4</version>
<inbound-services>
<service>mail</service>
</inbound-services>
<!--
By default, App Engine sends requests serially to a given web server.
To allow App Engine to send multiple requests in parallel specify:
<threadsafe>true</threadsafe>
-->
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
とweb.xml
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<servlet>
<servlet-name>MailHandlerServlet</servlet-name>
<servlet-class>mailserver.MailHandlerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MailHandlerServlet</servlet-name>
<url-pattern>/_ah/mail/[email protected]</url-pattern>
</servlet-mapping>
<security-constraint>
<web-resource-collection>
<url-pattern>/_ah/mail/[email protected]</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
</web-app>
私の最初の質問は、私は余分の任意の並べ替えを設定していませんメールアドレス:
文字列@appid.appspotmail.comで受信メールを受信
私はこれがキャッチオールのようなものだと思っています。
私の次の質問は、サーブレットが動作していれば何でも表示されますか?現時点では、私はちょうど取得していますThe requested URL /mailserver was not found on this server.
どのような助けを開始することが素晴らしいだろう。
TIA