restlet

How do I implement client side http caching like a browser?

牧云@^-^@ 提交于 2019-12-04 09:54:23
I use a RESTFul service as a backend to my frontend. The service sets expires/etag/lastmodified headers on it's responses. What I'm looking for is a client-side(favorably java) library which can fetch data from the service and cache it in a pluggable caching backend like ehcache. What I also want to be able to do is automatically prime the cache using background worker threads as soon as an entry is invalidated. Also, it should be smart to do conditional GETs. I've come across http://hc.apache.org/httpcomponents-client-ga/tutorial/html/caching.html Is there any other library anyone knows about

Configure Restlet to Return JSPs on Google App Engine?

血红的双手。 提交于 2019-12-04 04:58:36
I have a developed a Restlet application. I would like to return a JSP file on a URL request through Restlet. How can I achieve this without using a redirect? i.e. Let's say I have the file "contact.jsp" on mydomain.com and I want people to be able to access contact.jsp at http://mydomain.com/contact Thus, in Restlet, I would have: router.attach("/contact", MyResource.class); But how can I return the "contact.jsp" page? I know that a redirect would work, but I don't want users to see the ".jsp" in " http://mydomain.com/contact.jsp "... or is there another strategy that would work without even

RestKit in android?

ⅰ亾dé卋堺 提交于 2019-12-04 04:56:49
I have used restkit framework in ios. Which is very powerful and provides features like caching and all. I am looking whether a similar framework is available in android? I came across a framework called restlet . But didnt find any samples to work with. Is there any frameworks out there for the same, for caching data from rest services? Also could some one direct me to good tutorials for restlet in android? Thanks In addition, there is this first application tutorial covering Restlet edition for Android: http://restlet.org/learn/guide/2.2/introduction/first-steps/first-application Saurabh

How to serve static content with JAX-RS?

老子叫甜甜 提交于 2019-12-03 15:52:20
问题 I have a self hosted JAX-RS REST service implemented with the JAX-RS Restlet extension. Now I have to serve static content and I was wondering how to do it with JAX-RS. Note, that I do not know the physical directory structure at compile-time. So, given a URL like http://bla-bla:8182/static/yaba/daba/doo.png the file $(ROOT)/yaba/daba/doo.png has to be returned, where $(ROOT) is the static content root directory. Is it possible to do it with pure JAX-RS? Thanks. EDIT Known at compile-time:

Restlet implementing post with json receive and response

て烟熏妆下的殇ゞ 提交于 2019-12-03 13:48:41
问题 First, what i wanted to know is what i am doing is the right way to do it. I have a scenario where i have will receive a json request and i have to update the database with that, once the db is updated i have to respond back with the json acknowledgment. What i have done so far is create the class extending application as follows: @Override public Restlet createRoot() { // Create a router Restlet that routes each call to a // new instance of ScanRequestResource. Router router = new Router

browsers send Options instead of Post after changing http header

我是研究僧i 提交于 2019-12-03 10:01:20
/*set the response header*/ Form responseHeaders = (Form) getResponse().getAttributes().get("org.restlet.http.headers"); if (responseHeaders == null) { responseHeaders = new Form(); responseHeaders.add("Access-Control-Allow-Origin", "*"); responseHeaders.add("Access-Control-Allow-Methods", "POST, GET, PUT, DELETE"); getResponse().getAttributes().put("org.restlet.http.headers", responseHeaders); } I added this in my restlet 2.0 code to allow for cross domain access, this does make the first GET to work on page load, but when I try to do POST later(with backbone model.save()), browser sends

Restlet javax.net.ssl.SSLHandshakeException: null cert chain

谁说胖子不能爱 提交于 2019-12-03 09:28:32
问题 I am testing SSL communication between client and server locally. So I generated certificate using OpenSSL commands. Added this certificate in cacert file. Also generated .p12 file. I am using the same .p12 file in server and client. This is the server code Server server = component.getServers().add(Protocol.HTTPS, port); Series<Parameter> params = server.getContext().getParameters(); params.add("keystorePath", ".p12 file path"); params.add("keystoreType", "PKCS12"); params.add(

How to set up a Restlet server with JAXRS and JAXB?

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been looking all over the internet trying to find an example of how to do this. I simply want to set up a REST server which automatically serializes objects to and from XML. I'm simply trying to provide a server that can faciltate user login, logout, and access to a XML list of objects only once a user is logged in. What's required to get a simple example application up and going? I'm failing to grasp the way that the Restlet library works, and I'm entirely new to using JAXB and JAXRS. I've worked on a project that uses these libraries,

Restlet streaming data

穿精又带淫゛_ 提交于 2019-12-03 07:32:25
问题 I have this task that I'm undertaking where I would be reading data from a device and make it available over a web service. The data is read 4 times a second. I want the web clients to be have an open HTTP connection and get the device readings as a stream using chunked transfer as long as the client keeps the connection open. As a proof of concept, I want to start with a service that constantly generates a random number, 4 times a second, wraps it in json and stream that to clients. I'm

How to serve static content with JAX-RS?

做~自己de王妃 提交于 2019-12-03 05:19:17
I have a self hosted JAX-RS REST service implemented with the JAX-RS Restlet extension. Now I have to serve static content and I was wondering how to do it with JAX-RS. Note, that I do not know the physical directory structure at compile-time. So, given a URL like http://bla-bla:8182/static/yaba/daba/doo.png the file $(ROOT)/yaba/daba/doo.png has to be returned, where $(ROOT) is the static content root directory. Is it possible to do it with pure JAX-RS? Thanks. EDIT Known at compile-time: File system path of the static content root folder HTTP URL used to reference the static content root