Well you seem to be mixing up two different concepts

Stapler.getViewURL gets you the resource URL to a class' view (.jelly or
.groovy) Is it that type of view you want?

I'm guessing you're after the current hudson.model.View that is currently
being configured?

You can get that via the current ancestor path (the path of domain model
objects that got to the execution of your "doX" method)

Stapler.getCurrentRequest().findAncestor(View.class).getObject()

/B

On Fri, Mar 11, 2016 at 9:14 AM, Jochen Fuerbacher <
[email protected]> wrote:

> Thank you! Unfortunately views aren't in the ancestor list.
>
> At the moment I do this to get the view:
> public FormValidation doCheckView(@QueryParameter String value) {
>
>             String viewpath = Stapler.getViewURL(View.class, "Testview");
>             String viewname = viewpath.substring(viewpath.lastIndexOf("/"
> )+1);
>             View view = Jenkins.getActiveInstance().getView(viewname);
>             ...
> }
>
> However, this way isn't very elegant. Is there any more smart way to get
> the view?
>
> Am Donnerstag, 10. März 2016 14:13:30 UTC+1 schrieb Jesse Glick:
>>
>> Tip: from `mvn hpi:run` dev mode, look at HTTP headers to see Stapler
>> traces.
>>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/8e62679f-a289-45fc-8c2f-675d028722cb%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/8e62679f-a289-45fc-8c2f-675d028722cb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Robert Sandell
*Software Engineer*
*CloudBees Inc.*

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CALzHZS2PKsx_4KZu0mBXTnjDAAQ_k%2BfMTGya%2Beb6X97wiEQiJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to