teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

7

情報追加

2017/06/16 09:31

投稿

s.k
s.k

スコア423

title CHANGED
File without changes
body CHANGED
@@ -159,4 +159,15 @@
159
159
  end
160
160
  end
161
161
  end
162
+ ```
163
+
164
+
165
+
166
+ ```
167
+ System.out.println("request");
168
+ Request request = new Request.Builder()
169
+ .url("http://candii.tk/api/v1/images/search") // HTTPアクセス POST送信 テスト確認用ページ
170
+ .post(requestBody)
171
+ .build();
172
+ System.out.println("request");
162
173
  ```

6

情報追加

2017/06/16 09:31

投稿

s.k
s.k

スコア423

title CHANGED
File without changes
body CHANGED
@@ -136,4 +136,27 @@
136
136
  06-16 13:55:24.500 346-391/station.around.aroundsatation D/OpenGLRenderer: Swap behavior 0
137
137
  06-16 13:55:24.559 346-346/station.around.aroundsatation W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
138
138
  06-16 13:55:25.727 346-346/station.around.aroundsatation D/NetworkSecurityConfig: No Network Security Config specified, using platform default
139
+ ```
140
+
141
+ API
142
+ ```Ruby
143
+ module Api
144
+ module V1
145
+ class ImagesController < ApplicationController
146
+ skip_before_filter :verify_authenticity_token
147
+
148
+ def index
149
+ @images = Image.all
150
+ render json: @images
151
+ end
152
+
153
+ def search
154
+ @images = Image.all
155
+ @images.destroy_all
156
+ render json: @images
157
+ end
158
+
159
+ end
160
+ end
161
+ end
139
162
  ```

5

情報追加

2017/06/16 08:07

投稿

s.k
s.k

スコア423

title CHANGED
File without changes
body CHANGED
@@ -107,15 +107,33 @@
107
107
  ### 追加
108
108
 
109
109
 
110
- ```
110
+ ```Java
111
111
  RequestBody body = RequestBody.create(MIMEType, "{\"gps\":\"地下一階\"}");
112
112
  ```
113
113
 
114
- ```
114
+ ```Ruby
115
115
  def search
116
116
  json_request = JSON.parse(request.body.read)
117
117
  @images = Image.where(location: json_request.gps)★変更★
118
118
  @images.destroy_all
119
119
  render json: @images
120
120
  end
121
+ ```
122
+
123
+ ログ
124
+ ```
125
+ 06-16 13:55:23.119 346-346/? I/art: Not late-enabling -Xcheck:jni (already on)
126
+ 06-16 13:55:23.119 346-346/? W/art: Unexpected CPU variant for X86 using defaults: x86
127
+ 06-16 13:55:23.386 346-346/station.around.aroundsatation W/System: ClassLoader referenced unknown path: /data/app/station.around.aroundsatation-2/lib/x86
128
+ 06-16 13:55:23.411 346-346/station.around.aroundsatation I/InstantRun: starting instant run server: is main process
129
+ 06-16 13:55:23.909 346-346/station.around.aroundsatation W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
130
+ 06-16 13:55:24.219 346-353/station.around.aroundsatation W/art: Suspending all threads took: 17.584ms
131
+ 06-16 13:55:24.293 346-346/station.around.aroundsatation D/debug: locationStart()
132
+ 06-16 13:55:24.294 346-346/station.around.aroundsatation D/debug: gpsEnabled
133
+ 06-16 13:55:24.499 346-391/station.around.aroundsatation I/OpenGLRenderer: Initialized EGL, version 1.4
134
+ 06-16 13:55:24.499 346-391/station.around.aroundsatation D/OpenGLRenderer: Swap behavior 1
135
+ 06-16 13:55:24.500 346-391/station.around.aroundsatation W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
136
+ 06-16 13:55:24.500 346-391/station.around.aroundsatation D/OpenGLRenderer: Swap behavior 0
137
+ 06-16 13:55:24.559 346-346/station.around.aroundsatation W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
138
+ 06-16 13:55:25.727 346-346/station.around.aroundsatation D/NetworkSecurityConfig: No Network Security Config specified, using platform default
121
139
  ```

