Revision: 6231
Author: kpro...@google.com
Date: Mon Sep 28 07:05:23 2009
Log: Updates to CrawlServlet (throws another exception) and Showcase  
eclipse project.


http://code.google.com/p/google-web-toolkit/source/detail?r=6231

Modified:
  /branches/crawlability/eclipse/README.txt
  /branches/crawlability/eclipse/samples/Showcase/.classpath
   
/branches/crawlability/samples/showcase/src/com/google/gwt/sample/showcase/server/CrawlServlet.java

=======================================
--- /branches/crawlability/eclipse/README.txt   Fri Jul 10 09:14:42 2009
+++ /branches/crawlability/eclipse/README.txt   Mon Sep 28 07:05:23 2009
@@ -21,6 +21,7 @@
  Create a variable named "GWT_TOOLS" pointing to your "tools" folder.
  Create a variable named "JDK_HOME" pointing to the root of your JDK install
    (for example, C:\Program Files\jdk1.5.0_05 or /usr/lib/j2sdk1.5-sun)
+Create a variable named "GWT_ROOT" pointing to your "trunk" folder.

  ---------------- Spelling -----------------

=======================================
--- /branches/crawlability/eclipse/samples/Showcase/.classpath  Fri Jan 16  
11:50:20 2009
+++ /branches/crawlability/eclipse/samples/Showcase/.classpath  Mon Sep 28  
07:05:23 2009
@@ -5,5 +5,6 @@
        <classpathentry kind="con"  
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry combineaccessrules="false" kind="src" path="/gwt-user"/>
        <classpathentry combineaccessrules="false" kind="src"  
path="/gwt-dev-windows"/>
+       <classpathentry kind="var"  
path="GWT_ROOT/build/staging/gwt-linux-0.0.0/gwt-servlet.jar"/>
        <classpathentry kind="output" path="war/WEB-INF/classes"/>
  </classpath>
=======================================
---  
/branches/crawlability/samples/showcase/src/com/google/gwt/sample/showcase/server/CrawlServlet.java
      
Fri Sep 25 09:27:51 2009
+++  
/branches/crawlability/samples/showcase/src/com/google/gwt/sample/showcase/server/CrawlServlet.java
      
Mon Sep 28 07:05:23 2009
@@ -21,6 +21,7 @@

  import java.io.IOException;
  import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
  import java.net.URLDecoder;

  import javax.servlet.Filter;
@@ -33,48 +34,41 @@
  import javax.servlet.http.HttpServletResponse;

  /**
- * Servlet that makes this application crawlable
+ * Servlet that makes this application crawlable.
   */
  public final class CrawlServlet implements Filter {

-  private static String rewriteQueryString(String queryString) {
+  private static String rewriteQueryString(String queryString)
+      throws UnsupportedEncodingException {
      StringBuilder queryStringSb = new StringBuilder(queryString);
-    int i = queryStringSb.indexOf("&_escaped_fragment_");
-    if (i != -1) {
-      StringBuilder tmpSb = new StringBuilder(queryStringSb.substring(0,  
i));
-      tmpSb.append("#!");
-      tmpSb.append(URLDecoder.decode(queryStringSb.substring(i + 20,  
queryStringSb.length()),"UTF-8"));
-      queryStringSb = tmpSb;
-    }
-
-    i = queryStringSb.indexOf("_escaped_fragment_");
+    int i = queryStringSb.indexOf("&_escaped_fragment_=");
+    if (i == -1) {
+      i = queryStringSb.indexOf("?_escaped_fragment_=");
+    }
      if (i != -1) {
-      StringBuilder tmpSb = new StringBuilder(queryStringSb.substring(0,  
i));
+      StringBuilder tmpSb = new StringBuilder(queryStringSb.substring(0, i  
- 1));
+      System.out.println("|" + tmpSb + "|");
        tmpSb.append("#!");
-      tmpSb.append(URLDecoder.decode(queryStringSb.substring(i + 19,  
queryStringSb.length()), "UTF-8"));
+      System.out.println("|" + tmpSb + "|");
+      tmpSb.append(URLDecoder.decode(queryStringSb.substring(i + 20,
+          queryStringSb.length()), "UTF-8"));
+      System.out.println("|" + tmpSb + "|");
        queryStringSb = tmpSb;
      }
-    if (queryStringSb.indexOf("#!") != 0) {
-      queryStringSb.insert(0, '?');
-    }
-    queryString = queryStringSb.toString();
-
-
-
-    return queryString;
+    return queryStringSb.toString();
    }

    private FilterConfig filterConfig = null;

    /**
-   * Destroys the filter configuration
+   * Destroys the filter configuration.
     */
    public void destroy() {
      this.filterConfig = null;
    }

    /**
-   * Filters all requests and invokes headless browser if necessary
+   * Filters all requests and invokes headless browser if necessary.
     */
    public void doFilter(ServletRequest request, ServletResponse response,
        FilterChain chain) throws IOException {
@@ -106,8 +100,11 @@
        res.setContentType("text/html;charset=UTF-8");
        PrintWriter out = res.getWriter();
        out.println("<hr>");
-      out.println("<center><h3>You are viewing a non-interactive page that  
is intended for the crawler.  You probably want to see this page: <a  
href=\""
-          + pageName + "\">" + pageName + "</a></h3></center>");
+      out.println("<center><h3>You are viewing a non-interactive page that  
is intended for the crawler.  "
+          + "You probably want to see this page: <a href=\""
+          + pageName
+          + "\">"
+          + pageName + "</a></h3></center>");
        out.println("<hr>");

        out.println(page.asXml());
@@ -124,10 +121,9 @@
    }

    /**
-   * Initializes the filter configuration
+   * Initializes the filter configuration.
     */
    public void init(FilterConfig filterConfig) {
      this.filterConfig = filterConfig;
    }
-
-}
+}

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to