You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2011/06/29 13:30:16 UTC
svn commit: r1141050 - in /incubator/wookie/trunk: build.properties
src/org/apache/wookie/controller/WidgetInstancesController.java
src/widgetserver.properties
Author: scottbw
Date: Wed Jun 29 11:30:15 2011
New Revision: 1141050
URL: http://svn.apache.org/viewvc?rev=1141050&view=rev
Log:
Fix for WOOKIE-111. I've added widget.server.scheme/host/port properties to widgetserver.properties which you can use to override the defaults (based on current request context) and removed the wookie.port (etc) properties from build.properties as these aren't actually used for anything now, and are confusing.
Modified:
incubator/wookie/trunk/build.properties
incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java
incubator/wookie/trunk/src/widgetserver.properties
Modified: incubator/wookie/trunk/build.properties
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/build.properties?rev=1141050&r1=1141049&r2=1141050&view=diff
==============================================================================
--- incubator/wookie/trunk/build.properties (original)
+++ incubator/wookie/trunk/build.properties Wed Jun 29 11:30:15 2011
@@ -3,11 +3,6 @@ version=0.9.1-SNAPSHOT
# Run arguments to use when running in developer mode
run.args="port=8080"
-# URL components for Wookie base URL
-wookie.domain=localhost
-wookie.port=8080
-wookie.path=wookie/
-
# Uncomment to include Extra features
include.extra.features
# Uncomment to include Scratchpad features
Modified: incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java?rev=1141050&r1=1141049&r2=1141050&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetInstancesController.java Wed Jun 29 11:30:15 2011
@@ -324,15 +324,23 @@ public class WidgetInstancesController e
String url = "";
IStartFile[] startFiles = instance.getWidget().getStartFiles().toArray(new IStartFile[instance.getWidget().getStartFiles().size()]);
- IStartFile sf = (IStartFile) LocalizationUtils.getLocalizedElement(startFiles, new String[]{instance.getLang()}, instance.getWidget().getDefaultLocale());
+ IStartFile sf = (IStartFile) LocalizationUtils.getLocalizedElement(startFiles, new String[]{instance.getLang()}, instance.getWidget().getDefaultLocale());
// Try default locale if no appropriate localization found
if (sf == null) sf = (IStartFile) LocalizationUtils.getLocalizedElement(startFiles, null, instance.getWidget().getDefaultLocale());
// No start file found, so throw an exception
if (sf == null) throw new IOException("No start file located for widget "+instance.getWidget().getGuid());
- URL urlWidget = new URL(request.getScheme() ,
- request.getServerName() ,
- request.getServerPort() , sf.getUrl());
+ // Use settings defined in properties if available, otherwise use the request context
+ Configuration properties = (Configuration) request.getSession().getServletContext().getAttribute("properties"); //$NON-NLS-1$
+ String scheme = request.getScheme();
+ String serverName = request.getServerName();
+ int serverPort = request.getServerPort();
+ String path = sf.getUrl();
+ if (properties.getString("widget.server.scheme")!=null && !properties.getString("widget.server.scheme").trim().equals("")) scheme = properties.getString("widget.server.scheme"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (properties.getString("widget.server.host")!=null && !properties.getString("widget.server.host").trim().equals("")) serverName = properties.getString("widget.server.host"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (properties.getString("widget.server.port")!=null && !properties.getString("widget.server.port").trim().equals("")) serverPort = Integer.parseInt(properties.getString("widget.server.port")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ URL urlWidget = new URL(scheme, serverName, serverPort, path);
if (urlWidget.getQuery() != null){
url+= urlWidget + "&idkey=" + instance.getIdKey() //$NON-NLS-1$
Modified: incubator/wookie/trunk/src/widgetserver.properties
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/widgetserver.properties?rev=1141050&r1=1141049&r2=1141050&view=diff
==============================================================================
--- incubator/wookie/trunk/src/widgetserver.properties (original)
+++ incubator/wookie/trunk/src/widgetserver.properties Wed Jun 29 11:30:15 2011
@@ -5,6 +5,14 @@ widget.web.page=http://incubator.apache.
# Keep this true while developing, but set to false for a build
widget.debug=true
#######################################################################
+# By default Wookie will use the same scheme/host/port it is being
+# served from when generating URLs for widgets. By changing these
+# settings you can override this, for example when deploying Wookie
+# using a virtual host configuration.
+#widget.server.scheme=
+#widget.server.hostname=
+#widget.server.port=
+#######################################################################
## Sending emails
widget.email.server=localhost
widget.email.port=25