如何在Apache中集成Clojure Web应用程序

编程入门 行业动态 更新时间:2024-10-26 00:22:12
本文介绍了如何在Apache中集成Clojure Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

注意

考虑到这个OP是两年前写的,而不是再问同样的问题,如果存在分步指令,那么我可以将Noir或其他Clojure Web应用程序集成到Apache中,无论是Jetty,Tomcat还是其他。类似的说明存在Django,我想我知道Python正在运行在Django的情况下作为引擎而不是一个环框架,所以事情更复杂的Clojure Web应用程序。

结束注

我非常喜欢Clojure,Compojure看起来像一个整洁的网络框架。 / p>

但是,当我想在像Tomcat这样的常规应用程序服务器上部署我的应用程序作为WAR时,这一切都崩溃了。我实际上不得不为静态文件和资源编写自定义Ring处理程序,这将工作在本地Jetty和Tomcat,因为股票处理程序没有,我不得不手动预处理上下文根。

我感到不好的是,我不得不编写所有这些代码来创建最简单的web应用程序,可以想象,将运行在Jetty和Tomcat。对此我只有三个可能的解释:

  • 没有人使用Clojure / Compojure作为本地开发之外的任何东西, li>
  • 每个人都在没有上下文根的专用Jetty上部署Clojure / Compojure应用程序(LIke人使用Node.js应用程序)
  • 有一个非常简单的方法
  • 在你看来,这是什么情况?

    请注意,创建一个战争文件是一个没有脑子Maven / Leiningen而不是我的意思。我想知道我必须编写这么多的代码,使Compojure与Tomcat工作,基本的东西,如静态文件服务和上下文根意识,应该应该工作。 $ b

    解决方案

    人们正在将Compojure应用程序部署到非Jetty servlet容器。

    查看:

    • github/weavejester/lein-ring
    • github/weavejester/lein-beanstalk

    同时检查out lein-war

    Note

    Given this OP was written about two years ago, rather than ask the same question again, I am wondering if step-by-step instructions exist, so that I can integrate a Noir or other Clojure web application into Apache, whether it's Jetty, Tomcat, or something else. Similar instructions exist for Django, and I think I understand that Python is being run in Django's case as an engine rather than a ring framework, so things are more complicated with Clojure web applications.

    End Note

    I'm deeply in love with Clojure, and Compojure seems like a neat web framework.

    But it all fell apart when I wanted to deploy my application on a regular application server like Tomcat as a WAR. I actually had to write custom Ring handlers for static files and resources that would work on both local Jetty and Tomcat because the stock handlers didn't, and I had to prepend the context root everywhere manually.

    I am negatively amazed that I had to write all this code to create the simplest web application conceivable that would run on both Jetty and Tomcat. I have only three possible explanations for this:

  • Nobody uses Clojure/Compojure for anything other than local development with Jetty, i.e. in production
  • Everybody deploys Clojure/Compojure apps on a dedicated Jetty without context root (LIke people do it with Node.js apps)
  • There is a really simple way to circumvent the problems I ran into I wasn't aware of
  • Which of these is in your opinion the case? Or is it something else?

    Edit:

    Please note that creating a war file is a no-brainer with Maven/Leiningen and not what I mean. I'm wondering that I have to write so much code to make Compojure work with Tomcat, basic stuff like static file serving and context root awareness that should work out of the box.

    解决方案

    People are deploying Compojure apps to non-Jetty servlet containers.

    Check out:

    • github/weavejester/lein-ring
    • github/weavejester/lein-beanstalk

    Also check out lein-war

    更多推荐

    如何在Apache中集成Clojure Web应用程序

    本文发布于:2023-11-12 03:35:19,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1580394.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:应用程序   如何在   Clojure   Apache   Web

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!