Jsoup 열기 링크 오류 보고: org.jsoup.UnsupportedMimeTypeException: Unhandled content type Must be text/*

2034 단어

Jsoup 열기 링크 오류 보고: org.jsoup.UnsupportedMimeTypeException: Unhandled content type Must be text/*

  • 샘플 코드
  • 버그 상세 정보
  • 해결 방법
  • 샘플 코드

     String yourUrl = "www.123.com";
     Connection connect = Jsoup.connect(yourUrl);
    

    상세한 상황을 잘못 보고하다.


    org.jsoup.UnsupportedMimeTypeException: Unhandled content type. Must be text/*, application/xml, or application/xhtml+xml. Mimetype=application/json, URL=https://www.123.com at org.jsoup.helper.HttpConnection R e s p o n s e . e x e c u t e ( H t t p C o n n e c t i o n . j a v a : 770 ) a t o r g . j s o u p . h e l p e r . H t t p C o n n e c t i o n Response.execute(HttpConnection.java:770) at org.jsoup.helper.HttpConnection Response.execute(HttpConnection.java:770)atorg.jsoup.helper.HttpConnectionResponse.execute(HttpConnection.java:706) at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:299)

    해결책


    connect 후 아래 코드.ignoreContentType(true)를 추가합니다.
    String yourUrl = "www.123.com";
    Connection connect = Jsoup.connect(yourUrl)
                    .ignoreContentType(true);
    

    좋은 웹페이지 즐겨찾기