Author: kishore
Date: Mon Apr 24 20:07:03 2017
New Revision: 1792543

URL: http://svn.apache.org/viewvc?rev=1792543&view=rev
Log:
Updated Proxy tab with Velocity template

Added:
    
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Proxy.html.vm
   (with props)
Modified:
    
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java

Modified: 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java?rev=1792543&r1=1792542&r2=1792543&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
 (original)
+++ 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
 Mon Apr 24 20:07:03 2017
@@ -1644,6 +1644,33 @@ public class WebcrawlerConnector extends
     }
     velocityContext.put("THROTTLESMAPLIST",throttlesMapList);
   }
+
+  private void fillInProxyTab(Map<String,Object> velocityContext, IHTTPOutput 
out, ConfigParams parameters)
+  {
+    String proxyHost = 
parameters.getParameter(WebcrawlerConfig.PARAMETER_PROXYHOST);
+    if (proxyHost == null)
+      proxyHost = "";
+    String proxyPort = 
parameters.getParameter(WebcrawlerConfig.PARAMETER_PROXYPORT);
+    if (proxyPort == null)
+      proxyPort = "";
+    String proxyAuthDomain = 
parameters.getParameter(WebcrawlerConfig.PARAMETER_PROXYAUTHDOMAIN);
+    if (proxyAuthDomain == null)
+      proxyAuthDomain = "";
+    String proxyAuthUsername = 
parameters.getParameter(WebcrawlerConfig.PARAMETER_PROXYAUTHUSERNAME);
+    if (proxyAuthUsername == null)
+      proxyAuthUsername = "";
+    String proxyAuthPassword = 
parameters.getObfuscatedParameter(WebcrawlerConfig.PARAMETER_PROXYAUTHPASSWORD);
+    if (proxyAuthPassword == null)
+      proxyAuthPassword = "";
+    else
+      proxyAuthPassword = out.mapPasswordToKey(proxyAuthPassword);
+
+    velocityContext.put("PROXYHOST",proxyHost);
+    velocityContext.put("PROXYPORT",proxyPort);
+    velocityContext.put("PROXYAUTHDOMAIN",proxyAuthDomain);
+    velocityContext.put("PROXYAUTHUSERNAME",proxyAuthUsername);
+    velocityContext.put("PROXYAUTHPASSWORD",proxyAuthPassword);
+  }
   
   /** Output the configuration body section.
   * This method is called in the body section of the connector's configuration 
page.  Its purpose is to present the required form elements for editing.
@@ -1666,6 +1693,7 @@ public class WebcrawlerConnector extends
     fillInEmailTab(velocityContext,out,parameters);
     fillInRobotsTab(velocityContext,out,parameters);
     fillInBandwidthTab(velocityContext,out,parameters);
+    fillInProxyTab(velocityContext,out,parameters);
 
     // Email tab
     
Messages.outputResourceWithVelocity(out,locale,"editConfiguration_Email.html.vm",velocityContext);
@@ -1673,64 +1701,8 @@ public class WebcrawlerConnector extends
     
Messages.outputResourceWithVelocity(out,locale,"editConfiguration_Robots.html.vm",velocityContext);
     //Bandwidth tab
     
Messages.outputResourceWithVelocity(out,locale,"editConfiguration_Bandwidth.html.vm",velocityContext);
-
-    String proxyHost = 
parameters.getParameter(WebcrawlerConfig.PARAMETER_PROXYHOST);
-    if (proxyHost == null)
-      proxyHost = "";
-    String proxyPort = 
parameters.getParameter(WebcrawlerConfig.PARAMETER_PROXYPORT);
-    if (proxyPort == null)
-      proxyPort = "";
-    String proxyAuthDomain = 
parameters.getParameter(WebcrawlerConfig.PARAMETER_PROXYAUTHDOMAIN);
-    if (proxyAuthDomain == null)
-      proxyAuthDomain = "";
-    String proxyAuthUsername = 
parameters.getParameter(WebcrawlerConfig.PARAMETER_PROXYAUTHUSERNAME);
-    if (proxyAuthUsername == null)
-      proxyAuthUsername = "";
-    String proxyAuthPassword = 
parameters.getObfuscatedParameter(WebcrawlerConfig.PARAMETER_PROXYAUTHPASSWORD);
-    if (proxyAuthPassword == null)
-      proxyAuthPassword = "";
-    else
-      proxyAuthPassword = out.mapPasswordToKey(proxyAuthPassword);
-
     // Proxy tab
-    if (tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Proxy")))
-    {
-      out.print(
-"<table class=\"displaytable\">\n"+
-"  <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"+
-"  <tr>\n"+
-"    <td class=\"description\"><nobr>" + 
Messages.getBodyString(locale,"WebcrawlerConnector.ProxyHostColon") + 
"</nobr></td>\n"+
-"    <td class=\"value\"><input type=\"text\" size=\"40\" name=\"proxyhost\" 
value=\""+Encoder.attributeEscape(proxyHost)+"\"/></td>\n"+
-"  </tr>\n"+
-"  <tr>\n"+
-"    <td class=\"description\"><nobr>" + 
Messages.getBodyString(locale,"WebcrawlerConnector.ProxyPortColon") + 
"</nobr></td>\n"+
-"    <td class=\"value\"><input type=\"text\" size=\"5\" name=\"proxyport\" 
value=\""+Encoder.attributeEscape(proxyPort)+"\"/></td>\n"+
-"  </tr>\n"+
-"  <tr>\n"+
-"    <td class=\"description\"><nobr>" + 
Messages.getBodyString(locale,"WebcrawlerConnector.ProxyAuthenticationDomainColon")
 + "</nobr></td>\n"+
-"    <td class=\"value\"><input type=\"text\" size=\"32\" 
name=\"proxyauthdomain\" 
value=\""+Encoder.attributeEscape(proxyAuthDomain)+"\"/></td>\n"+
-"  </tr>\n"+
-"  <tr>\n"+
-"    <td class=\"description\"><nobr>" + 
Messages.getBodyString(locale,"WebcrawlerConnector.ProxyAuthenticationUserNameColon")
 + "</nobr></td>\n"+
-"    <td class=\"value\"><input type=\"text\" size=\"32\" 
name=\"proxyauthusername\" 
value=\""+Encoder.attributeEscape(proxyAuthUsername)+"\"/></td>\n"+
-"  </tr>\n"+
-"  <tr>\n"+
-"    <td class=\"description\"><nobr>" + 
Messages.getBodyString(locale,"WebcrawlerConnector.ProxyAuthenticationPasswordColon")
 + "</nobr></td>\n"+
-"    <td class=\"value\"><input type=\"password\" size=\"16\" 
name=\"proxyauthpassword\" 
value=\""+Encoder.attributeEscape(proxyAuthPassword)+"\"/></td>\n"+
-"  </tr>\n"+
-"</table>\n"
-      );
-    }
-    else
-    {
-      out.print(
-"<input type=\"hidden\" name=\"proxyhost\" 
value=\""+Encoder.attributeEscape(proxyHost)+"\"/>\n"+
-"<input type=\"hidden\" name=\"proxyport\" 
value=\""+Encoder.attributeEscape(proxyPort)+"\"/>\n"+
-"<input type=\"hidden\" name=\"proxyauthusername\" 
value=\""+Encoder.attributeEscape(proxyAuthUsername)+"\"/>\n"+
-"<input type=\"hidden\" name=\"proxyauthdomain\" 
value=\""+Encoder.attributeEscape(proxyAuthDomain)+"\"/>\n"+
-"<input type=\"hidden\" name=\"proxyauthpassword\" 
value=\""+Encoder.attributeEscape(proxyAuthPassword)+"\"/>\n"
-      );
-    }
+    
Messages.outputResourceWithVelocity(out,locale,"editConfiguration_Proxy.html.vm",velocityContext);
 
     // Access Credentials tab
     if 
(tabName.equals(Messages.getString(locale,"WebcrawlerConnector.AccessCredentials")))

Added: 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Proxy.html.vm
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Proxy.html.vm?rev=1792543&view=auto
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Proxy.html.vm
 (added)
+++ 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Proxy.html.vm
 Mon Apr 24 20:07:03 2017
@@ -0,0 +1,49 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+#if($TABNAME == $ResourceBundle.getString('WebcrawlerConnector.Proxy'))
+<table class="displaytable">
+  <tr><td class="separator" colspan="2"><hr/></td></tr>
+  <tr>
+    <td 
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.ProxyHostColon'))</nobr></td>
+    <td class="value"><input type="text" size="40" name="proxyhost" 
value="$Encoder.attributeEscape($PROXYHOST)"/></td>
+  </tr>
+  <tr>
+    <td 
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.ProxyPortColon'))</nobr></td>
+    <td class="value"><input type="text" size="5" name="proxyport" 
value="$Encoder.attributeEscape($PROXYPORT)"/></td>
+  </tr>
+  <tr>
+    <td 
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.ProxyAuthenticationDomainColon'))</nobr></td>
+    <td class="value"><input type="text" size="32" name="proxyauthdomain" 
value="$Encoder.attributeEscape($PROXYAUTHDOMAIN)"/></td>
+  </tr>
+  <tr>
+    <td 
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.ProxyAuthenticationUserNameColon'))</nobr></td>
+    <td class="value"><input type="text" size="32" name="proxyauthusername" 
value="$Encoder.attributeEscape($PROXYAUTHUSERNAME)"/></td>
+  </tr>
+  <tr>
+    <td 
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.ProxyAuthenticationPasswordColon'))</nobr></td>
+    <td class="value"><input type="password" size="16" 
name="proxyauthpassword" 
value="$Encoder.attributeEscape($PROXYAUTHPASSWORD)"/></td>
+  </tr>
+</table>
+#else
+<input type="hidden" name="proxyhost" 
value="$Encoder.attributeEscape($PROXYHOST)"/>
+<input type="hidden" name="proxyport" 
value="$Encoder.attributeEscape($PROXYPORT)"/>
+<input type="hidden" name="proxyauthusername" 
value="$Encoder.attributeEscape($PROXYAUTHUSERNAME)"/>
+<input type="hidden" name="proxyauthdomain" 
value="$Encoder.attributeEscape($PROXYAUTHDOMAIN)"/>
+<input type="hidden" name="proxyauthpassword" 
value="$Encoder.attributeEscape($PROXYAUTHPASSWORD)"/>
+#end
+

Propchange: 
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/webcrawler/editConfiguration_Proxy.html.vm
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to