我的代码工作正常,直到昨晚,突然我收到此错误,路由根本无法正常工作.
middleware_stack.js:31Uncaught Error: Handler with name 'route' already exists.
Run Code Online (Sandbox Code Playgroud)
对于像这样的简单路线:
Router.route('/admin/dashboard', {
template:"adminDashboard"
});
Router.route('/admin/create/table', {
template:"create_table"
});
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚错误,我检查了所有的路线.还有其他人遇到过这个错误吗?
我必须以这种格式发送一个帖子请求.
--__X_PAW_BOUNDARY__
Content-Disposition: form-data; name="user_photo[image]"; filename="file.jpg"
Content-Type: image/jpeg
ÿØÿàJFIFHHÿáLExifMM*i
ÿí8Photoshop 3.08BIM8BIM%ÔÙ²é ìøB~ÿÀ
"ÿÄ
ÿĵ}!1AQa"q2¡#B±ÁRÑð$3br
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ
ÿĵw!1AQaq"2B¡±Á #3RðbrÑ
$4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚâãäåæçèéêòóôõö÷øùúÿÛC ÿÛC ÿÝZÿÚ?ü_¢+þæð¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¢(¯ë3þ
Run Code Online (Sandbox Code Playgroud)
我基本上试图在邮件请求中发送一张照片,其名称user_photo[image]
如下图所示:
以下是我考虑过的解决方案的片段:
Call<models.UploadResponse> uploadPhoto(@Path("id") int userId, @Part MultipartBody.Part file);
MultipartBody.Part body = MultipartBody.Part.createFormData("user_photo[image]", file.getName(), requestFile);
Call<models.UploadResponse> call = userRequest.uploadPhoto(62, body);
RequestBody requestFile =
RequestBody.create(MediaType.parse("image/*"), FileUtils.getFile(PhotoUploadActivity.this, fileUri));
Call<models.UploadResponse> call = userRequest.uploadPhoto(62, requestFile);
Call<models.UploadResponse> uploadPhoto(@Path("id") int userId, @Part ("name=\"user_photo[image]\"") RequestBody file);
@Multipart
@POST("users/{id}/user_photos")
Call<models.UploadResponse> uploadPhoto(@Path("id") int userId, @Part("name=\"user_photo[image]\"") RequestBody file);
Run Code Online (Sandbox Code Playgroud)
这是okhttp日志:
D/OkHttp: Content-Type: multipart/form-data; boundary=75e8ae2e-a160-413f-82d1-3afd94f22c43
D/OkHttp: Content-Length: 43706
D/OkHttp: ??????JFIF?????????????????Photoshop …
Run Code Online (Sandbox Code Playgroud) 这是我的大学模特
module.exports = {
attributes: {
name:{
type:'string',
required:true
},
location:{
type:'string',
required:true
},
faculties:{
collection:'faculty',
via:'college'
}
}
};
Run Code Online (Sandbox Code Playgroud)
这是我的教师模型
module.exports = {
attributes: {
name:{
type:'string',
required:true
},
description:{
type:'string'
},
college:{
model:'college',
required:true
}
,
years:{
collection:'year',
via:'faculty'
}
}
};
Run Code Online (Sandbox Code Playgroud)
我的问题是我可以Faculty
在college
属性中添加任何值的new .如果我没有3000大学的大学,我仍然可以添加它,但是college
当我列出所有院系时属性不会显示.如何防止它添加具有无效大学ID的教师?
我正在尝试创建一个返回titleFont和contentFont字体的方法,以便通过返回引用和减少代码长度来提高效率.我知道这很简单,但我没有办法.任何人都可以帮忙.或任何其他选择将被赞赏..抱歉英语不好
这是多次运行的方法..
protected void onPostExecute(Article result) {
super.onPostExecute(result);
TextView txtTitle= (TextView) view.findViewById(R.id.title);
txtTitle.setTypeface(titleFont);
txtTitle.setText(result.getTitle());
private Typeface titleFont=Typeface.createFromAsset(context.getAssets(),"fonts/InterstateCondMonoLgt.ttf");
private Typeface contentFont=Typeface.createFromAsset(context.getAssets(),"fonts/InterstateLight.ttf");
TextView txtMain= (TextView) view.findViewById(R.id.main);
txtMain.setTypeface(contentFont);
txtMain.setText(result.getContent());
}
Run Code Online (Sandbox Code Playgroud) 这个问题一直困扰着我.我花了很多时间来解决这个问题但却失败了.首先,我使用的是最新的SDK(版本22).
每当我通过首选项> Android>库将Facebook添加到我的项目时,我在控制台中显示错误.
[2014-06-03 15:15:04 - Test] Found 3 versions of android-support-v4.jar in the dependency list,
[2014-06-03 15:15:04 - Test] but not all the versions are identical (check is based on SHA-1 only at this time).
[2014-06-03 15:15:04 - Test] All versions of the libraries must be the same at this time.
[2014-06-03 15:15:04 - Test] Versions found are:
[2014-06-03 15:15:04 - Test] Path: /home/bipin/NewProjectsWorkspace/Test/libs/android-support-v4.jar
[2014-06-03 15:15:04 - Test] Length: 648327
[2014-06-03 15:15:04 - Test] SHA-1: ded9acc6a9792b8f1afc470f0c9cd36d178914cd
[2014-06-03 15:15:04 - …
Run Code Online (Sandbox Code Playgroud)