Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7673201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:27:24+00:00 2026-05-31T16:27:24+00:00

I am designing a JAX-RS REST Server using Clojure and RESTEasy . It is

  • 0

I am designing a JAX-RS REST Server using Clojure and RESTEasy.

It is my understanding that applications written in Lisp-family languages are, more than those in “traditional” imperative languages, built up as “domain-specific languages”. The application is designed from the bottom-up as more and more “refined” functions until, at the “top” level, the application becomes a series of function calls to very high-level functions.

I am trying to do this for my REST server, starting with the resource classes that service URL requests (GET, POST, PUT, DELETE).

Here is my first resource:

(ns com.example.server.resources.buildtime
  (:import [javax.ws.rs CookieParam GET Produces Path]
           [javax.ws.rs.core Context Cookie NewCookie Response UriInfo]
           [org.jboss.resteasy.annotations.providers.jaxb Formatted]))

(definterface BuildTime
  (getBuildTime [^javax.ws.rs.core.UriInfo info
                 ^javax.ws.rs.core.Cookie security-cookie]))

(deftype
  ^{Formatted true}
  BuildTimeResource []
  BuildTime
  (^{GET true
     Path "/buildtime"
     Produces ["application/json"]}
    getBuildTime
    [this info security-cookie]
    (.. (Response/ok "20111009") build)))

This resource returns the server build time as a String (enclosed in a JSON package) when called at the URL “/buildtime” with the GET http method.

I will be writing many more of the these resource classes and enclosed methods (most classes will have more than one method), each with a definterface and a deftype. This seems like a perfect use for macros.

I am soliciting suggestions for how this might be done as a DSL. How does one go about thinking in terms of DSLs?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T16:27:25+00:00Added an answer on May 31, 2026 at 4:27 pm

    If I were undertaking this, I think I would start by creating a ring adapter for RESTEasy. After this is done, Compojure will know how to handle and respond to http requests in a way that works with RESTEasy. Here’s some information to help you get started.

    Ring is a clojure library that represents http requests and responses in a standard way. This standard is detailed here.

    It works by receiving an http request from any of a variety of libraries (ie. jetty, netty, finagle) and translating it into the standard representation. It then hands the request off to a request handler (often this is defined using Compojure). The handler then returns a response (also defined in the above spec). This response is translated by ring back into a form that jetty, netty, etc. can understand.

    This translation is done by ring adapters. There are a few listed here, and ring comes with an adapter for jetty built in. Maybe you can use one of them as a template for creating a RESTEasy adapter. After you’ve done that you can use compojure in the standard way.

    Ring and compojure are great examples of how to create a DSL. Like all good DSLs, it simplifies creating solutions in its problem domain (HTTP servers in this case). They are great examples of how to think in terms of DSLs. If you study them, you’ll be well on your way towards thinking in terms of DSLs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am defining a definterface to be used with a JAX-RS REST server (
Designing an interface with QT4 I have been advised that using multiple Tabs at
When designing a client/server architecture, is there any advantage to multiplexing multiple connections from
When designing a web service that will allow the consumer of the service to
When designing both the domain-model and class-diagrams I am having some trouble understanding what
While designing applications it is a very good practice to have all the business
When designing an rdlc report using the VS 2010 report designer, report items such
Designing a new system from scratch. I'll be using the STL to store lists
Designing a simple HTML table that I am going to implement alternate-row coloring on...
When designing LINQ classes using the LINQ to SQL designer I've sometimes needed to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.