• R/O
  • SSH
  • HTTPS

alinous-core: Commit


Commit MetaInfo

Revision121 (tree)
Time2007-11-25 20:17:34
Authori-zuka

Log Message

(empty log message)

Change Summary

Incremental Difference

--- AlinousCoreIDE1.0/AlinousWeb/src/org/alinous/web/AlinousServlet.java (revision 120)
+++ AlinousCoreIDE1.0/AlinousWeb/src/org/alinous/web/AlinousServlet.java (revision 121)
@@ -109,6 +109,8 @@
109109 URL url = this.getServletContext().getResource("/mimetypes.xml");
110110 InputStream stream = url.openStream();
111111
112+ //System.out.println("*********************** stream : " + stream);
113+
112114 this.alinousCore = AlinousCore.getInstance(this.alinousHome, stream);
113115
114116 } catch (Throwable e) {
--- AlinousCoreIDE1.0/AlinousWeb/src/org/alinous/web/SimpleContentsHandler.java (revision 120)
+++ AlinousCoreIDE1.0/AlinousWeb/src/org/alinous/web/SimpleContentsHandler.java (revision 121)
@@ -80,7 +80,7 @@
8080 unit.dispose();
8181 }
8282
83- String contentType = makeContentType(webPath);
83+ String contentType = makeContentType(webPath, core);
8484
8585 if(contentType == null){
8686 String encode = core.getConfig().getSystemRepositoryConfig().getEncoding();
@@ -130,51 +130,17 @@
130130
131131 }
132132
133- private static String makeContentType(String request)
133+ private static String makeContentType(String request, AlinousCore core)
134134 {
135135 String lowPath = request.toLowerCase();
136136
137- if(lowPath.endsWith(".gif")){
138- return "image/gif";
137+ int dotIdx = lowPath.lastIndexOf(".");
138+
139+ if(dotIdx < 0){
140+ return null;
139141 }
140- else if(lowPath.endsWith(".png"))
141- {
142- return "image/png";
143- }
144- else if(lowPath.endsWith(".jgp") || lowPath.endsWith(".jpeg"))
145- {
146- return "image/jpeg";
147- }
148- else if(lowPath.endsWith(".css")){
149- return "text/css";
150- }
151- else if(lowPath.endsWith(".js")
152- || lowPath.endsWith(".txt") || lowPath.endsWith(".text"))
153- {
154- return "text/plain";
155- }
156- else if(lowPath.endsWith(".zip"))
157- {
158- return "application/zip";
159- }
160- else if(lowPath.endsWith(".pdf"))
161- {
162- return "application/pdf";
163- }
164- else if(lowPath.endsWith(".mid"))
165- {
166- return "audio/midi";
167- }
168- else if(lowPath.endsWith(".asf"))
169- {
170- return "video/x-ms-asf";
171- }
172- else if(lowPath.endsWith(".asx"))
173- {
174- return "video/x-ms-asf";
175- }
176142
177- return null;
143+ return core.getMime().getContentType(request.substring(dotIdx + 1,request.length()));
178144 }
179145
180146 public static boolean isSpecialFolder(String requestUri)
--- AlinousCoreIDE1.0/AlinousWeb/src/org/alinous/web/ErrorDispacher.java (revision 120)
+++ AlinousCoreIDE1.0/AlinousWeb/src/org/alinous/web/ErrorDispacher.java (revision 121)
@@ -37,6 +37,7 @@
3737 public static void handleModuleNotFoundEx(HttpServletRequest httpRequest, HttpServletResponse httpResponce,
3838 ModuleNotFoundException e, AlinousCore core) throws IOException
3939 {
40+
4041 httpResponce.setContentType("text/html;charset=UTF-8");
4142 PrintWriter out = httpResponce.getWriter();
4243
Show on old repository browser