roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r551350 - /roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/Trackback.java
Date Wed, 27 Jun 2007 21:58:45 GMT
Author: agilliland
Date: Wed Jun 27 14:58:44 2007
New Revision: 551350

URL: http://svn.apache.org/viewvc?view=rev&rev=551350
Log:
query parameters for trackback requests need to be url encoded.


Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/Trackback.java

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/Trackback.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/Trackback.java?view=diff&rev=551350&r1=551349&r2=551350
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/Trackback.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/Trackback.java Wed
Jun 27 14:58:44 2007
@@ -48,7 +48,7 @@
  */
 public class Trackback {
     
-    private static final Log mLogger = LogFactory.getLog(Trackback.class);
+    private static final Log log = LogFactory.getLog(Trackback.class);
     
     private final WeblogEntry entry;
     private final String trackbackURL;
@@ -87,9 +87,8 @@
             
             entry = tEntry;
             trackbackURL = tURL;
-            
-            
         }
+        
     }
     
     
@@ -101,6 +100,8 @@
         
         RollerMessages messages = new RollerMessages();
         
+        log.debug("Sending trackback to url - "+trackbackURL);
+        
         // Construct data
         String title = entry.getTitle();
         String excerpt = StringUtils.left( Utilities.removeHTML(entry.getDisplayContent()),255
);
@@ -109,12 +110,14 @@
         
         // build trackback post parameters as query string
         Map params = new HashMap();
-        params.put("title", title);
-        params.put("excerpt", excerpt);
-        params.put("url", url);
-        params.put("blog_name", blog_name);
+        params.put("title", URLUtilities.encode(title));
+        params.put("excerpt", URLUtilities.encode(excerpt));
+        params.put("url", URLUtilities.encode(url));
+        params.put("blog_name", URLUtilities.encode(blog_name));
         String queryString = URLUtilities.getQueryString(params);
         
+        log.debug("query string - "+queryString);
+        
         // prepare http request
         HttpClient client = new HttpClient();
         client.setConnectionTimeout(45 * 1000);
@@ -124,11 +127,14 @@
         try {
             // execute trackback
             int statusCode = client.executeMethod(method);
-
+            
             // read response
             byte[] response = method.getResponseBody();
             String responseString = Utilities.escapeHTML(new String(response, "UTF-8"));
             
+            log.debug("result = "+statusCode+" "+method.getStatusText());
+            log.debug("response:\n"+responseString);
+            
             if(statusCode == HttpStatus.SC_OK) {
                 // trackback request succeeded, message will give details
                 try {
@@ -149,7 +155,7 @@
             
         } catch (IOException e) {
             // some kind of transport error sending trackback post
-            mLogger.debug("Error sending trackback", e);
+            log.debug("Error sending trackback", e);
             messages.addError("weblogEdit.trackbackErrorTransport");
         } finally {
             // release used connection



Mime
View raw message