4

情報追加

2017/06/16 04:58

投稿

s.k
s.k

スコア423

title CHANGED
File without changes
body CHANGED
@@ -109,4 +109,13 @@
109
109
 
110
110
  ```
111
111
  RequestBody body = RequestBody.create(MIMEType, "{\"gps\":\"地下一階\"}");
112
+ ```
113
+
114
+ ```
115
+ def search
116
+ json_request = JSON.parse(request.body.read)
117
+ @images = Image.where(location: json_request.gps)★変更★
118
+ @images.destroy_all
119
+ render json: @images
120
+ end
112
121
  ```

3

上記

2017/06/16 04:57

投稿

s.k
s.k

スコア423

title CHANGED
File without changes
body CHANGED
@@ -101,4 +101,12 @@
101
101
 
102
102
 
103
103
 
104
- ご経験ある方、ご助言お願いします。
104
+ ご経験ある方、ご助言お願いします。
105
+
106
+
107
+ ### 追加
108
+
109
+
110
+ ```
111
+ RequestBody body = RequestBody.create(MIMEType, "{\"gps\":\"地下一階\"}");
112
+ ```

2

情報修正

2017/06/16 04:56

投稿

s.k
s.k

スコア423

title CHANGED
File without changes
body CHANGED
@@ -20,10 +20,6 @@
20
20
  / // POST
21
21
  private void postTest() {
22
22
  MediaType MIMEType= MediaType.parse("application/json; charset=utf-8");
23
- RequestBody formBody = new FormBody.Builder()
24
- .add("gps", "地下一階")
25
- .build();
26
-
27
23
  RequestBody body = RequestBody.create(MIMEType, "地下一階");
28
24
 
29
25
 

1

情報追加

2017/06/16 03:43

投稿

s.k
s.k

スコア423

title CHANGED
File without changes
body CHANGED
@@ -82,7 +82,27 @@
82
82
  end
83
83
  ```
84
84
 
85
+ エラーは出ていないと思うのですが、ログはこのようになっています。
86
+ Java側です。
85
87
 
88
+ ```
89
+ 06-16 12:12:54.135 9456-9456/? I/art: Not late-enabling -Xcheck:jni (already on)
90
+ 06-16 12:12:54.135 9456-9456/? W/art: Unexpected CPU variant for X86 using defaults: x86
91
+ 06-16 12:12:54.564 9456-9456/station.around.aroundsatation W/System: ClassLoader referenced unknown path: /data/app/station.around.aroundsatation-1/lib/x86
92
+ 06-16 12:12:54.574 9456-9456/station.around.aroundsatation I/InstantRun: starting instant run server: is main process
93
+ 06-16 12:12:54.990 9456-9463/station.around.aroundsatation W/art: Suspending all threads took: 14.908ms
94
+ 06-16 12:12:55.113 9456-9456/station.around.aroundsatation W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
95
+ 06-16 12:12:55.465 9456-9456/station.around.aroundsatation D/debug: locationStart()
96
+ 06-16 12:12:55.467 9456-9456/station.around.aroundsatation D/debug: gpsEnabled
97
+ 06-16 12:12:55.596 9456-9495/station.around.aroundsatation I/OpenGLRenderer: Initialized EGL, version 1.4
98
+ 06-16 12:12:55.596 9456-9495/station.around.aroundsatation D/OpenGLRenderer: Swap behavior 1
99
+ 06-16 12:12:55.596 9456-9495/station.around.aroundsatation W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
100
+ 06-16 12:12:55.596 9456-9495/station.around.aroundsatation D/OpenGLRenderer: Swap behavior 0
101
+ 06-16 12:12:55.702 9456-9456/station.around.aroundsatation W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
102
+ 06-16 12:12:56.907 9456-9456/station.around.aroundsatation D/NetworkSecurityConfig: No Network Security Config specified, using platform default
103
+ ```
86
104
 
87
105
 
106
+
107
+
88
108
  ご経験ある方、ご助言お願いします。