org.apache.shindig.gadgets.servlet
Class HttpRequestHandler
java.lang.Object
org.apache.shindig.gadgets.servlet.HttpRequestHandler
public class HttpRequestHandler
- extends Object
An alternate implementation of the Http proxy service using the standard API dispatcher for REST
/ JSON-RPC calls. The basic form of the request is as follows
...
method : http.
params : {
href : ,
headers : { : [, ...]},
format : <"text", "json", "feed">
body :
gadget :
authz: : ,
sign_owner:
sign_viewer:
...
refreshInterval :
noCache :
sanitize :
summarize :
entryCount :
}
A successful response response will have the form
data : {
status :
headers : { : [, , ...], ...}
content : : string if 'text', JSON is 'feed' or 'json' format
token :
metadata : { : , ...}
}
It's important to note that requests which generate HTTP error responses such as 500 are returned
in the above format. The RPC itself succeeded in these cases. If an RPC error occurred the client
should introspect the error message for information as to the cause.
TODO: send errors using "result", not plain content
- See Also:
MakeRequestHandler
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HttpRequestHandler
@Inject
public HttpRequestHandler(RequestPipeline requestPipeline,
ResponseRewriterRegistry contentRewriterRegistry)
get
public HttpRequestHandler.HttpApiResponse get(BaseRequestItem request)
- Execute an HTTP GET request
post
public HttpRequestHandler.HttpApiResponse post(BaseRequestItem request)
- Execute an HTTP POST request
put
public HttpRequestHandler.HttpApiResponse put(BaseRequestItem request)
- Execute an HTTP PUT request
delete
public HttpRequestHandler.HttpApiResponse delete(BaseRequestItem request)
- Execute an HTTP DELETE request
head
public HttpRequestHandler.HttpApiResponse head(BaseRequestItem request)
- Execute an HTTP HEAD request
normalizeUrl
protected Uri normalizeUrl(Uri url)
transformBody
protected Object transformBody(HttpRequestHandler.HttpApiRequest request,
HttpResponse results)
throws GadgetException
- Format a response as JSON, including additional JSON inserted by chained content fetchers.
- Throws:
GadgetException
processFeed
protected Object processFeed(HttpRequestHandler.HttpApiRequest req,
String responseBody)
throws GadgetException
- Processes a feed (RSS or Atom) using FeedProcessor.
- Throws:
GadgetException
getGadgetUri
protected Uri getGadgetUri(SecurityToken token,
HttpRequestHandler.HttpApiRequest httpApiRequest)
- Extract the gadget URL from the request or the security token
Copyright © 2007-2012. All Rights Reserved.