Right you are. I'm now handling this exactly as you suggest with a
catch-all mail handler servlet that forwards to more specific handlers per
address like this:

RequestDispatcher requestDispatcher =
request.getRequestDispatcher(URI_PREFIX + mailUsername);
requestDispatcher.forward(request, response);

I still have my specific handlers in web.xml. Works fine.

Cheers,

Eliot Stock


On 4 November 2011 01:18, Ikai Lan (Google) <[email protected]> wrote:

> It doesn't look like the servlet specification defines this:
>
> http://download.oracle.com/otndocs/jcp/servlet-3.0-public-oth-JSpec/
>
> The servlet specification defines: "/*" and "*.somesuffix". You might just
> have to write a servlet that routes as necessary based on the URL path.
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine
> plus.ikailan.com | twitter.com/ikai
>
>
>
> On Sat, Oct 29, 2011 at 3:31 AM, Eliot Stock <[email protected]> wrote:
>
>> Hi there,
>>
>> Until recently I had a happily working app with one mail handler and
>> Spring MVC configured in web.xml as follows:
>>
>> <servlet-mapping>
>>  <servlet-name>imageMailHandler</servlet-name>
>> <url-pattern>/_ah/mail/*</url-pattern>
>>  </servlet-mapping>
>> <servlet-mapping>
>>  <servlet-name>springMvc</servlet-name>
>> <url-pattern>/</url-pattern>
>>  </servlet-mapping>
>>
>> Today I added a second mail handler, so I had to make the url pattern for
>> both mail handlers more specific:
>>
>> <servlet-mapping>
>>  <servlet-name>yahooGroupsMailHandler</servlet-name>
>> <url-pattern>/_ah/mail/yg*</url-pattern>
>>  </servlet-mapping>
>> <servlet-mapping>
>>  <servlet-name>imageMailHandler</servlet-name>
>>  <url-pattern>/_ah/mail/image*</url-pattern>
>> </servlet-mapping>
>>  <servlet-mapping>
>> <servlet-name>springMvc</servlet-name>
>>  <url-pattern>/</url-pattern>
>> </servlet-mapping>
>>
>> Now what's happening is that the mail requests are being given to the
>> Spring MVC servlet. The mail handler URL pattern is not matching. The mail
>> is being sent to:
>>
>> image@[APP ID].appspotmail.com
>> yg@[APP ID].appspotmail.com
>>
>> Both addresses bounce and I get the following in my logs, which indicates
>> the request is going through to Spring:
>>
>>
>>    1. 2011-10-29 11:18:42.541 /_ah/mail/image@[APP ID].appspotmail.com
>>    404 6153ms 311cpu_ms 195api_cpu_ms 3kb
>>
>>    0.1.0.20 - - [29/Oct/2011:03:18:42 -0700] "POST /_ah/mail/image@[APP 
>> ID].appspotmail.com HTTP/1.1" 404 3288 - - "[APP ID].appspot.com" ms=6154 
>> cpu_ms=312 api_cpu_ms=195 cpm_usd=0.009177 
>> instance=00c61b117c977250f313d9fed8db23d827d0
>>
>>    2. I2011-10-29 11:18:36.398
>>
>>    [s~dev-gb-recyc-org/5.354303509951850075].<stdout>: 10:18:36,398 WARN  
>> [org.springframework.web.servlet.PageNotFound] - No mapping found for HTTP 
>> request with URI [/_ah/mail/image@[APP ID].appspotmail.com] in 
>> DispatcherServlet with name 'springMvc'
>>
>>
>>
>> I've also tried making the mappings a bit more specific, but to no avail:
>>
>>  <servlet-mapping>
>>  <servlet-name>yahooGroupsMailHandler</servlet-name>
>>  <url-pattern>/_ah/mail/yg@*</url-pattern>
>>  </servlet-mapping>
>>  <servlet-mapping>
>> <servlet-name>imageMailHandler</servlet-name>
>>  <url-pattern>/_ah/mail/image@*</url-pattern>
>>  </servlet-mapping>
>>  <servlet-mapping>
>> <servlet-name>springMvc</servlet-name>
>>  <url-pattern>/</url-pattern>
>>  </servlet-mapping>
>>
>> I'm loath to put the whole email address in there including app ID,
>> because I have multiple environments and it'd be a manual step at
>> deployment to edit the app ID every time I deploy. Any help greatly
>> appreciated.
>>
>> Cheers,
>>
>> Eliot.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine for Java" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/google-appengine-java/-/9VZubzwmd9QJ.
>> To post to this group, send email to
>> [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine-java?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to