Skip to content

Commit

Permalink
fix #945
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartofanych committed Dec 14, 2024
1 parent 2f7bc6c commit a89631f
Show file tree
Hide file tree
Showing 30 changed files with 281 additions and 228 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/takes/facets/auth/PsBasic.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import org.takes.facets.forward.RsForward;
import org.takes.misc.Opt;
import org.takes.rq.RqHeaders;
import org.takes.rq.RqHref;
import org.takes.rq.RqHrefBase;
import org.takes.rs.RsWithHeader;

/**
Expand Down Expand Up @@ -99,7 +99,7 @@ public Opt<Identity> enter(final Request request) throws IOException {
)
),
HttpURLConnection.HTTP_UNAUTHORIZED,
new RqHref.Base(request).href()
new RqHrefBase(request).href()
);
}
final String decoded = new IoCheckedText(
Expand All @@ -126,7 +126,7 @@ public Opt<Identity> enter(final Request request) throws IOException {
)
),
HttpURLConnection.HTTP_UNAUTHORIZED,
new RqHref.Base(request).href()
new RqHrefBase(request).href()
);
}
return identity;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/auth/PsByFlag.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.takes.Request;
import org.takes.Response;
import org.takes.misc.Opt;
import org.takes.rq.RqHref;
import org.takes.rq.RqHrefBase;

/**
* Passes by flag.
Expand Down Expand Up @@ -94,7 +94,7 @@ public PsByFlag(final String flg, final Map<Pattern, Pass> map) {

@Override
public Opt<Identity> enter(final Request req) throws Exception {
final Iterator<String> flg = new RqHref.Base(req).href()
final Iterator<String> flg = new RqHrefBase(req).href()
.param(this.flag).iterator();
Opt<Identity> user = new Opt.Empty<>();
if (flg.hasNext()) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/auth/XeLogoutLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.io.IOException;
import lombok.EqualsAndHashCode;
import org.takes.Request;
import org.takes.rq.RqHref;
import org.takes.rq.RqHrefBase;
import org.takes.rs.xe.XeLink;
import org.takes.rs.xe.XeWrap;

Expand Down Expand Up @@ -62,7 +62,7 @@ public XeLogoutLink(final Request req, final String rel,
super(
new XeLink(
rel,
new RqHref.Base(req).href().with(
new RqHrefBase(req).href().with(
flag, PsLogout.class.getSimpleName()
).toString()
)
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/auth/social/PsFacebook.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import org.takes.facets.auth.Pass;
import org.takes.misc.Href;
import org.takes.misc.Opt;
import org.takes.rq.RqHref;
import org.takes.rq.RqHrefBase;

/**
* Facebook OAuth landing/callback page.
Expand Down Expand Up @@ -142,7 +142,7 @@ public PsFacebook(final String fapp, final String fkey) {
@Override
public Opt<Identity> enter(final Request trequest)
throws IOException {
final Href href = new RqHref.Base(trequest).href();
final Href href = new RqHrefBase(trequest).href();
final Iterator<String> code = href.param(PsFacebook.CODE).iterator();
if (!code.hasNext()) {
throw new HttpException(
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/auth/social/PsGithub.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.takes.facets.auth.Pass;
import org.takes.misc.Href;
import org.takes.misc.Opt;
import org.takes.rq.RqHref;
import org.takes.rq.RqHrefBase;

/**
* Github OAuth landing/callback page.
Expand Down Expand Up @@ -116,7 +116,7 @@ public PsGithub(final String gapp, final String gkey) {
@Override
public Opt<Identity> enter(final Request request)
throws IOException {
final Href href = new RqHref.Base(request).href();
final Href href = new RqHrefBase(request).href();
final Iterator<String> code = href.param(PsGithub.CODE).iterator();
if (!code.hasNext()) {
throw new HttpException(
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/auth/social/PsGoogle.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.takes.facets.auth.Pass;
import org.takes.misc.Href;
import org.takes.misc.Opt;
import org.takes.rq.RqHref;
import org.takes.rq.RqHrefBase;

/**
* Google OAuth landing/callback page.
Expand Down Expand Up @@ -145,7 +145,7 @@ public PsGoogle(final String gapp, final String gkey,
@Override
public Opt<Identity> enter(final Request request)
throws IOException {
final Href href = new RqHref.Base(request).href();
final Href href = new RqHrefBase(request).href();
final Iterator<String> code = href.param(PsGoogle.CODE).iterator();
if (!code.hasNext()) {
throw new HttpException(
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/auth/social/PsLinkedin.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.takes.facets.auth.Pass;
import org.takes.misc.Href;
import org.takes.misc.Opt;
import org.takes.rq.RqHref;
import org.takes.rq.RqHrefBase;

/**
* Linkedin OAuth landing/callback page.
Expand Down Expand Up @@ -110,7 +110,7 @@ public PsLinkedin(final Href thref, final Href ahref,
@Override
public Opt<Identity> enter(final Request request)
throws IOException {
final Href href = new RqHref.Base(request).href();
final Href href = new RqHrefBase(request).href();
final Iterator<String> code = href.param(PsLinkedin.CODE).iterator();
if (!code.hasNext()) {
throw new HttpException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.takes.Request;
import org.takes.facets.auth.PsByFlag;
import org.takes.misc.Href;
import org.takes.rq.RqHref;
import org.takes.rq.RqHrefBase;
import org.takes.rs.xe.XeLink;
import org.takes.rs.xe.XeSource;
import org.takes.rs.xe.XeWrap;
Expand Down Expand Up @@ -86,7 +86,7 @@ private static XeSource make(final Request req, final CharSequence app,
.with("client_id", app)
.with(
"redirect_uri",
new RqHref.Base(req).href()
new RqHrefBase(req).href()
.with(flag, PsFacebook.class.getSimpleName())
)
);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/auth/social/XeGithubLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.takes.Request;
import org.takes.facets.auth.PsByFlag;
import org.takes.misc.Href;
import org.takes.rq.RqHref;
import org.takes.rq.RqHrefBase;
import org.takes.rs.xe.XeLink;
import org.takes.rs.xe.XeSource;
import org.takes.rs.xe.XeWrap;
Expand Down Expand Up @@ -86,7 +86,7 @@ private static XeSource make(final Request req, final CharSequence app,
.with("client_id", app)
.with(
"redirect_uri",
new RqHref.Base(req).href()
new RqHrefBase(req).href()
.with(flag, PsGithub.class.getSimpleName())
)
);
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/org/takes/facets/auth/social/XeGoogleLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
import lombok.EqualsAndHashCode;
import org.takes.Request;
import org.takes.misc.Href;
import org.takes.rq.RqHref;
import org.takes.rq.RqHrefBase;
import org.takes.rq.RqHrefSmart;
import org.takes.rs.xe.XeLink;
import org.takes.rs.xe.XeSource;
import org.takes.rs.xe.XeWrap;
Expand All @@ -50,7 +51,7 @@ public final class XeGoogleLink extends XeWrap {
*/
public XeGoogleLink(final Request req, final CharSequence app)
throws IOException {
this(req, app, new RqHref.Smart(new RqHref.Base(req)).home());
this(req, app, new RqHrefSmart(new RqHrefBase(req)).home());
}

