开发者

How to call getServletContext() equivalent in AppEngineMapper derived class?

I have a Mapper class which extends AppEngineMapper<Key, Entity, NullWritable, 开发者_高级运维NullWritable>.

Now inside my map function (public void map(Key key, Entity value, Context context)), I need to get access to PersistenceManager. To get singleton PersistenceManager, I need ServletContext object.

Typically, in a HTTPServlet extended class, I call getServletContext() and pass it to get PersistenceManager object. But in Mapper extended class, I don't have or can call getServletContext().

Can anyone advice on how to get servletcontext in my mapper class or if there is a way to pass servlet context from my servlet to Mapper extended class? I am using auto-mapreduce (programmatically) through a cron job.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