Tag:

JAX-RS POST无法将空xlsx作为MIMEtypes返回

这是我的JAX-RS GET服务的代码 @GET @Produces("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") @Path("/xlsReport") public Response viewXlsReport(@QueryParam("paymentIds")String paymentIds) throws IOException { List spaymentIds = Arrays.asList(paymentIds.split(",")); XSSFWorkbook wb = new XSSFWorkbook(); XSSFSheet s1 = wb.createSheet("Some Details"); File f = new File("Some Details.xslx"); FileOutputStream fos = new FileOutStream(f); wb.write(fos); fos.close(); return Response.ok((Object)file).build(); } 和POST服务是一样的 @POST @Produces("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") @Path("/exportReport") @Consumes(MediaType.APPLICATION_JSON) public Response viewXlsReport(String ids) throws IOException { List<string> […]

使用POST Rest服务下载Excel

我正在使用Spring Framework提供的REST Web服务。 我需要下载一个Excel工作表,但我也需要根据一些选定的参数来下载表格。 我发送一个请求类对象作为正文到一个POSTrest调用(@RequestBody) 我无法使用POST方法下载Excel。 请帮我做到这一点。 @RequestMapping(value = "/search/export", method = RequestMethod.POST,, produces = MediaType.APPLICATION_JSON_VALUE) public void searchResultToExcel(@RequestBody SearchRequest searchRequest, HttpServletResponse response, HttpServletRequest request) throws Exception 这是我的方法签名

使用Excel VBA代码发送POST和检索数据

什么VBA代码将允许我发送POST请求(在aspsearch框中),然后检索<span id="xxx"></span>标签之间的数据? (在结果页面中) 我有以下代码模拟页面中的search请求: Dim Site As Object Set Site = CreateObject("InternetExplorer.application") Dim QNUMBER As String Dim URL As String URL = "apps/inventory/Default.aspx" 'local website QNUMBER = textBox_Scan.Text Site.navigate URL While Site.busy Wend Dim oHTMLDoc As Object Set oHTMLDoc = Site.document oHTMLDoc.getElementById("input_search").Value = QNUMBER oHTMLDoc.getElementById("btn_search").Click 这样做并不“干净”,我觉得发送POST请求会更合适。 谢谢。 [编辑] 这是表单代码 <form name="aspnetForm" method="post" action="Default.aspx" id="aspnetForm"> input文本ID […]

如何编写使用Excel文件的RestService Post?

我必须编写一个使用Excel文件的Restful服务将其映射到一个类中,并将其写入DataBase中。 @POST @Path("/insertDataInDB) @Consumes(MediaType.???) public Response insertDataInDB(???) { //do Stuff } 我的第一个想法是使用ByteStream,而不是用Apache POI来解释stream。 但是在这里我得到一个例外:“org.jboss.resteasy.spi.UnsupportedMediaTypeException” @POST @Path("/insertDataInDB") @Consumes(MediaType.MULTIPART_FORM_DATA) public void insertDataInDB(@FormDataParam("inputfile") File inputfile) { //do Stuff } 有没有人有一个想法什么MediaType使用什么样的Java数据types? 还是有人有个更好的主意?

在VBA Http发布

我想弄清楚如何在VBA中进行POST。 理想情况下,我正在寻找一个我可以玩的简单工作例子。 这是我迄今为止,但我不知道该怎么办。 大部分是什么forms的数据看起来像。 Function WinHTTPPostRequest(URL, formdata, Boundary) Dim http Set http = CreateObject("MSXML2.XMLHTTP") http.Open "POST", URL, False 'Set Content-Type header' http.setRequestHeader "Content-Type", "multipart/form-data; boundary=" + Boundary 'Send the form data To URL As POST binary request' http.send formdata 'Get a result of the script which has received upload' WinHTTPPostRequest = http.responseText End Function 编辑: […]