- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
根据JAXRS规范,@ApplicationPath可以用在接口(interface)上吗?
import javax.ws.rs.ApplicationPath;
@ApplicationPath("/")
public interface TestRes {
}
编译器对此没有问题。但这是好方法吗?
最佳答案
ApplicationPath文档清楚地说它只适用于 javax.ws.rs.core.Application
的 subclass
所以如果你在接口(interface)上应用它不会工作,所以当你部署你最终可能会出现此错误消息 The ResourceConfig instance does not contain any root resource classes."
Identifies the application path that serves as the base URI for all resource URIs provided by Path.May only be applied to a subclass of Application.
The @ApplicationPath annotation is used to define the URL mapping for the application. The path specified by @ApplicationPath is the base URI for all resource URIs specified by @Path annotations in the resource class. You may only apply @ApplicationPath to a subclass of javax.ws.rs.core.Application.
关于java - 接口(interface)上可以使用@ApplicationPath 注解吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57307788/
swagger-jaxrs 1.5.18 我在 @ApplicationPath("/docs") 处有一个应用程序,在其下有一个位于 @Path("/mydocs") 处的资源。因此,真正的端点是/
我正在尝试从 Visual Studio 代码以 Debug模式运行应用程序。当我单击调试时,出现以下错误: A JavaScript error occurred in the main proce
我需要获取我的 ASP.NET-MVC-5-Application 的 Base-/Application-Path。 我找到了两次获得它的机会,想知道哪个是更好的选择: UrlHelper.Cont
我一直在尝试在全局 asax 的 Application_Start 事件上获取我的项目的应用程序路径我可以在未路由的页面上使用 server.mappath 但是当我在路由页面上时我得到新的虚拟pa
我目前正在尝试设置我的第一个 Java-EE (JDK8) 应用程序,但无法覆盖上下文根以使用 @ApplicationPath 注释。正在使用的应用程序服务器是 Wildfly 16.0.0.Fin
我在 Grizzly 之上运行 Jersey 2.26-b09,并使用以下代码启动 Grizzly HTTP 服务器: public void start() { URI uri = UriB
在我的 razor View 中,我想将所有 jQuery 放入一个单独的 JS 文件中,然后使用 @Scripts.Render 在 View 上引用该文件。 在我看来,我有一个 jQuery 部分
在我的开发服务器上 HttpContext.Current.Request.ApplicationPath 正确返回路径,但在生产环境中它返回空。 为什么会这样? 我正在使用它来构建 URL,但现在在
环境 = JBoss 7.2.0.Final + RESTEasy 2.3.5.Final + Swagger 1.3.10 尝试设置一个没有 web.xml 的 WAR 并使用 Swagger。如果
根据JAXRS规范,@ApplicationPath可以用在接口(interface)上吗? import javax.ws.rs.ApplicationPath; @ApplicationPath(
我正在尝试在没有 web.xml 的情况下将基本的 jersey restful 服务部署到 Tomcat7: @WebServlet(loadOnStartup=1) @ApplicationP
有没有更编程的方式,相当于下面的配置: @ApplicationPath("api") public class MyResourceConfig extends ResourceConfig { ,
我正在寻找一种重写 url 的方法,以防 url 中的应用程序路径具有不同的大小写。由于应用程序路径可能因不同的部署而异,因此我需要动态访问它。有什么办法吗? 背景: 我正在将 cookie 的路径设
我正在从 Jboss 6.4/Java8 -> JBoss 7.2/Java11 转换应用程序,并且遇到错误,应用程序似乎忽略了我的端点注释并返回错误代码404. 您可以在日志中看到 Web 上下文的
有没有办法在一次调用中获取 HttpContext.Current.Request.Url.Host 和 HttpContext.Current.Request.ApplicationPath? 像“
我刚刚引导了一个 Intellij JAX-RS 项目,但在尝试运行时,我得到了样板代码提供的“/api/hello-world”的 404。 HelloServlet 在 Tomcat 10 上工作
使用这样的代码安全吗? Response.Cookies[cookieName].Path = Request.ApplicationPath + "/"; 我想知道所有极端情况,请... 最佳答案
我正在创建一个 mvc 应用程序,我将在子域下使用 http://myapp.mycompany.com 此子域指向应用程序子目录,但我的操作始终使用 applicationPath(子目录)生成,例
我想使用端点路径在 tomcat 上运行我的项目以下是我的两个 java 文件 这是我的应用类 package app; import javax.ws.rs.ApplicationPath;
我在项目中使用 Jersey 和 Spring。 'jersey-spring3' 用于它们之间的集成。我想让我的资源类更加灵活,并在 @Path 注释中使用属性,例如: @Path("${some.
我是一名优秀的程序员,十分优秀!