Handle all paths under an Action

19 views
Skip to first unread message

Tim Jacomb

unread,
Jun 6, 2021, 1:50:20 PM6/6/21
to Jenkins Developers
Hello

Is there a way to handle all paths under a pattern in an Action (or something else)?

i.e. If I add an action 'GraphProxyAction'

I would like to be able to route GraphProxy/v1.0/* to my GraphProxy class which will just check permissions, add a credential and proxy the calls to an external rest API.

Alternatively how can I add nested actions to reflect the API I'm proxying? I tried returning a V1 action from my doIndex method in `GraphProxyAction`, but that just ended up with a white page.

I've had a look around at some of the Stapler annotations but not really sure how to do this

Thanks
Tim

Matt Sicker

unread,
Jun 6, 2021, 2:11:02 PM6/6/21
to jenkin...@googlegroups.com
This sounds like getDynamic stuff. Look at DirectoryBrowserSupport for ideas.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAH-3BicnOpMOLTe4uodrpqn0At-UT1CT054nuq5SvMSXZE9sBQ%40mail.gmail.com.

Ullrich Hafner

unread,
Jun 6, 2021, 6:13:18 PM6/6/21
to JenkinsCI Developers
You will find another example in the warnings plugin: I’m routing the individual detail views for packages, files, categories, etc. using the getDynamic method (the DetailFactory creates different view objects depending on the sub-link names). 

Jesse Glick

unread,
Jun 7, 2021, 11:27:41 AM6/7/21
to Jenkins Dev
On Sun, Jun 6, 2021 at 2:11 PM Matt Sicker <boa...@gmail.com> wrote:
This sounds like getDynamic stuff.

Tim Jacomb

unread,
Jun 7, 2021, 12:12:37 PM6/7/21
to jenkin...@googlegroups.com
Thanks all, I have the getDynamic working but doDynamic looks better so I’ll try that out later on

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.

Tim Jacomb

unread,
Jun 8, 2021, 3:38:57 AM6/8/21
to Jenkins Developers
`doDynamic` was exactly what I was looking for!


Thanks
Tim
Reply all
Reply to author
Forward
0 new messages