6363import org .apache .commons .lang3 .StringUtils ;
6464import org .apache .commons .logging .Log ;
6565import org .apache .commons .logging .LogFactory ;
66- import org .apache .http .HttpStatus ;
6766import org .apache .http .NoHttpResponseException ;
6867import org .apache .http .client .CredentialsProvider ;
6968import org .apache .http .cookie .MalformedCookieException ;
@@ -594,7 +593,7 @@ public Page loadWebResponseInto(final WebResponse webResponse, final WebWindow w
594593 WebAssert .notNull ("webResponse" , webResponse );
595594 WebAssert .notNull ("webWindow" , webWindow );
596595
597- if (webResponse .getStatusCode () == HttpStatus . SC_NO_CONTENT ) {
596+ if (webResponse .getStatusCode () == HttpClientConverter . NO_CONTENT ) {
598597 return webWindow .getEnclosedPage ();
599598 }
600599
@@ -1576,12 +1575,12 @@ else if (!proxyConfig.shouldBypassProxy(webRequest.getUrl().getHost())) {
15761575
15771576 // Continue according to the HTTP status code.
15781577 final int status = webResponse .getStatusCode ();
1579- if (status == HttpStatus . SC_USE_PROXY ) {
1578+ if (status == HttpClientConverter . USE_PROXY ) {
15801579 getIncorrectnessListener ().notify ("Ignoring HTTP status code [305] 'Use Proxy'" , this );
15811580 }
1582- else if (status >= HttpStatus . SC_MOVED_PERMANENTLY
1581+ else if (status >= HttpClientConverter . MOVED_PERMANENTLY
15831582 && status <= 308
1584- && status != HttpStatus . SC_NOT_MODIFIED
1583+ && status != HttpClientConverter . NOT_MODIFIED
15851584 && getOptions ().isRedirectEnabled ()) {
15861585
15871586 URL newUrl ;
@@ -1617,9 +1616,9 @@ && getOptions().isRedirectEnabled()) {
16171616 + webResponse .getWebRequest ().getUrl (), webResponse );
16181617 }
16191618
1620- if (status == HttpStatus . SC_MOVED_PERMANENTLY
1621- || status == HttpStatus . SC_MOVED_TEMPORARILY
1622- || status == HttpStatus . SC_SEE_OTHER ) {
1619+ if (status == HttpClientConverter . MOVED_PERMANENTLY
1620+ || status == HttpClientConverter . MOVED_TEMPORARILY
1621+ || status == HttpClientConverter . SEE_OTHER ) {
16231622 final WebRequest wrs = new WebRequest (newUrl , HttpMethod .GET );
16241623 wrs .setCharset (webRequest .getCharset ());
16251624
@@ -1631,8 +1630,8 @@ && getOptions().isRedirectEnabled()) {
16311630 }
16321631 return loadWebResponseFromWebConnection (wrs , allowedRedirects - 1 );
16331632 }
1634- else if (status == HttpStatus . SC_TEMPORARY_REDIRECT
1635- || status == 308 ) {
1633+ else if (status == HttpClientConverter . TEMPORARY_REDIRECT
1634+ || status == HttpClientConverter . PERMANENT_REDIRECT ) {
16361635 // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307
16371636 // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308
16381637 // reuse method and body
@@ -1691,11 +1690,11 @@ private WebResponse getWebResponseOrUseCached(
16911690
16921691 final WebResponse webResponse = getWebConnection ().getResponse (webRequest );
16931692
1694- if (webResponse .getStatusCode () >= HttpStatus . SC_INTERNAL_SERVER_ERROR ) {
1693+ if (webResponse .getStatusCode () >= HttpClientConverter . INTERNAL_SERVER_ERROR ) {
16951694 return new WebResponseFromCache (cached , webRequest );
16961695 }
16971696
1698- if (webResponse .getStatusCode () == HttpStatus . SC_NOT_MODIFIED ) {
1697+ if (webResponse .getStatusCode () == HttpClientConverter . NOT_MODIFIED ) {
16991698 final Map <String , NameValuePair > header2NameValuePair = new LinkedHashMap <>();
17001699 for (final NameValuePair pair : cached .getResponseHeaders ()) {
17011700 header2NameValuePair .put (pair .getName (), pair );
0 commit comments