juneau-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harish B N (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (JUNEAU-97) Path Parameter in Parent RestResource
Date Wed, 06 Feb 2019 01:10:00 GMT

     [ https://issues.apache.org/jira/browse/JUNEAU-97?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Harish B N updated JUNEAU-97:
-----------------------------
    Description: 
I would like to have a way to specify path param as part of the parent Resource.

Eg. I have a parent resource teachers 

GET /teachers  

GET /teachers/john

Now I want to build a child resource called students (for the teacher: john)

GET /teachers/john/students

 

is this something possible using parent-child resource mapping, with @RestResource parent
as path /teachers/\{teacherId} 

And have a children Resource be able to pick up the teacherId. Child resource defined as

path /students

 

Eg. Code:
{code:java}
// TeacherResource.java - Parent Resource 
@RestResource(
        path="/teacher/{teacherId}",
        title="Teacher Resource ",
        children={
                StudentsResource.class
        }
)
{code}
and then have a child resource
{code:java}
// StudentsResource.java
@RestResource(
        path="/students",
        title="Students",
        description="Students Related API endpoints",
)

// ....
// with method like below, it would be great if we can pick up teacherId param from it's parent
resource
public List getStudents(@Path("teacherId") String teacherId) {
{code}

  was:
I would like to have a way to specify path param as part of the parent Resource.

Eg. I have a parent resource teachers 

GET /teachers  

GET /teachers/john

Now I want to build a child resource called students (for the teacher: john)

GET /teachers/john/students

 

is this something possible using parent-child resource mapping, with @RestResource parent
as path /teachers/\{teacherId} 

And have a children Resource be able to pick up the teacherId. Child resource defined as

path /students

 

Eg. Code:
{code:java}
// TeacherResource.java - Parent Resource 
@RestResource(
        path="/teacher/{academyId}",
        title="Teacher Resource ",
        children={
                StudentsResource.class
        }
)
{code}
and then have a child resource
{code:java}
// StudentsResource.java
@RestResource(
        path="/students",
        title="Students",
        description="Students Related API endpoints",
)

// ....
// with method like below, it would be great if we can pick up teacherId param from it's parent
resource
public List getStudents(@Path("teacherId") String teacherId) {
{code}


> Path Parameter in Parent RestResource
> -------------------------------------
>
>                 Key: JUNEAU-97
>                 URL: https://issues.apache.org/jira/browse/JUNEAU-97
>             Project: Juneau
>          Issue Type: Improvement
>    Affects Versions: 8.0.0
>            Reporter: Harish B N
>            Priority: Major
>             Fix For: 8.0.0
>
>
> I would like to have a way to specify path param as part of the parent Resource.
> Eg. I have a parent resource teachers 
> GET /teachers  
> GET /teachers/john
> Now I want to build a child resource called students (for the teacher: john)
> GET /teachers/john/students
>  
> is this something possible using parent-child resource mapping, with @RestResource parent
as path /teachers/\{teacherId} 
> And have a children Resource be able to pick up the teacherId. Child resource defined
as
> path /students
>  
> Eg. Code:
> {code:java}
> // TeacherResource.java - Parent Resource 
> @RestResource(
>         path="/teacher/{teacherId}",
>         title="Teacher Resource ",
>         children={
>                 StudentsResource.class
>         }
> )
> {code}
> and then have a child resource
> {code:java}
> // StudentsResource.java
> @RestResource(
>         path="/students",
>         title="Students",
>         description="Students Related API endpoints",
> )
> // ....
> // with method like below, it would be great if we can pick up teacherId param from it's
parent resource
> public List getStudents(@Path("teacherId") String teacherId) {
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message