将CURL请求转换为HTTP请求Java?

时间:2016-08-03 08:59:17

标签: java android curl httprequest httpurlconnection

我有以下CURL请求任何人都可以请确认我的子请求HTTP请求

public class TableViewMenuButtonLeak extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage stage) {

        // ** SETUP TABLE **
        final TableView<Record> table = new TableView<>();

        // things go crazy when the table menu button was pressed
        table.setTableMenuButtonVisible(true);

        //generate a bunch of columns
        for(int i = 0; i < 4; i++) {
            TableColumn<Record, String> column1 = new TableColumn<>("column"+i);
            column1.setCellValueFactory(new PropertyValueFactory<Record, String>("column"+i));
            table.getColumns().add(column1);
        }

        // ** CHANGE TABLE SETTINGS FOREVER **
        Runnable r = () -> {
            while(true) {
                Platform.runLater(() -> {
                        table.getColumns().stream().forEach((c) -> c.setPrefWidth(Math.random() * 300));
                        table.getColumns().stream().forEach((c) -> c.setVisible(Math.random() > 0.5 ? true : false));
                });

                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {}
            }
        };

        Thread t = new Thread(r);
        t.setDaemon(true);
        t.start();


        // ** SHOW STUFF **
        stage.setTitle("!!!! Do click onto the \"TableMenuButton\" on the right side of the table (PLUS sign) !!!");
        Scene scene = new Scene(table);
        stage.setWidth(600);
        stage.setHeight(600);
        stage.setScene(scene);
        stage.show();
    }

    public static class Record {

        private final StringProperty column1;
        private final StringProperty column2;

        public Record(String column1, String column2) {
            this.column1 = new SimpleStringProperty(column1);
            this.column2 = new SimpleStringProperty(column2);
        }

        public String getColumn1() {
            return column1.get();
        }

        public StringProperty column1Property() {
            return column1;
        }

        public String getColumn2() {
            return column2.get();
        }

        public StringProperty column2Property() {
            return column2;
        }
    }
}

它会是什么样的?

curl 'http://192.168.2.1/apply.cgi' -H 'Host: 192.168.2.1' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate' -H 'Referer: http://192.168.2.1/Status_file.html' -u admin:admin -H 'Connection: keep-alive' -H 'Content-Type: application/x-www-form-urlencoded' --data 'submit_button=Status_Router&submit_type=Disconnect_pppoe&change_action=gozila_cgi&ethwanpppoe=0&wait_time=3'

任何人都可以帮助我完全将上述卷曲请求转换为httpreq。

提前致谢。

二崁

0 个答案:

没有答案