Problem with doCheck()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with doCheck()

Weichselbaumer Michael (MWE 4170)
Hello everbody!
 
I have a problem, which i don't understand at all. I am trying to implement a class for branching CVS and Subversion builds. Currently I'm putting my focus on doing the CVS branch. Because, as far as i know, a branch is not really different to a Tag, I thought that i could CVSSCM.TagAction.
 
Because of some restrictions, this doesn't work for me, and therefore I am now extending TaskAction.
After implementing the stuff that I need, i noticed that it is quite similar to the way the CVS TagAction looks and therefore I decided that it would be great if I could also a quite similar jelly-script.
 
Now to my problem: I have this input-field for the branch name, just like the one for the tag name when tagging CVS builds. ´
Just like at the tagging, I want to check the input, using the checkUrl parameter in my jelly input-field and by having a method - yes you guessed it - called "doCheckBranch(..)". It works similar to the "doCheckTag(..)" method from CVS TagAction but somehow I cannot access it.
 
This is what the jelly-part looks like:

<input type="text" name="upstream.${up.key.name}" value="yeah-right" class="validated"

checkUrl="'checkBranch?value='+escape(this.value)"/>

Here is the Java part:

public synchronized void doCheckBranch(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { ... }

 

When i try it this way, i get the error:  

Http error 404: NOT_FOUND RequestURI:=/job/cvstest/442/checkBranch

 

Now this is strange, because when I look at the request URI from the CVS Tag Action, its quite the same but it includes "tagBuild" -> (getUrlName()) from the CVS Tag Action. Looks like this: job/cvstest/442/tagBuild/checkTag?value=iamavalue

getUrlName() from my class CVS Branch Action returns "branchBuild" and this is also correct displayed in the address bar of my browser. If i add "branchBuild" to the request URI myself, I just end up with the whole "branchBuild" site in the position where i wanted to execute my doCheckBranch() method.

Like this:

<input type="text" name="upstream.${up.key.name}" value="yeah-right" class="validated"

checkUrl="'${it.urlName}/checkBranch?value='+escape(this.value)"/>

 If I enter the path to the method completely hardcoded, I end up with no error, but the method is also never called.

Has anybody any idea?

Reply | Threaded
Open this post in threaded view
|

Re: Problem with doCheck()

Kohsuke Kawaguchi
Administrator
Weichselbaumer Michael wrote:
> Hello everbody!
>  
> I have a problem, which i don't understand at all. I am trying to
> implement a class for branching CVS and Subversion builds. Currently I'm
> putting my focus on doing the CVS branch. Because, as far as i know, a
> branch is not really different to a Tag, I thought that i could
> CVSSCM.TagAction.

This sounds very interesting. Is that going to be a patch for
CVSSCM.TagAction or are you writing a separate plugin? (it probably
makes the most sense as a patch to the core.)

Would you be interested in sharing it with the community?


> Because of some restrictions, this doesn't work for me, and therefore I am now extending TaskAction.
> After implementing the stuff that I need, i noticed that it is quite
> similar to the way the CVS TagAction looks and therefore I decided that
> it would be great if I could also a quite similar jelly-script.

OK.

> Now to my problem: I have this input-field for the branch name, just
> like the one for the tag name when tagging CVS builds. ´

> Just like at the tagging, I want to check the input, using the checkUrl
> parameter in my jelly input-field and by having a method - yes you
> guessed it - called "doCheckBranch(..)". It works similar to the
> "doCheckTag(..)" method from CVS TagAction but somehow I cannot access it.
>  
> This is what the jelly-part looks like:
> <input type="text" name="upstream.${up.key.name}" value="yeah-right" class="validated"
>
> checkUrl="'checkBranch?value='+escape(this.value)"/>
>
> Here is the Java part:
>
> public synchronized void doCheckBranch(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { ... }
>
>  
>
> When i try it this way, i get the error:  
> Http error 404: NOT_FOUND RequestURI:=/job/cvstest/442/checkBranch
This is hitting the wrong URL. I suppose you meant this to go to:

   /job/cvstest/442/YOURACTIONNAME/checkBranch

This in turn is presumably because you are accessing your form at

   /job/cvstest/442/YOURACTIONNAME

where it should really be:

   /job/cvstest/442/YOURACTIONNAME/

> Now this is strange, because when I look at the request URI from the CVS Tag Action, its quite the same but it includes "tagBuild" -> (getUrlName()) from the CVS Tag Action. Looks like this: job/cvstest/442/tagBuild/checkTag?value=iamavalue
>
> getUrlName() from my class CVS Branch Action returns "branchBuild" and this is also correct displayed in the address bar of my browser. If i add "branchBuild" to the request URI myself, I just end up with the whole "branchBuild" site in the position where i wanted to execute my doCheckBranch() method.
>
> Like this:
>
> <input type="text" name="upstream.${up.key.name}" value="yeah-right" class="validated"
>
> checkUrl="'${it.urlName}/checkBranch?value='+escape(this.value)"/>
>
>  If I enter the path to the method completely hardcoded, I end up with no error, but the method is also never called.
>
> Has anybody any idea?



--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/


smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Re: Problem with doCheck()

Weichselbaumer Michael (MWE 4170)

Weichselbaumer Michael wrote:
>> Hello everbody!
>>  
>> I have a problem, which i don't understand at all. I am trying to
>> implement a class for branching CVS and Subversion builds. Currently
>> I'm putting my focus on doing the CVS branch. Because, as far as i
>> know, a branch is not really different to a Tag, I thought that i
>> could CVSSCM.TagAction.

>This sounds very interesting. Is that going to be a patch for CVSSCM.TagAction or are you writing a separate
>plugin? (it probably makes the most sense as a patch to the core.)

>Would you be interested in sharing it with the community?

Of course I would, but at this moment, my BranchAction just extends TaskAction and implements BuildBadgeAction. It distincts between CVS and Subversion, and for branching in Subversion, I use the Subversion tagging plugin. I think the easiest way to provide the "branching-feature" is to create a new AbstractSCMBranchAction which is quite similiar to the original AbstractSCMTagAction and then make a CVSSCMBranchAction extend it. It would look quite the same, the only difference is that you have to add "-b" as parameter to the ArgumentListBuilder before adding "-R" and the branchName. For some reason, I am unable to work with the normal Subversion-classe provided by Hudson, but I think creating a SubversionBranchAction which also extends the AbstractBranchAction would work. Because I don't know how to contribute to your project, and the modification being so minor, I guess it would be the easiest way if you do this modification on your own - maybe you want to implement it even smarter than I suggested.


>> Because of some restrictions, this doesn't work for me, and therefore I am now extending TaskAction.
>> After implementing the stuff that I need, i noticed that it is quite
>> similar to the way the CVS TagAction looks and therefore I decided
>> that it would be great if I could also a quite similar jelly-script.

>OK.

>> Now to my problem: I have this input-field for the branch name, just
>> like the one for the tag name when tagging CVS builds. ´

>> Just like at the tagging, I want to check the input, using the
>> checkUrl parameter in my jelly input-field and by having a method -
>> yes you guessed it - called "doCheckBranch(..)". It works similar to
>> the "doCheckTag(..)" method from CVS TagAction but somehow I cannot access it.
>>  
>> This is what the jelly-part looks like:
>> <input type="text" name="upstream.${up.key.name}" value="yeah-right" class="validated"
>>
>> checkUrl="'checkBranch?value='+escape(this.value)"/>
>>
>> Here is the Java part:
>>
>> public synchronized void doCheckBranch(StaplerRequest req,
>> StaplerResponse rsp) throws IOException, ServletException { ... }
>>
>>  
>>
>> When i try it this way, i get the error:  
>> Http error 404: NOT_FOUND RequestURI:=/job/cvstest/442/checkBranch

>This is hitting the wrong URL. I suppose you meant this to go to:

>  /job/cvstest/442/YOURACTIONNAME/checkBranch

>This in turn is presumably because you are accessing your form at

>  /job/cvstest/442/YOURACTIONNAME

>where it should really be:

>  /job/cvstest/442/YOURACTIONNAME/

>> Now this is strange, because when I look at the request URI from the
>> CVS Tag Action, its quite the same but it includes "tagBuild" ->
>> (getUrlName()) from the CVS Tag Action. Looks like this:
>> job/cvstest/442/tagBuild/checkTag?value=iamavalue
>>
>> getUrlName() from my class CVS Branch Action returns "branchBuild" and this is also correct displayed in
>>the address bar of my browser. If i add "branchBuild" to the request URI myself, I just end up with the whole
>>"branchBuild" site in the position where i wanted to execute my doCheckBranch() method.
>>
>> Like this:
>>
>> <input type="text" name="upstream.${up.key.name}" value="yeah-right" class="validated"
>>
>> checkUrl="'${it.urlName}/checkBranch?value='+escape(this.value)"/>
>>
>>  If I enter the path to the method completely hardcoded, I end up with no error, but the method is also never called.
>>
>> Has anybody any idea?



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]