<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 03/13/14 11:38, Ade Lee wrote:<br>
</div>
<blockquote
cite="mid:1394735928.4459.43.camel@localhost.localdomain"
type="cite">
<pre wrap="">This patch doesn't future proof against other possible URL changes.
This bug basically arose because we changed the annotation for
CertsResource from "/certs" to "".
</pre>
</blockquote>
<tt>Ade,</tt><tt><br>
</tt><tt><br>
</tt><tt>While I understand your concern about not "future proofing"
against other URL changes, I am confused by your </tt><tt>statement
that '... we changed the annotation for
CertsResource from "/certs" to "".'</tt><tt><br>
</tt><tt>
<br>
All </tt><tt><b>CertResource.java</b></tt><tt> (presuming
"CertsResource.java" is a typo?) files currently contain "/certs"
as a part of their annotations:</tt><tt><br>
</tt>
<ul>
<li><tt>DOGTAG_10_0_BRANCH (Fedora 19 - this ticket):</tt></li>
<ul>
<li><tt>./base/common/src/com/netscape/certsrv/cert/CertResource.java</tt></li>
<ul>
<li><tt>all annotations utilize "certs/{id}", not just "{id}"</tt></li>
</ul>
<li><tt>./base/server/cms/src/com/netscape/cms/servlet/cert/CertService.java</tt></li>
<ul>
<li><tt>currently specifies "{id}" instead of "certs/{id}"
which yields the 404 error:</tt></li>
<ul>
<li><tt>URI uri =
uriInfo.getBaseUriBuilder().path(CertResource.class).path("{id}").build(certId.toHexString());</tt></li>
<li><tt>URI uri =
uriInfo.getBaseUriBuilder().path(CertResource.class).path("{id}").build(id.toHexString());<br>
</tt></li>
</ul>
</ul>
</ul>
<li><tt>DOGTAG_10_1_BRANCH (Fedora 20)</tt></li>
<ul>
<li><tt>./base/common/src/com/netscape/certsrv/cert/CertResource.java</tt></li>
<ul>
<li><tt>all annotations utilize "certs/{id}", not just "{id}"</tt></li>
</ul>
<li><tt>./base/server/cms/src/com/netscape/cms/servlet/cert/CertService.java</tt></li>
<ul>
<li><tt>currently specifies "{id}" instead of "certs/{id}"
which yields the 404 error:</tt></li>
<ul>
<li><tt>URI uri =
uriInfo.getBaseUriBuilder().path(CertResource.class).path("{id}").build(certId.toHexString());</tt></li>
<li><tt>URI uri =
uriInfo.getBaseUriBuilder().path(CertResource.class).path("{id}").build(id.toHexString());<br>
</tt></li>
</ul>
</ul>
</ul>
<li><tt>master (Fedora 21+)</tt></li>
<ul>
<li><tt>./base/common/src/com/netscape/certsrv/cert/CertResource.java</tt></li>
<ul>
<li><tt>all annotations utilize "certs/{id}", not just "{id}"</tt></li>
</ul>
<li><tt>./base/ca/src/org/dogtagpki/server/ca/rest/CertService.java</tt></li>
<ul>
<li><tt>currently specifies "{id}" instead of "certs/{id}"
which yields the 404 error:</tt></li>
<ul>
<li><tt>URI uri =
uriInfo.getBaseUriBuilder().path(CertResource.class).path("{id}").build(certId.toHexString());</tt></li>
<li><tt>URI uri =
uriInfo.getBaseUriBuilder().path(CertResource.class).path("{id}").build(id.toHexString());<br>
</tt></li>
</ul>
</ul>
</ul>
</ul>
<p><tt>Are you requesting that we change </tt><tt><b>CertResource.java</b></tt><tt>
to remove all of the "/certs" prefixes from the annotations
instead of changing the </tt><tt><b>CertService.java</b></tt><tt>
implementations?</tt><tt><br>
</tt></p>
<p><tt>Or, based upon your pastebin:</tt><tt><br>
</tt></p>
<blockquote><tt> uriInfo.getBaseUriBuilder()</tt><tt><br>
</tt><tt> .path(ShowsResource.class, "getShow")</tt><tt><br>
</tt><tt> .build(show.getId());</tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> @Path("shows")</tt><tt><br>
</tt><tt> public class ShowsResource {</tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> @GET</tt><tt><br>
</tt><tt> @Path("{showId}")</tt><tt><br>
</tt><tt> public String getShow (</tt><tt><br>
</tt><tt> @PathParam("showId") long showId) {</tt><tt><br>
</tt><tt> return "HAHAHAHA";</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> Generates: "context-root/45" Instead of
"context-root/shows/45"</tt><tt><br>
</tt></blockquote>
<tt>are you are trying to introduce a new class (e. g. - </tt><tt><b>ShowsResource.java</b></tt><tt>)
which extends all of the other Resource classes so that
implementation Service classes such as </tt><tt><b>CertService.java</b></tt><tt>
will call </tt><tt><b>ShowsResource.class</b></tt><tt> instead of
their </tt><tt><b>CertResource.class</b></tt><tt> directly?</tt><tt><br>
</tt><tt><br>
</tt><tt>I presume that this interim class would provide an
unchanging interface to all of the underlying Resource classes
(but perhaps its annotations might need to change whenever an
underlying Resource changes)?</tt><tt><br>
</tt><tt></tt><tt><br>
</tt><tt>To fix the immediate bug, could we simply check in my
change to the various branches and create a ticket for this work?<br>
Presuming that the other two tickets ( <a
href="https://fedorahosted.org/pki/ticket/728">PKI TRAC Ticket
#728 - null pointer exception thrown when processing 501 from
dogtag 9-> 10 instance</a> and <a
href="https://fedorahosted.org/pki/ticket/802">PKI TRAC Ticket
#802 - Tomcat running as root</a>) do not need to be fixed at
this time, this would allow us to proceed with getting the Dogtag
10.0.7 builds finalized so that I can move on to the more pressing
Dogtag 10.1.1 issue.</tt><tt><br>
<br>
Thanks,<br>
-- Matt<br>
</tt>
<blockquote
cite="mid:1394735928.4459.43.camel@localhost.localdomain"
type="cite">
<pre wrap="">
I think you should be rather mapping to the relevant GET method instead
using:
<a class="moz-txt-link-freetext" href="http://docs.oracle.com/javaee/6/api/javax/ws/rs/core/UriBuilder.html#path%28java.lang.Class,%20java.lang.String%29">http://docs.oracle.com/javaee/6/api/javax/ws/rs/core/UriBuilder.html#path%28java.lang.Class,%20java.lang.String%29</a>
either:
public abstract UriBuilder path(java.lang.Class resource,
java.lang.String method)
or:
public abstract UriBuilder path(java.lang.reflect.Method method)
In fact, we might want to open a ticket to confirm that all the rest of
the URLs are likewise future-proofed against changes.
Ade
On Fri, 2014-03-07 at 18:48 -0800, Matthew Harmsen wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Please review the following patch which addresses:
* PKI TRAC Ticket #868 - REST API get certs links missing
segment
This patch has been tested on the DOGTAG_10_0_BRANCH as used on Fedora
19:
Prior to the patch, the following URL:
* <a class="moz-txt-link-freetext" href="https://fedora19.example.com:8443/ca/rest/certs">https://fedora19.example.com:8443/ca/rest/certs</a>
produces an XML page which contains XML such as:
* <Link
href=<a class="moz-txt-link-rfc2396E" href="https://fedora19.example.com:8443/ca/rest/0x1">"https://fedora19.example.com:8443/ca/rest/0x1"</a>
rel="self"/>
which produces an 'HTTP Status 404' page.
After the patch has been applied, the same URL produces an XML
page which contains XML such as:
* <Link
href=<a class="moz-txt-link-rfc2396E" href="https://fedora19.example.com:8443/ca/rest/certs/0x1">"https://fedora19.example.com:8443/ca/rest/certs/0x1"</a> rel="self"/>
which corresponds to a valid URL.
NOTE: This patch needs to be applied to the DOGTAG_10_0_BRANCH
(Fedora 19), the DOGTAG_10_1_BRANCH (Fedora 20), and the master
(Fedora 21+).
This patch may also need to be applied to the
IPA_V3_RHEL_7_ERRATA_BRANCH.
_______________________________________________
Pki-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Pki-devel@redhat.com">Pki-devel@redhat.com</a>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/pki-devel">https://www.redhat.com/mailman/listinfo/pki-devel</a>
</pre>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
<br>
</body>
</html>