Ignore:
Timestamp:
2013-04-20T02:24:00+02:00 (11 years ago)
Author:
Don-vip
Message:

see #8606 - Fix user-agent used with JEditorPage.setPage() or JEditorPane(URL) + fix version number from previous commit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/widgets/JosmEditorPane.java

    r5886 r5887  
    33
    44import java.io.IOException;
     5import java.io.InputStream;
    56import java.net.URL;
     7import java.net.URLConnection;
    68
    79import javax.swing.JEditorPane;
    810
     11import org.openstreetmap.josm.tools.Utils;
     12
    913/**
    10  * Subclass of {@link JEditorPane} that adds a "native" context menu (cut/copy/paste/select all).
    11  * @since 5885
     14 * Subclass of {@link JEditorPane} that adds a "native" context menu (cut/copy/paste/select all)
     15 * and effectively uses JOSM user agent when performing HTTP request in {@link #setPage(URL)} method.
     16 * @since 5886
    1217 */
    1318public class JosmEditorPane extends JEditorPane {
     
    5964        setText(text);
    6065    }
     66
     67    @Override
     68    protected InputStream getStream(URL page) throws IOException {
     69        URLConnection conn = Utils.setupURLConnection(page.openConnection());
     70        InputStream result = conn.getInputStream();
     71        String type = conn.getContentType();
     72        if (type != null) {
     73            setContentType(type);
     74        }
     75        return result;
     76    }
    6177}
Note: See TracChangeset for help on using the changeset viewer.