繁体   English   中英

如何在play框架中发送请求get方法

[英]how to send request get method in play framework

如何在游戏中发送获取方法的请求? 我有播放框架应用程序和Java桌面应用程序。 我想从Java桌面发送一个请求,以使用方法get播放框架。

这是路由文件播放框架

# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~

# Home page
GET     /                                 Application.index
POST    /auth                             Application.authenticator
POST    /datacompany                      Application.getDataCompany
POST    /listdatafile                     Application.getListFile
POST    /urlfile                          Application.getUrlFile
GET     /getFile/{id}                     Application.getFile
# Ignore favicon requests
GET     /favicon.ico                            404

# Map static resources from the /app/public folder to the /public path
GET     /public/                         staticDir:public

# Catch all                 
*/{controller}/{action}                  {controller}.{action}

这是应用程序控制器播放中的方法

  public static void getFile(String id){
   //String id = params.get("id");
        System.out.println("ID : "+id);
        FileInputStream stream = ResumableDownloader.getFile(id);
        renderBinary(stream);
    }

哦,我GET /getFile/{id} Application.getFile只想将请求发送到GET /getFile/{id} Application.getFile

谢谢,抱歉我的英语不好

您需要在Java桌面应用程序中使用HTTP客户端。 查看HttpClient: http : //hc.apache.org/httpcomponents-client-ga/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM