我使用Swagger来记录我的REST服务.我的一项服务需要上传CSV文件.在JSON文件中为参数部分指定以下属性后,我可以在我的招摇页面上获取文件上载选项.
{
"name": "File",
"description": "The file in zip format.",
"paramType": "body",
"required": true,
"allowMultiple": false,
"dataType": "file"
}
Run Code Online (Sandbox Code Playgroud)
但是当我选择一个文件然后点击我收到错误NS_ERROR_XPC_BAD_OP_ON_WN_PROTO:在jquery-1.8.0.min.js(第2行)中对WrappedNative原型对象进行非法操作时,它会不断处理,我没有得到任何响应.
我有一个像下面的xml:
<Report xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>HourlyReport</Name>
<Id>8</Id>
<TotalResults>1</TotalResults>
<TotalPages>1</TotalPages>
<Items>
<Item>
<Id>1</Id>
<Hour0>23</Hour0>
<Hour1>12</Hour1>
<Hour2>7</Hour2>
<Hour3>18</Hour3>
<Hour4>32</Hour4>
.
.
.
<Hour20>28</Hour20>
<Hour21>39</Hour21>
<Hour22>51</Hour22>
<Hour23>49</Hour23>
</Item>
</Items>
</Report>
Run Code Online (Sandbox Code Playgroud)
我需要使用xslt从XML上面获取最大值.在上述情况下,最大值为51.我怎么能得到那个?也可以在任何xslt变量中获得这个最大值,所以我可以在其他地方使用它.我没有任何办法.您可以使用任何xslt版本1.0或2.0.
我使用ExtJs创建了一个商店,我想将存储的值加载到ComboBox.但在加载值之前,我需要根据另一个comboBox中选择的值过滤一些数据.
因此,为了这个目的,我认为我需要在商店应用过滤器,请任何身体可以帮助我如何做到这一点.
模型:-
Ext.define('City', {
extend: 'Ext.data.Model',
fields: [
{ name: 'StateId', type: 'string' },
{ name: 'City', type: 'string' },
]});
Run Code Online (Sandbox Code Playgroud)
商店:-
var cityStore = Ext.create('Ext.data.Store', {
model: 'City',
data : [
{ StateId: '1', City: 'Bangalore'},
{ StateId: '1', City: 'Mysore'},
{ StateId: '1', City: 'Dharwad'},
{ StateId: '2', City: 'Mumbai'},
{ StateId: '2', City: 'Pune'},
{ StateId: '2', City: 'Nagpur'}
]});
Run Code Online (Sandbox Code Playgroud)
现在我正在使用这个cityStore加载Combobox.但在加载之前,如果stateId为1,那么只有3条记录(班加罗尔,迈索尔,Dharwad)加载到组合框中,如果stateId为2则其他3条记录加载到组合框中.我怎么能实现它.
我创建了一个接受两件事的服务:
1) 称为“类型”的主体参数。
2) 要上传的 csv 文件。
我正在像这样在服务器端阅读这两件事:
//Read body params
string type = HttpContext.Current.Request.Form["type"];
//read uploaded csv file
Stream csvStream = HttpContext.Current.Request.Files[0].InputStream;
Run Code Online (Sandbox Code Playgroud)
我如何测试这个,我正在使用Fiddler来测试这个,但我一次只能发送一个东西(类型或文件),因为这两个东西都是不同的内容类型,我如何使用内容类型multipart/form-data和application/x-www-form-urlencoded同时进行。
即使我使用此代码
public static void PostDataCSV()
{
//open the sample csv file
byte[] fileToSend = File.ReadAllBytes(@"C:\SampleData.csv");
string url = "http://localhost/upload.xml";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = "multipart/form-data";
request.ContentLength = fileToSend.Length;
using (Stream requestStream = request.GetRequestStream())
{
// Send the file as body request.
requestStream.Write(fileToSend, 0, fileToSend.Length);
requestStream.Close();
} …
Run Code Online (Sandbox Code Playgroud) 我在Extjs中创建了一个组合框,我在其中显示报告的名称,当用户选择任何报告时,应该发布报告的后端ID.我无法得到报告的身份.我正在使用商店来填充组合框中的数据.
我在Extjs中创建了一个模型
Ext.define('Report', {
extend: 'Ext.data.Model',
fields: [
{name: 'ReportId', type: 'int'},
{name: 'DisplayName', type: 'string'}
]
});
Run Code Online (Sandbox Code Playgroud)
商店就像
var reportStore = Ext.create('Ext.data.Store', {
model: 'Report',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'reportlist.json'
});
Run Code Online (Sandbox Code Playgroud)
comboBox就好
var comboReports = Ext.create('Ext.form.field.ComboBox', {
displayField: 'DisplayName',
valueField: 'ReportId',
fieldLabel: 'Report',
store: reportStore,
queryMode: 'local',
emptyText: 'Select a report',
selectOnFocus: true,
listeners: {
select: function(combo, selection) {
if (combo.getValue()) {
//showData(reportId); here i want the id of seleted report to passed.
}
}
} …
Run Code Online (Sandbox Code Playgroud)