Üretimini hazır ve mobil uygulamalar uygulamasının bir parçası olarak kullanılan Phil Sturgeons cool Restful API framework for codeigniter'u kullanarak API'mızı oluşturduk. JavaRestful API codeigniter - JAVA issue
yılındahttpConnection = (HttpConnection) Connector.open(url, Connector.READ, true);
// Set content type by given parameter......
httpConnection.setRequestProperty("Accept", contentType);
httpConnection.setRequestProperty("User-Agent", "Profile/MIDP-2.0 Configuration/FCLDC-1.0");
httpConnection.setRequestProperty("Content-Type", contentType);
httpConnection.setRequestProperty("TK-API-KEY", UrlFactory.TK_API_KEY);
// httpConnection.setRequestProperty("Model",
// StyleUtil.getDeviceModel());
if (httpConnection.getResponseCode() == 302)
{
String redirectUrl = httpConnection.getHeaderField("Location");
httpConnection = (HttpConnection) Connector.open(redirectUrl, Connector.READ_WRITE, true);
}
if (httpConnection.getResponseCode() == HttpConnection.HTTP_OK)
{
io = httpConnection.openInputStream();
int ch;
while ((ch = io.read()) != -1)
{
bo.write(ch);
}
}
httpConnection.getResponseCode()
durum kodu alamadı API kullanarak ve bozuk bir istisna döndüğünde
Bir sorunumuz var. API sunucumuz NGINX. Üstbilgi alanları düzgün ayarlanmadığında, MalformedException atılır.
Döndükten sonra yayınlayabilir misiniz? – Broncha
Bunu işe aldınız mı? – seangates
[CI] (http://codeigniter.com) gerekli değilse [jabsorb] (http://code.google.com/p/jabsorb/) adresine bir şans verebilirsiniz. – quantme