【问题标题】:JAX-RS i want to know the endpoint to beginJAX-RS 我想知道要开始的端点
【发布时间】:2021-10-17 22:27:05
【问题描述】:

我是 java 世界的初学者,我想开始构建一个 JAX-RS 端点,所以我将 Intellij 与 glassfish/tomcat 应用程序服务器一起使用。

在我运行我的服务器后,我尝试了所有类似的网址

  • http://localhost:8080/Demo-1.0-SNAPSHOT/api/hello-world
  • http://localhost:8080/Demo-1.0-SNAPSHOT/hello-world

它没有用。我也试过用tomcat,同样的问题。如果有人帮我解开这个问题就好了。

这是我的项目及其配置:

【问题讨论】:

    标签: jax-rs


    【解决方案1】:

    我认为你需要在 src/main/webapp 下的 web.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
             version="4.0">
        <session-config>
            <session-timeout>
                15
            </session-timeout>
        </session-config>
    </web-app>
    

    您可以将 beans.xml 放在同一个文件夹中。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-04
    • 1970-01-01
    • 1970-01-01
    • 2021-05-18
    • 2017-11-09
    相关资源
    最近更新 更多