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

  • Home
  • SEARCH
  • 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 7725163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:52:15+00:00 2026-06-01T04:52:15+00:00

I have a clojure/ring project that has two distinct app/handlers running on different ports

  • 0

I have a clojure/ring project that has two distinct app/handlers running on different ports (one for an api and one for a web frontend). They share a lot of code, but each has its own namespace where it does all the work particular to that interface. Now I want to deploy this as a servlet running in tomcat or something similar (really it needs to work in any servlet container). I am having trouble though because it seems like lein-ring makes the assumption that there will be only one handler in the servlet. For instance, in my project.clj I have this line:

:ring {:handler caribou.api/app
       :servlet-name "caribou"
       :init caribou.api/init}

This is great for the api, but now what about the frontend? Do I need to make another project that includes this one so that it can have its own handler and servlet? Does a servlet always run on one port?

There are two things I’m not sure about basically: I am not coming from a java background so I’m not sure what is going on with the servlet approach and what limitations it has, and I am unclear on how exactly clojure translates into the servlet paradigm enough to structure this project in a general way.

Any help is appreciated, thanks!

  • 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-06-01T04:52:16+00:00Added an answer on June 1, 2026 at 4:52 am

    All servlets in the same container are being served from the same server and therefore the same port. Usually you identify different servlets by giving them different URI prefixes such as /servlet1 or /my/servlet.

    I don’t know if there is anything preventing you from creating separate servlets with Ring, but in general it doesn’t seem like a good idea if your entire app is Clojure-based. At the very least, as you have pointed out, the lein-ring plugin enforces that only one servlet is used for the web application.

    One thing you could do is create a parent handler that delegates to either the app or API handlers based on the URI. This essentially gives you control with out needing to delegate the logic to the Servlet API.

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

Sidebar

Related Questions

I have a Clojure WebNoir app that uses one of my own jar files.
I have a clojure project that uses the slick 2d game engine that I
I've noticed that Java, Python, Perl, and Haskell/Clojure have distinctively different treatment of static
I'm learning clojure and have a very basic question: given that clojure has type
I have a Clojure project that I would like to package and use in
I have a Clojure main application that depends on several Clojure libraries, two of
Does clojure have a powerful 'loop' like common lisp. for example: get two elements
When trying to M-x slime-connect to a swank server running in a clojure app
I have Clojure function that returns a LazySeq. When I run this function from
I have Clojure function that takes a sequence of numbers chops it into the

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.