|
From: <tre...@us...> - 2007-07-20 19:11:46
|
Revision: 228
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=228&view=rev
Author: trevorolio
Date: 2007-07-20 12:11:36 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
A tweak to stop compressing textures.
Modified Paths:
--------------
spaces/trunk/.settings/org.eclipse.jdt.core.prefs
spaces/trunk/src/com/ogoglio/client/WebAPIClient.java
spaces/trunk/src/com/ogoglio/media/WebStore.java
spaces/trunk/src/com/ogoglio/sim/Sim.java
spaces/trunk/src/com/ogoglio/site/AccountServlet.java
spaces/trunk/src/com/ogoglio/viewer/applet/AppletTestWindow.java
Modified: spaces/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- spaces/trunk/.settings/org.eclipse.jdt.core.prefs 2007-07-12 14:05:45 UTC (rev 227)
+++ spaces/trunk/.settings/org.eclipse.jdt.core.prefs 2007-07-20 19:11:36 UTC (rev 228)
@@ -1,6 +1,6 @@
-#Tue Jul 03 09:23:42 PDT 2007
+#Mon Jul 16 20:14:59 PDT 2007
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.4
Modified: spaces/trunk/src/com/ogoglio/client/WebAPIClient.java
===================================================================
--- spaces/trunk/src/com/ogoglio/client/WebAPIClient.java 2007-07-12 14:05:45 UTC (rev 227)
+++ spaces/trunk/src/com/ogoglio/client/WebAPIClient.java 2007-07-20 19:11:36 UTC (rev 228)
@@ -29,6 +29,8 @@
import javax.media.j3d.Transform3D;
+import org.apache.commons.httpclient.methods.RequestEntity;
+
import nanoxml.XMLElement;
import com.ogoglio.site.AuthServlet;
@@ -50,8 +52,8 @@
public class WebAPIClient {
- private WebAPIClientWire wire=new WebAPIClientWire();
-
+ private WebAPIClientWire wire = new WebAPIClientWire();
+
private URI spaceURI = null;
private URI serviceURI = null;
@@ -71,9 +73,9 @@
}
public WebAPIClient(URI spaceURI, URI serviceURI, String authCookie) throws IOException {
- this(spaceURI,serviceURI, authCookie,null);
+ this(spaceURI, serviceURI, authCookie, null);
}
-
+
public WebAPIClient(URI spaceURI, URI serviceURI, String authCookie, WebAPIClientWire otherWire) throws IOException {
//seems that we have to allow the null spaceURI to indicate that
//the client has no interest in a space
@@ -84,9 +86,9 @@
ArgumentUtils.assertNotNull(authCookie);
this.authCookie = authCookie;
-
- if (otherWire!=null) {
- this.wire = otherWire;
+
+ if (otherWire != null) {
+ this.wire = otherWire;
}
}
@@ -333,27 +335,31 @@
XMLElement templateXML = postAuthenticatedXML(getTemplateURI(authDocument.getUsername(), templateDoc.getTemplateID()), templateDoc.toString());
return new TemplateDocument(templateXML);
}
+
/*
* Beginning of new style: IES HACK
*/
public String getAuthUsername() throws IOException {
- return getAuthDocument(true).getUsername();
+ return getAuthDocument(true).getUsername();
}
+
public String getAuthCookie() throws IOException {
- return authCookie;
+ return authCookie;
}
+
public TemplateDocument createTemplate(String templateName) throws IOException {
TemplateDocument templateDoc = new TemplateDocument(-1, templateName, getAuthUsername(), null);
- XMLElement templateXML = wire.postAuthenticatedXML(getTemplatesURI(getAuthUsername()),templateDoc.toString(),
- getAuthCookie());
+ XMLElement templateXML = wire.postAuthenticatedXML(getTemplatesURI(getAuthUsername()), templateDoc.toString(), getAuthCookie());
return new TemplateDocument(templateXML);
}
- public boolean deleteTemplate(long templateID) throws IOException {
- return wire.sendDelete(getTemplateURI(getAuthUsername(), templateID),getAuthCookie());
- }
- /*
- * End of new style: IES HACK
- */
+
+ public boolean deleteTemplate(long templateID) throws IOException {
+ return wire.sendDelete(getTemplateURI(getAuthUsername(), templateID), getAuthCookie());
+ }
+
+ /*
+ * End of new style: IES HACK
+ */
public TemplateDocument getTemplateDocument(String username, long templateID) throws IOException {
return new TemplateDocument(fetchAuthenticatedXML(getTemplateURI(username, templateID)));
}
@@ -380,7 +386,7 @@
public String getTemplateScript(long templateID) {
try {
- InputStream input = fetchAuthenticatedStream(getTemplateScriptURI(getAuthDocument(true).getUsername(), templateID), authCookie);
+ InputStream input = performGET(getTemplateScriptURI(getAuthDocument(true).getUsername(), templateID), authCookie, false);
return StreamUtils.readInput(input);
} catch (IOException e) {
return null;
@@ -442,7 +448,7 @@
}
public InputStream getPageContents(long thingID, long pageID) throws IOException {
- return performGET(getPageContentsURI(thingID, pageID), authCookie);
+ return performGET(getPageContentsURI(thingID, pageID), authCookie, false);
}
public Map getSettings() throws IOException {
@@ -458,7 +464,7 @@
public String getSetting(String key) {
try {
- InputStream stream = performGET(getSettingURI(key), authCookie);
+ InputStream stream = performGET(getSettingURI(key), authCookie, false);
if (stream == null) {
return null;
}
@@ -521,7 +527,7 @@
}
public InputStream getGeometryStream(URI renderableRootURI, String name) throws IOException {
- return fetchAuthenticatedStream(WebAPIUtil.appendToURI(renderableRootURI, "geometry/" + name), authCookie);
+ return performGET(WebAPIUtil.appendToURI(renderableRootURI, "geometry/" + name), authCookie, false);
}
public void putGeometryStream(URI rootURI, InputStream input, String name) throws IOException {
@@ -533,14 +539,13 @@
}
public InputStream getGeometryStream(URI renderableRootURI, int lodIndex) throws IOException {
- return fetchAuthenticatedStream(WebAPIUtil.appendToURI(renderableRootURI, "geometry/data/" + lodIndex), authCookie);
+ return performGET(WebAPIUtil.appendToURI(renderableRootURI, "geometry/data/" + lodIndex), authCookie, true);
}
- public static DecoratedInputStream performGET(URI uri, String authCookie) throws IOException {
-
+ public static DecoratedInputStream performGET(URI uri, String authCookie, boolean requestCompression) throws IOException {
String version = System.getProperty("java.version");
if ((version == null) || version.startsWith("1.6")) {
- //THIS IS TO WORK AROUND SUN'S ABSOLUTELY BROKEN APPLET CACHE IN JRE 1.6u1
+ //THIS IS TO WORK AROUND SUN'S ABSOLUTELY BROKEN APPLET CACHE IN JRE 1.6u1 & 2
String uriString = uri.toASCIIString();
try {
if (uriString.indexOf("?") == -1) {
@@ -563,7 +568,9 @@
if (authCookie != null) {
connection.setRequestProperty("Cookie", AuthServlet.AUTH_COOKIE + "=" + authCookie);
}
- connection.setRequestProperty("Accept-encoding", "gzip");
+ if (requestCompression) {
+ connection.setRequestProperty("Accept-encoding", "gzip");
+ }
connection.setDoOutput(false);
if (connection.getResponseCode() != 200) {
throw new IOException("Get status " + connection.getResponseCode() + " from " + uri);
@@ -731,13 +738,9 @@
return connection.getResponseCode() == 200;
}
- public static InputStream fetchAuthenticatedStream(URI uri, String authCookie) throws IOException {
- return performGET(uri, authCookie);
- }
-
public static XMLElement fetchAuthenticatedXML(URI uri, String authCookie) throws IOException {
XMLElement data = new XMLElement();
- data.parseFromReader(new InputStreamReader(fetchAuthenticatedStream(uri, authCookie)));
+ data.parseFromReader(new InputStreamReader(performGET(uri, authCookie, false)));
return data;
}
Modified: spaces/trunk/src/com/ogoglio/media/WebStore.java
===================================================================
--- spaces/trunk/src/com/ogoglio/media/WebStore.java 2007-07-12 14:05:45 UTC (rev 227)
+++ spaces/trunk/src/com/ogoglio/media/WebStore.java 2007-07-20 19:11:36 UTC (rev 228)
@@ -48,7 +48,7 @@
public DecoratedInputStream getData(String name) {
try {
- return WebAPIClient.performGET(WebAPIUtil.appendToURI(mediaURI, name), null);
+ return WebAPIClient.performGET(WebAPIUtil.appendToURI(mediaURI, name), null, false);
} catch (IOException e) {
return null;
}
Modified: spaces/trunk/src/com/ogoglio/sim/Sim.java
===================================================================
--- spaces/trunk/src/com/ogoglio/sim/Sim.java 2007-07-12 14:05:45 UTC (rev 227)
+++ spaces/trunk/src/com/ogoglio/sim/Sim.java 2007-07-20 19:11:36 UTC (rev 228)
@@ -42,7 +42,7 @@
import com.ogoglio.xml.TemplateDocument;
public class Sim {
- public static final long MAX_GEOMETRY_SIZE = 1048576;
+ public static final long MAX_GEOMETRY_SIZE = 5 * 1048576;
public static final long MAX_GEOMETRY_RESOURCE_SIZE = 1048576;
Modified: spaces/trunk/src/com/ogoglio/site/AccountServlet.java
===================================================================
--- spaces/trunk/src/com/ogoglio/site/AccountServlet.java 2007-07-12 14:05:45 UTC (rev 227)
+++ spaces/trunk/src/com/ogoglio/site/AccountServlet.java 2007-07-20 19:11:36 UTC (rev 228)
@@ -415,9 +415,6 @@
}
response.setStatus(HttpServletResponse.SC_OK);
setCachable(response);
- if (data.getLength() > -1) {
- response.setContentLength((int) data.getLength());
- }
if (data.getMimeType() != null) {
response.setContentType(data.getMimeType());
}
@@ -425,6 +422,9 @@
response.setHeader("Content-encoding", "gzip");
StreamUtils.write(data, new GZIPOutputStream(response.getOutputStream()));
} else {
+ if (data.getLength() > -1) {
+ response.setContentLength((int) data.getLength());
+ }
StreamUtils.write(data, response.getOutputStream());
}
} catch (PersistException e) {
Modified: spaces/trunk/src/com/ogoglio/viewer/applet/AppletTestWindow.java
===================================================================
--- spaces/trunk/src/com/ogoglio/viewer/applet/AppletTestWindow.java 2007-07-12 14:05:45 UTC (rev 227)
+++ spaces/trunk/src/com/ogoglio/viewer/applet/AppletTestWindow.java 2007-07-20 19:11:36 UTC (rev 228)
@@ -22,10 +22,8 @@
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
-import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
-import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
@@ -42,7 +40,7 @@
EnvironmentStub clientStub1 = null;
- String host = "localhost:8080";
+ String host = "127.0.0.1:8080";
String serviceURI = "http://" + host + "/og/";
@@ -68,7 +66,7 @@
} catch (Exception e) {
e.printStackTrace();
}
- parameters1.put("loginCookie", "guestApplet_Test_Window2");
+ //parameters1.put("loginCookie", "guestApplet_Test_Window2");
parameters1.put("spaceURI", spaceURI);
parameters1.put("serviceURI", serviceURI);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|