English 中文(简体)
利用带有说明性的REST服务器的服装
原标题:Using Clojure with an annotation-based REST Server

我正在考虑用克隆技术制作一台REST服务器。

我拥有使用RESTEasy和 Java。 它使用“URLs”、“template criteria和“ Java”类、方法和方法参数的查询参数。 我认为,Jersey REST 服务器还使用说明(因为也是基于日本宇宙航空研究开发机构-RS)。

Is it possible to use these frameworks with Clojure? Is there an official way to associate annotations with functions?

最佳回答

I found the answer in the forth-coming book "Clojure Programming", by Chas Emerick, Brian Carper, and Christophe Grand.

如果你用<代码>deftype界定新的类别,你可添加新设立的类别的说明:

(ns my.resources
  (:import (javax.ws.rs Path PathParam Produces GET)))

(definterface PersonService
  (getPerson [^Integer id]))

(deftype ^{Path "/people/{id}"} PersonResource []
  PersonService
  (^{GET true                                                
     Produces ["text/plain"]}
    getPerson
    [this ^{PathParam "id"} id]           
    ; blah blah blah    
  ))

我不敢确定这项工作将采用<代码>gen-}。 我需要尝试。

问题回答

暂无回答




相关问题
Allow RESTful DELETE method in asp.net mvc?

im currently setting up asp.net to accept DELETE http verb in the application. However, when i send "DELETE /posts/delete/1" i always get a 405 Method not allow error. I tried to take a look at ...

Most appropriate API for URL shortening service

I ve just finished an online service for shortening URLs (in php5 with Zend Framework); you can enter an URL and you get an short URL (like tinyurl and such sites). I m thinking about the API for ...

Use HTTPClient or HttpUrlConnection? [closed]

We re implementing a REST client on JRE 1.4. Seems two good options for a client REST framework are HttpClient and HttpUrlConnection. Is there a reason to use HttpClient over the JRE s ...

Why can t I find the truststore for an SSL handshake?

I m using the Spring RESTTemplate on the client side to make calls to a REST endpoint. The client in this case is a Spring app and Tomcat is the servlet container. I m running into issues making a ...

Which Http redirects status code to use?

friendfeed.com uses 302. bit.ly uses 301. I had decided to use 303. Do they behave differently in terms of support by browsers ?

Three Step Buyonline The RESTful way

We are re-developing our buyonline functionality and we are doing it the RESTful way. The process is a three step one and the customer is asked to enter data at each step. Let s say the three URL s ...

热门标签