/**
Expand Down Expand Up @@ -100,7 +101,7 @@ private static XeSource make(final Request req, final CharSequence app,
.with("client_id", app)
.with("redirect_uri", redir)
.with("response_type", "code")
.with("state", new RqHref.Base(req).href())
.with("state", new RqHrefBase(req).href())
.with(
"scope",
"https://www.googleapis.com/auth/userinfo.profile"
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/fallback/FbLog4j.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.cactoos.bytes.BytesOf;
import org.cactoos.text.TextOf;
import org.takes.misc.Opt;
import org.takes.rq.RqHref;
import org.takes.rq.RqHrefBase;
import org.takes.rq.RqMethod;

/**
Expand Down Expand Up @@ -61,7 +61,7 @@ private static void log(final RqFallback req) throws IOException {
String.format(
"%s %s failed with %s: %s",
new RqMethod.Base(req).method(),
new RqHref.Base(req).href(),
new RqHrefBase(req).href(),
req.code(),
new TextOf(new BytesOf(req.throwable()))
)
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/fallback/FbSlf4j.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.takes.misc.Opt;
import org.takes.rq.RqHref;
import org.takes.rq.RqHrefBase;
import org.takes.rq.RqMethod;

/**
Expand Down Expand Up @@ -69,7 +69,7 @@ private static void log(final RqFallback req) throws IOException {
FbSlf4j.LOGGER.error(
"{} {} failed with {}: {}",
new RqMethod.Base(req).method(),
new RqHref.Base(req).href(),
new RqHrefBase(req).href(),
req.code(),
new TextOf(new BytesOf(req.throwable()))
);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/fallback/TkFallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.takes.Response;
import org.takes.Take;
import org.takes.misc.Opt;
import org.takes.rq.RqHref;
import org.takes.rq.RqHrefBase;
import org.takes.rq.RqMethod;
import org.takes.rs.ResponseOf;
import org.takes.tk.TkWrap;
Expand Down Expand Up @@ -232,7 +232,7 @@ private static Throwable error(final Throwable exp, final Request req,
String.format(
"[%s %s] failed in %s: %s",
new RqMethod.Base(req).method(),
new RqHref.Base(req).href(),
new RqHrefBase(req).href(),
time, TkFallback.msg(exp)
),
exp
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/fork/FkParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.takes.Response;
import org.takes.Take;
import org.takes.misc.Opt;
import org.takes.rq.RqHref;
import org.takes.rq.RqHrefBase;

/**
* Fork by query params and their values, matched by regular express.
Expand Down Expand Up @@ -82,7 +82,7 @@ public FkParams(final String param, final Pattern ptn, final Take tke) {

@Override
public Opt<Response> route(final Request req) throws Exception {
final Iterator<String> params = new RqHref.Base(req).href()
final Iterator<String> params = new RqHrefBase(req).href()
.param(this.name).iterator();
final Opt<Response> resp;
if (params.hasNext()
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/fork/FkRegex.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.takes.Response;
import org.takes.Take;
import org.takes.misc.Opt;
import org.takes.rq.RqHref;
import org.takes.rq.RqHrefBase;
import org.takes.tk.TkFixed;
import org.takes.tk.TkText;

Expand Down Expand Up @@ -202,7 +202,7 @@ public FkRegex setRemoveTrailingSlash(final boolean enabled) {

@Override
public Opt<Response> route(final Request req) throws Exception {
String path = new RqHref.Base(req).href().path();
String path = new RqHrefBase(req).href().path();
if (
this.removeslash
&& path.length() > 1
Expand Down
Loading

0 comments on commit a89631f

Please sign in to comment.