Permalink
Browse files

Fixed Empty-user-agent problem and added error trapping to "Add" page

  • Loading branch information...
1 parent a0c608a commit febd26542c7711ecb1221e3c6ccc55825068afee @sbasegmez sbasegmez committed Feb 17, 2013
View
3 disk-collaborationtoday/.settings/org.eclipse.core.resources.prefs
@@ -1,4 +1,4 @@
-#Wed Dec 19 09:45:05 CET 2012
+#Sun Feb 17 15:04:35 EET 2013
encoding//Resources/StyleSheets/jquery.Jcrop.css=UTF-8
encoding//Resources/Files/TestWidget.html=UTF-8
encoding//Resources/Files/TestJSONP.html=UTF-8
@@ -7,4 +7,5 @@ encoding//Resources/StyleSheets/mypic.css=UTF-8
eclipse.preferences.version=1
encoding//Resources/StyleSheets/pager.css=UTF-8
encoding//Resources/StyleSheets/collab2day.css=UTF-8
+encoding//Resources/StyleSheets/bootstrap-2.0.4.combined.min.css=UTF-8
encoding//Resources/StyleSheets/custom.css=UTF-8
View
16 disk-collaborationtoday/Code/Java/org/openntf/news/http/core/Parser.java
@@ -25,6 +25,11 @@
import com.ibm.xsp.extlib.util.ExtLibUtil;
public class Parser {
+
+ //Constants
+ static public int HTTP_TIMEOUT=30000; //milliseconds
+ static public String HTTP_USER_AGENT="CollaborationToday";
+
// No need to instantiate this class
private Parser() { }
@@ -37,7 +42,14 @@ static public String getOutput(String urlToIndex) {
PHPTagTypes.register();
PHPTagTypes.PHP_SHORT.deregister();
MasonTagTypes.register();
- Source source = new Source(new URL(urlToIndex));
+
+ URL targetURL=new URL(urlToIndex);
+ URLConnection conn = targetURL.openConnection();
+ conn.setConnectTimeout(HTTP_TIMEOUT);
+ conn.setReadTimeout(HTTP_TIMEOUT);
+ conn.setRequestProperty("User-Agent", HTTP_USER_AGENT);
+
+ Source source = new Source(conn);
source.fullSequentialParse();
String title = getTitle(source);
@@ -64,6 +76,8 @@ static public String getOutput(String urlToIndex) {
newsEntry.save();
unid = newsEntry.getUniversalID();
+ } catch(MalformedURLException exp1) {
+ System.out.println("Invalid URL on Parser: "+urlToIndex);
} catch(Exception err) {
err.printStackTrace();
} finally {
View
24 disk-collaborationtoday/Code/Java/org/openntf/news/http/core/Parser.java.metadata
@@ -1,18 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?><note class="form" maintenanceversion="3.0" replicaid="85257AA6004F5595" version="8.5" xmlns="http://www.lotus.com/dxl">
-<noteinfo noteid="2fa" sequence="4" unid="797A3943652B498D85257AA6004F7257">
-<created><datetime dst="true">20121029T102746,15-04</datetime></created>
-<modified><datetime dst="true">20121029T102931,04-04</datetime></modified>
-<revised><datetime dst="true">20121029T102931,03-04</datetime></revised>
-<lastaccessed><datetime dst="true">20121029T102931,03-04</datetime></lastaccessed>
-<addedtofile><datetime dst="true">20121029T102746,24-04</datetime></addedtofile></noteinfo>
-<updatedby><name>CN=Jesse Gallagher/O=MTC</name><name>CN=Jesse Gallagher/O=Frost</name></updatedby>
-<wassignedby><name>CN=Jesse Gallagher/O=Frost</name></wassignedby>
+<?xml version="1.0" encoding="UTF-8"?><note class="form" maintenanceversion="3.3" replicaid="C2257B150047CB4E" version="8.5" xmlns="http://www.lotus.com/dxl">
+<noteinfo noteid="34e" sequence="6" unid="2C5F86998CD7CA48C2257B150047D0BF">
+<created><datetime>20130217T150424,95+02</datetime></created>
+<modified><datetime>20130217T152110,52+02</datetime></modified>
+<revised><datetime>20130217T152110,50+02</datetime></revised>
+<lastaccessed><datetime>20130217T152110,50+02</datetime></lastaccessed>
+<addedtofile><datetime>20130217T150426,47+02</datetime></addedtofile></noteinfo>
+<updatedby><name>CN=Serdar Basegmez/O=developi</name></updatedby>
+<wassignedby><name>CN=Serdar Basegmez/O=developi</name></wassignedby>
<item name="$Flags"><text>34567Cg~[</text></item>
<item name="$TITLE"><text>org/openntf/news/http/core/Parser.java</text></item>
-<item name="$DesignerVersion"><text>8.5.3</text></item>
-<item name="$FileNames" sign="true"><text>org/openntf/news/http/core/Parser.java</text></item>
+
+<item name="$DesignerVersion"><text>8.5.3</text></item>
-</note>
+<item name="$FileNames" sign="true"><text>org/openntf/news/http/core/Parser.java</text></item></note>
View
16 disk-collaborationtoday/XPages/add.xsp
@@ -43,13 +43,17 @@
}
function hideBusy(){
- var buttonId = "#{id:button1}";
- var buttonElement = document.getElementById(buttonId);
- buttonElement.style.visibility = 'hidden';
- var busyElement = document.getElementById("busy");
- busyElement.className = "busyHidden";
var docUnidClient = "#{javascript:sessionScope.get("NikFileName")}"
- window.location = "moderateEntry.xsp?action=editDocument&documentId=" + docUnidClient;
+ if(docUnidClient=="") {
+ alert("There is an error getting site information...")
+ } else {
+ var buttonId = "#{id:button1}";
+ var buttonElement = document.getElementById(buttonId);
+ buttonElement.style.visibility = 'hidden';
+ var busyElement = document.getElementById("busy");
+ busyElement.className = "busyHidden";
+ window.location = "moderateEntry.xsp?action=editDocument&documentId=" + docUnidClient;
+ }
}
]]></xp:this.value>
</xp:scriptBlock>
View
26 disk-collaborationtoday/XPages/add.xsp.metadata
@@ -1,21 +1,21 @@
-<?xml version="1.0" encoding="UTF-8"?><note class="form" maintenanceversion="3.0" replicaid="85257AA6004F5595" version="8.5" xmlns="http://www.lotus.com/dxl">
-<noteinfo noteid="1be" sequence="21" unid="D99BD09242788AA785257AA6004F5D57">
-<created><datetime dst="true">20121029T102652,39-04</datetime></created>
-<modified><datetime dst="true">20121103T112655,00-04</datetime></modified>
-<revised><datetime dst="true">20121103T112654,98-04</datetime></revised>
-<lastaccessed><datetime dst="true">20121103T112654,98-04</datetime></lastaccessed>
-<addedtofile><datetime dst="true">20121029T102652,47-04</datetime></addedtofile></noteinfo>
-<updatedby><name>CN=Jesse Gallagher/O=Frost</name></updatedby>
-<wassignedby><name>CN=Jesse Gallagher/O=Frost</name></wassignedby>
+<?xml version="1.0" encoding="UTF-8"?><note class="form" maintenanceversion="3.3" replicaid="C2257B150047CB4E" version="8.5" xmlns="http://www.lotus.com/dxl">
+<noteinfo noteid="1c6" sequence="6" unid="D55657C2413D3668C2257B150047CF41">
+<created><datetime>20130217T150421,13+02</datetime></created>
+<modified><datetime>20130217T151335,61+02</datetime></modified>
+<revised><datetime>20130217T151335,59+02</datetime></revised>
+<lastaccessed><datetime>20130217T151335,59+02</datetime></lastaccessed>
+<addedtofile><datetime>20130217T150421,75+02</datetime></addedtofile></noteinfo>
+<updatedby><name>CN=Serdar Basegmez/O=developi</name></updatedby>
+<wassignedby><name>CN=Serdar Basegmez/O=developi</name></wassignedby>
<item name="$Flags"><text>gC~4K</text></item>
<item name="$TITLE" sign="true"><text>add.xsp</text></item>
+<item name="$Comment" sign="true"><text>Moderators Only</text></item>
+<item name="$DesignerVersion"><text>8.5.1</text></item>
+
-<item name="$FileNames" sign="true"><text>add.xsp</text></item>
-<item name="$Comment" sign="true"><text>Moderators Only</text></item>
-<item name="$DesignerVersion"><text>8.5.1</text></item>
-</note>
+<item name="$FileNames" sign="true"><text>add.xsp</text></item></note>

0 comments on commit febd265

Please sign in to comment.