Hello.
at this URL:
https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/appengine-java8/endpoints-v2-guice
I found in the web.xml:
<!--
URL Pattern /_ah/api/* instead of /* because a legacy v1 servlet uses
the route /_ah/api/ and using /* will erronously use the legacy v1
servlet instead of routing to your API.
-->
<filter-mapping>
<filter-name>guiceFilter</filter-name>
<url-pattern>/_ah/api/*</url-pattern>
</filter-mapping>
I do not understand why if I put /* instead of /_ah/api/* then it does not
work...
In fact I managed to make my endpoint work with guice: everything is
working fine concerning the endpoint.
But now I want to add a cron task wich means I need to create a servelt and
add it to my web.xml
the issue that I have it that in the servlet I want to use GUICE, but the
DI does not work:
when I use this code, the "updater" that is supposed to have been injected
is null...
public class UpdateCurrenciesServlet extends HttpServlet {
Logger logger = Logger.getLogger(this.getClass().getName());
@Inject
CurrencyRateUpdater updater;
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
try {
updater.doOnGae();
}
catch (InterruptedException | ExecutionException | TimeoutException e) {
logger.log(Level.SEVERE, e.toString(), e);
}
resp.setStatus(HttpStatusCodes.STATUS_CODE_OK);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
super.doPost(req, resp);
}
}
what am I missing?
thank you for the help
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/a38dea77-116f-4863-8095-47ac68edb05b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.