소스 검색

use HttpSchemes constants

tags/2.0.1
Jonathan Cobb 4 년 전
부모
커밋
6a3824eee7
4개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. +2
    -1
      wizard-common/src/main/java/org/cobbzilla/wizard/client/ApiClientBase.java
  2. +2
    -1
      wizard-common/src/main/java/org/cobbzilla/wizard/client/script/SimpleApiRunnerListener.java
  3. +2
    -1
      wizard-server/src/main/java/org/cobbzilla/wizard/server/config/LegalInfo.java
  4. +2
    -1
      wizard-server/src/main/java/org/cobbzilla/wizard/server/config/RestServerConfiguration.java

+ 2
- 1
wizard-common/src/main/java/org/cobbzilla/wizard/client/ApiClientBase.java 파일 보기

@@ -43,6 +43,7 @@ import static org.apache.http.HttpHeaders.LOCATION;
import static org.cobbzilla.util.daemon.ZillaRuntime.*;
import static org.cobbzilla.util.http.HttpContentTypes.APPLICATION_OCTET_STREAM;
import static org.cobbzilla.util.http.HttpMethods.*;
import static org.cobbzilla.util.http.HttpSchemes.isHttpOrHttps;
import static org.cobbzilla.util.http.HttpStatusCodes.*;
import static org.cobbzilla.util.io.FileUtil.getDefaultTempDir;
import static org.cobbzilla.util.json.JsonUtil.fromJson;
@@ -341,7 +342,7 @@ public class ApiClientBase implements Cloneable, Closeable {
}

private String getUrl(String path, String clientUri) {
if (path.startsWith("http://") || path.startsWith("https://")) {
if (isHttpOrHttps(path)) {
return path; // caller has supplied an absolute path

} else if (path.startsWith("/") && clientUri.endsWith("/")) {


+ 2
- 1
wizard-common/src/main/java/org/cobbzilla/wizard/client/script/SimpleApiRunnerListener.java 파일 보기

@@ -21,6 +21,7 @@ import java.util.Map;

import static java.util.concurrent.TimeUnit.SECONDS;
import static org.cobbzilla.util.daemon.ZillaRuntime.*;
import static org.cobbzilla.util.http.HttpSchemes.isHttpOrHttps;
import static org.cobbzilla.util.json.JsonUtil.json;
import static org.cobbzilla.util.system.Sleep.sleep;
import static org.cobbzilla.util.time.TimeUtil.parseDuration;
@@ -156,7 +157,7 @@ public class SimpleApiRunnerListener extends ApiRunnerListenerBase {

private String formatUrl(String url) {
final ApiClientBase currentApi = currentApi();
if (!url.startsWith("http://") && !url.startsWith("https://")) {
if (!isHttpOrHttps(url)) {
if (!url.startsWith("/") && !currentApi.getBaseUri().endsWith("/")) url = "/" + url;
url = currentApi.getBaseUri() + url;
}


+ 2
- 1
wizard-server/src/main/java/org/cobbzilla/wizard/server/config/LegalInfo.java 파일 보기

@@ -16,6 +16,7 @@ import java.util.concurrent.ConcurrentHashMap;
import static java.util.concurrent.TimeUnit.DAYS;
import static org.cobbzilla.util.daemon.ZillaRuntime.CLASSPATH_PREFIX;
import static org.cobbzilla.util.daemon.ZillaRuntime.empty;
import static org.cobbzilla.util.http.HttpSchemes.isHttpOrHttps;
import static org.cobbzilla.util.string.StringUtil.chop;
import static org.cobbzilla.util.string.StringUtil.trimQuotes;

@@ -62,7 +63,7 @@ public class LegalInfo {
if (empty(value)) return "";
if (!empty(getBase())) value = chop(getBase(), "/") + "/" + value;

if (value.startsWith("http://") || value.startsWith("https://")) {
if (isHttpOrHttps(value)) {
try {
return HttpUtil.getResponse(value).getEntityString();
} catch (IOException e) {


+ 2
- 1
wizard-server/src/main/java/org/cobbzilla/wizard/server/config/RestServerConfiguration.java 파일 보기

@@ -31,6 +31,7 @@ import java.util.concurrent.TimeUnit;

import static org.cobbzilla.util.daemon.ZillaRuntime.die;
import static org.cobbzilla.util.daemon.ZillaRuntime.empty;
import static org.cobbzilla.util.http.HttpSchemes.SCHEME_HTTP;
import static org.cobbzilla.util.network.NetworkUtil.getLocalhostIpv4;
import static org.cobbzilla.util.reflect.ReflectionUtil.forName;
import static org.cobbzilla.util.reflect.ReflectionUtil.instantiate;
@@ -55,7 +56,7 @@ public class RestServerConfiguration {

@Setter private String publicUriBase;
public String getPublicUriBase () {
if (empty(publicUriBase)) return "http://"+getLocalhostIpv4()+":"+getHttp().getPort();
if (empty(publicUriBase)) return SCHEME_HTTP+getLocalhostIpv4()+":"+getHttp().getPort();
return !empty(publicUriBase) && publicUriBase.endsWith("/") ? publicUriBase.substring(0, publicUriBase.length()-1) : publicUriBase;
}



불러오는 중...
취소
저장