質問編集履歴
2
エラー、コードを追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
http://localhost:8080/Volumes/USBROBO/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB/%E7%94%BB%E5%83%8F/001.jpg 404 (Not Found)
|
32
32
|
|
33
|
-
というエラーが出ています。
|
33
|
+
というエラーが出ています。(検証のコンソールにて)
|
34
34
|
|
35
35
|
日本語混じりorローカルを見ているから表示されないのかと思い
|
36
36
|
|
@@ -51,3 +51,209 @@
|
|
51
51
|
ものすごく初歩的なことで申し訳ないのですが・・・
|
52
52
|
|
53
53
|
よろしくお願いいたします。
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
ここから追記です。
|
58
|
+
|
59
|
+
エラーが出ていました...
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
```
|
64
|
+
|
65
|
+
java.lang.ClassNotFoundException: jp.co.files.command.null
|
66
|
+
|
67
|
+
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
|
68
|
+
|
69
|
+
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
|
70
|
+
|
71
|
+
at java.lang.Class.forName0(Native Method)
|
72
|
+
|
73
|
+
at java.lang.Class.forName(Class.java:264)
|
74
|
+
|
75
|
+
at jp.co.files.servlet.Controller.doPost(Controller.java:64)
|
76
|
+
|
77
|
+
at jp.co.files.servlet.Controller.doGet(Controller.java:40)
|
78
|
+
|
79
|
+
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
|
80
|
+
|
81
|
+
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
|
82
|
+
|
83
|
+
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
|
84
|
+
|
85
|
+
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
|
86
|
+
|
87
|
+
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
|
88
|
+
|
89
|
+
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
|
90
|
+
|
91
|
+
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
|
92
|
+
|
93
|
+
at jp.co.files.filter.EncodeingFilter.doFilter(EncodeingFilter.java:25)
|
94
|
+
|
95
|
+
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
|
96
|
+
|
97
|
+
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
|
98
|
+
|
99
|
+
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
|
100
|
+
|
101
|
+
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
|
102
|
+
|
103
|
+
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
|
104
|
+
|
105
|
+
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
|
106
|
+
|
107
|
+
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
|
108
|
+
|
109
|
+
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
|
110
|
+
|
111
|
+
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
|
112
|
+
|
113
|
+
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
|
114
|
+
|
115
|
+
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
|
116
|
+
|
117
|
+
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
|
118
|
+
|
119
|
+
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
|
120
|
+
|
121
|
+
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
|
122
|
+
|
123
|
+
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
|
124
|
+
|
125
|
+
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
|
126
|
+
|
127
|
+
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
|
128
|
+
|
129
|
+
at java.lang.Thread.run(Thread.java:745)
|
130
|
+
|
131
|
+
```
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
書籍に載っていたコマンドパターン?を真似して作成しているのですが、それが悪さしているのでしょうか...?
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
```
|
140
|
+
|
141
|
+
@WebServlet({ "/" })
|
142
|
+
|
143
|
+
public class Controller extends HttpServlet {
|
144
|
+
|
145
|
+
private static final long serialVersionUID = 1L;
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
private HashMap<String, String> commands;
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
private String CommandsTable[][] = {
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
{ "top", "Top" }, { "menu", "Menu" }, { "process", "Process" }, { "lib", "Lib" }
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
};
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
public void init() throws ServletException {
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
commands = new HashMap<String, String>();
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
for (int i = 0; i < CommandsTable.length; i++) {
|
174
|
+
|
175
|
+
commands.put(CommandsTable[i][0], CommandsTable[i][1]);
|
176
|
+
|
177
|
+
}
|
178
|
+
|
179
|
+
}
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
184
|
+
|
185
|
+
throws ServletException, IOException {
|
186
|
+
|
187
|
+
doPost(request, response);
|
188
|
+
|
189
|
+
}
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
194
|
+
|
195
|
+
throws ServletException, IOException {
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
String action = request.getRequestURI().split("/")[request.getRequestURI().split("/").length - 2];
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
String methodName = request.getRequestURI().split("/")[request.getRequestURI().split("/").length - 1];
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
if (methodName.equals("booker")) {
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
action = "top";
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
String className = commands.get(action);
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
Command command;
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
String url;
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
try {
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
command = (Command) (Class.forName("jp.co.files.command." + className).newInstance());
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
url = command.execute(request, methodName);
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
request.getRequestDispatcher(url).forward(request, response);
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
|
246
|
+
|
247
|
+
e.printStackTrace();
|
248
|
+
|
249
|
+
}
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
}
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
}
|
258
|
+
|
259
|
+
```
|
1
エラーを追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -26,15 +26,19 @@
|
|
26
26
|
|
27
27
|
上記の1行目のpathの中身は
|
28
28
|
|
29
|
-
/Volumes/USBROBO/ファイル/画像/001.jpg
|
29
|
+
/Volumes/USBROBO/ファイル/画像/001.jpgで、
|
30
30
|
|
31
|
+
http://localhost:8080/Volumes/USBROBO/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB/%E7%94%BB%E5%83%8F/001.jpg 404 (Not Found)
|
32
|
+
|
33
|
+
というエラーが出ています。
|
34
|
+
|
31
|
-
|
35
|
+
日本語混じりorローカルを見ているから表示されないのかと思い
|
32
36
|
|
33
37
|
001.jpgをWebContent/imgに移動させ、ひとまず画像表示だけしてみようと
|
34
38
|
|
35
39
|
上記の2,3行目の方法で表示を試みたのですが、ダメでした。
|
36
40
|
|
37
|
-
|
41
|
+
(こちらはエラーは出ていません)
|
38
42
|
|
39
43
|
###補足情報(言語/FW/ツール等のバージョンなど)
|
40
44
|
|