Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RESTEASY-1808] Tests for client redirection
- Loading branch information
1 parent
a276040
commit 5fce22d
Showing
4 changed files
with
293 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...on-tests/src/test/java/org/jboss/resteasy/test/client/resource/RedirectProxyResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.jboss.resteasy.test.client.resource; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
import javax.ws.rs.core.Response; | ||
|
||
@Path("/") | ||
public interface RedirectProxyResource | ||
{ | ||
|
||
@Path("redirect/{p}") | ||
@GET | ||
Response redirect(@PathParam("p") String p); | ||
|
||
@Path("redirected") | ||
@GET | ||
Response redirected(); | ||
|
||
|
||
@Path("redirectDirectResponse/{p}") | ||
@GET | ||
Response redirectDirectResponse(@PathParam("p") String p); | ||
|
||
@Path("redirectedDirectResponse") | ||
@GET | ||
String redirectedDirectResponse(); | ||
|
||
@Path("movedPermanently/{p}") | ||
@GET | ||
Response movedPermanently(@PathParam("p") String p); | ||
|
||
|
||
@Path("found/{p}") | ||
@GET | ||
Response found(@PathParam("p") String p); | ||
} |
63 changes: 63 additions & 0 deletions
63
...gration-tests/src/test/java/org/jboss/resteasy/test/client/resource/RedirectResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package org.jboss.resteasy.test.client.resource; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.POST; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
import javax.ws.rs.core.Response; | ||
|
||
import org.jboss.resteasy.utils.PortProviderUtil; | ||
|
||
@Path("/") | ||
public class RedirectResource | ||
{ | ||
@Path("redirect/{p}") | ||
@GET | ||
public Response redirect(@PathParam("p") String p) | ||
{ | ||
return Response.temporaryRedirect(PortProviderUtil.createURI("/redirected", p)).build(); | ||
} | ||
|
||
@Path("redirected") | ||
@GET | ||
public Response redirected() | ||
{ | ||
return Response.ok("OK").build(); | ||
} | ||
|
||
@Path("post-redirect") | ||
@POST | ||
public Response postRedirect(String p) | ||
{ | ||
return Response.seeOther(PortProviderUtil.createURI("/redirected", p)).build(); | ||
} | ||
|
||
@Path("redirectDirectResponse/{p}") | ||
@GET | ||
public Response redirectDirectResponse(@PathParam("p") String p) | ||
{ | ||
return Response.temporaryRedirect(PortProviderUtil.createURI("/redirectedDirectResponse", p)).build(); | ||
} | ||
|
||
@Path("redirectedDirectResponse") | ||
@GET | ||
public String redirectedDirectResponse() | ||
{ | ||
return "ok - direct response"; | ||
} | ||
|
||
|
||
@Path("movedPermanently/{p}") | ||
@GET | ||
public Response movedPermanently(@PathParam("p") String p) | ||
{ | ||
return Response.status(301).header("location", PortProviderUtil.createURI("/redirectedDirectResponse", p)).build(); | ||
} | ||
|
||
@Path("found/{p}") | ||
@GET | ||
public Response found(@PathParam("p") String p) | ||
{ | ||
return Response.status(302).header("location", PortProviderUtil.createURI("/redirectedDirectResponse", p)).build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters