[英]Unsupported Media Type (415) with Generic Put or Post
阿羅哈!
我試圖在Restlet中實現通用的put或post方法。 (我能夠毫無問題地實現通用的Get方法。)
這是服務器資源(接口)文件的相關部分:
@Post
public <T> void insert( T object ) ; // non-idempotent update/create
這是服務器資源(實現)文件的相關部分:
// non-idempotent create/update
public <T> void insert( T object )
{ }
我在Restlet客戶端中嘗試了以下兩種方法:
clientResource.insert( newUser ) ;
clientResource.<User>insert( newUser ) ;
但是,這兩者都會導致以下客戶端異常:
Exception in thread "main" Unsupported Media Type (415) - Unsupported Media Type
at org.restlet.resource.ClientResource.doError(ClientResource.java:612)
at org.restlet.engine.resource.ClientInvocationHandler.invoke(ClientInvocationHandler.java:264)
at $Proxy8.store(Unknown Source)
at storage.client.Client.main(Client.java:53)
因此,似乎出現了某種編組失敗(對於實際的服務器put方法-insert())。
有誰知道如何解決這個問題?
照顧自己,
達爾文
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.