简体   繁体   English

在同一路径上扩展REST类和重写方法

[英]Extending REST class and override methods on the same path

I will just provide an example because I find it hard to put the correct question. 我仅提供一个示例,因为我很难提出正确的问题。

I have a REST(Jersey) class with some methods. 我有一个带有某些方法的REST(Jersey)类。

@Path(value = "{resource}")
public class GenericRestResource{
//some methods
}

And I have a class which extends it. 我有一个扩展它的课程。

public class SomeClass extends GenericRestResource{
//override parent methods
}

Is it possible to extend GenericRestResource class like this to override its methods on the same @Path? 是否可以像这样扩展GenericRestResource类以在同一@Path上覆盖其方法?

Will SomeClass gain the same @Path attribute as his parent class? SomeClass是否将获得与其父类相同的@Path属性?

Or this is done in another way? 还是以另一种方式完成?

Thank you. 谢谢。

It sounds like you're talking about subresources. 听起来您在谈论子资源。 The java ee 7 tutorial has a good section on them. Java ee 7教程对此有很好的介绍。 31.3 Subresources and Runtime Resource Resolution 31.3子资源和运行时资源解析

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM