rubenlagus / TelegramBots

Java library to create bots using Telegram Bots API
https://telegram.me/JavaBotsApi
MIT License
4.76k stars 1.22k forks source link

Provide a setting for using java.net.HttpURLConnection instead of HTTPClient #444

Open DrakkosSF opened 6 years ago

DrakkosSF commented 6 years ago

The library cannot be used on Google App Engine because it uses Apache HTTP Client under the hood to manage communications with Telegram servers.

If it had a setting to use java.net.HttpURLConnection instead, it could run fine in Google App Engine java 8 environments with urlfetch configured in appengine-web.xml as noted here.

rubenlagus commented 6 years ago

Hi, you could use Telegram-meta package and implement you own version of the bot that doesn't use Apache client, it should make the trick.

DrakkosSF commented 6 years ago

Thanks for the directions. Started looking into DefaultAbsSender and seemed like only necessary rework needed was implementing a bridge that would post Http Client's HTTPPost parameters with java.net.HttpUrlConnection. Will take a look at telegram-meta probably a cleanest place to insert custom behaviour like this.

rubenlagus commented 6 years ago

@DrakkosSF I'm open to consider a pull request with those changes if they are valid and useful for everyone

bhati3 commented 3 years ago

If this hasn't been done, I would like to pick this up. Let me know if this is still available.