Search in sources :

Example 11 with ResteasyUriInfo

use of org.jboss.resteasy.specimpl.ResteasyUriInfo in project resteasy by resteasy.

the class TrailingSlashTest method doTwoArgConstructorTest.

void doTwoArgConstructorTest(URI base, URI relative, String path) throws URISyntaxException {
    ResteasyUriInfo ruri = new ResteasyUriInfo(base, relative);
    Assert.assertEquals(ERROR_MSG, path, ruri.getPath());
    Assert.assertEquals(ERROR_MSG, path, ruri.getPath(true));
    Assert.assertEquals(ERROR_MSG, path, ruri.getPath(false));
    URI newUri;
    if (base.toString().endsWith("/")) {
        newUri = new URI(base.toString().substring(0, base.toString().length() - 1) + path);
    } else {
        newUri = new URI(base.toString() + path);
    }
    Assert.assertEquals(ERROR_MSG, newUri, ruri.getAbsolutePath());
}
Also used : ResteasyUriInfo(org.jboss.resteasy.specimpl.ResteasyUriInfo) URI(java.net.URI)

Example 12 with ResteasyUriInfo

use of org.jboss.resteasy.specimpl.ResteasyUriInfo in project resteasy by resteasy.

the class TrailingSlashTest method doTwoStringArgConstructorTest.

void doTwoStringArgConstructorTest(String s, String path) throws URISyntaxException {
    ResteasyUriInfo ruri = new ResteasyUriInfo(s, "");
    URI uri = new URI(s);
    Assert.assertEquals(ERROR_MSG, path, ruri.getPath());
    Assert.assertEquals(ERROR_MSG, path, ruri.getPath(true));
    Assert.assertEquals(ERROR_MSG, path, ruri.getPath(false));
    Assert.assertEquals(ERROR_MSG, uri, ruri.getAbsolutePath());
    Assert.assertEquals(ERROR_MSG, uri, ruri.getBaseUri().resolve(ruri.getPath(false)));
}
Also used : ResteasyUriInfo(org.jboss.resteasy.specimpl.ResteasyUriInfo) URI(java.net.URI)

Example 13 with ResteasyUriInfo

use of org.jboss.resteasy.specimpl.ResteasyUriInfo in project resteasy by resteasy.

the class TrailingSlashTest method doOneArgConstructorTest.

void doOneArgConstructorTest(URI uri, String path) {
    ResteasyUriInfo ruri = new ResteasyUriInfo(uri);
    Assert.assertEquals(ERROR_MSG, path, ruri.getPath());
    Assert.assertEquals(ERROR_MSG, path, ruri.getPath(true));
    Assert.assertEquals(ERROR_MSG, path, ruri.getPath(false));
    Assert.assertEquals(ERROR_MSG, uri, ruri.getAbsolutePath());
    Assert.assertEquals(ERROR_MSG, uri, ruri.getBaseUri().resolve(ruri.getPath(false)));
}
Also used : ResteasyUriInfo(org.jboss.resteasy.specimpl.ResteasyUriInfo)

Example 14 with ResteasyUriInfo

use of org.jboss.resteasy.specimpl.ResteasyUriInfo in project resteasy by resteasy.

the class TrailingSlashTest method doTwoArgConstructorTest.

void doTwoArgConstructorTest(String s, String path) throws URISyntaxException {
    ResteasyUriInfo ruri = new ResteasyUriInfo(s, "");
    URI uri = new URI(s);
    Assert.assertEquals(ERROR_MSG, path, ruri.getPath());
    Assert.assertEquals(ERROR_MSG, path, ruri.getPath(true));
    Assert.assertEquals(ERROR_MSG, path, ruri.getPath(false));
    Assert.assertEquals(ERROR_MSG, uri, ruri.getAbsolutePath());
    Assert.assertEquals(ERROR_MSG, uri, ruri.getBaseUri().resolve(ruri.getPath(false)));
}
Also used : ResteasyUriInfo(org.jboss.resteasy.specimpl.ResteasyUriInfo) URI(java.net.URI)

Example 15 with ResteasyUriInfo

use of org.jboss.resteasy.specimpl.ResteasyUriInfo in project resteasy by resteasy.

the class ResourceMethodInvoker method invokeDryRun.

public CompletionStage<Object> invokeDryRun(HttpRequest request, HttpResponse response, Object target) {
    request.setAttribute(ResourceMethodInvoker.class.getName(), this);
    incrementMethodCount(request.getHttpMethod());
    ResteasyUriInfo uriInfo = (ResteasyUriInfo) request.getUri();
    if (method.getPath() != null) {
        uriInfo.pushMatchedURI(uriInfo.getMatchingPath());
    }
    uriInfo.pushCurrentResource(target);
    return invokeOnTargetDryRun(request, response, target);
}
Also used : ResteasyUriInfo(org.jboss.resteasy.specimpl.ResteasyUriInfo)

Aggregations

ResteasyUriInfo (org.jboss.resteasy.specimpl.ResteasyUriInfo)42 URI (java.net.URI)19 UriInfo (javax.ws.rs.core.UriInfo)14 Test (org.junit.jupiter.api.Test)14 Pager (com.redhat.cloud.policies.app.model.pager.Pager)8 Test (org.junit.Test)6 ResteasyHttpHeaders (org.jboss.resteasy.specimpl.ResteasyHttpHeaders)5 HttpServletRequest (jakarta.servlet.http.HttpServletRequest)4 NotFoundException (jakarta.ws.rs.NotFoundException)4 IOException (java.io.IOException)3 WebQuery (com.peterphi.std.guice.restclient.jaxb.webquery.WebQuery)2 Context (io.vertx.core.Context)2 HttpServerResponse (io.vertx.core.http.HttpServerResponse)2 PathSegment (jakarta.ws.rs.core.PathSegment)2 ArrayList (java.util.ArrayList)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 SecurityContext (javax.ws.rs.core.SecurityContext)2 HttpRequest (org.jboss.resteasy.spi.HttpRequest)2 HttpResponse (org.jboss.resteasy.spi.HttpResponse)2