You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@apache.org on 2005/01/23 08:08:50 UTC
svn commit: r126201 - in struts/shale/trunk/use-cases/src: java/org/apache/shale/usecases/lookup java/org/apache/shale/usecases/remote java/org/apache/shale/usecases/view web web/WEB-INF web/lookup
Author: craigmcc
Date: Sat Jan 22 23:08:49 2005
New Revision: 126201
URL: http://svn.apache.org/viewcvs?view=rev&rev=126201
Log:
Examples of two different techniques for remoting support. Such support
will typically be used by a rich JSF component that is generating code for
client side behavior, but it is generally useful outside of JSF as well.
The two fundamentally different approaches illustrated here are:
* "Java Based" -- these requests use the support provided by the recent
checkin to the core framework of Shale for mapping the context-relative
portion of a request URI (servlet path + path info) to a particular
command (in the Commons Chain sense) in a catalog named (by default)
"remote".
* "JSP Based" -- these requests use the JSF controller infrastructure
(and the Shale ViewController APIs) to trigger a JSP page (the examples
are coded in JSP 2.0's XML syntax) that renders an XML response to the
incoming request. The corresponding ViewController beans (supported by
Shale) illustrate where an application using this approach would put its
logic to acquire the appropriate data, and clean up after itself.
There is not one "right" answer to how remoting support should be implemented.
These two approaches should trigger some interesting thinking and experiments
on the most elegant ways to address the required functionality in Java based
applications.
Added:
struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/lookup/
struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/lookup/ListCategories.java
struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/lookup/ListLocales.java
struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/lookup/package.html
struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/remote/
struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/remote/ListCategories.java
struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/remote/ListLocales.java
struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/remote/package.html
struts/shale/trunk/use-cases/src/web/lookup/
struts/shale/trunk/use-cases/src/web/lookup/listCategories.jsp
struts/shale/trunk/use-cases/src/web/lookup/listLocales.jsp
Modified:
struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties
struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Domains.java
struts/shale/trunk/use-cases/src/web/WEB-INF/chain-config.xml
struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml
struts/shale/trunk/use-cases/src/web/usecases.jsp
Added: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/lookup/ListCategories.java
Url: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/lookup/ListCategories.java?view=auto&rev=126201
==============================================================================
--- (empty file)
+++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/lookup/ListCategories.java Sat Jan 22 23:08:49 2005
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.shale.usecases.lookup;
+
+import javax.faces.model.SelectItem;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.shale.usecases.view.BaseViewController;
+import org.apache.shale.usecases.view.Domains;
+import org.apache.shale.util.Messages;
+
+/**
+ * <p>ViewController to retrieve the message categories that are
+ * supported by this application.</p>
+ *
+ * $Id$
+ */
+public class ListCategories extends BaseViewController {
+
+
+ // -------------------------------------------------------- Static Variables
+
+
+ /**
+ * <p>The <code>Log</code> instance for this class.</p>
+ */
+ private static final Log log = LogFactory.getLog(ListCategories.class);
+
+
+ /**
+ * <p>Localized messages for this application.</p>
+ */
+ private static Messages messages =
+ new Messages("org.apache.shale.usecases.view.Bundle");
+
+
+ // -------------------------------------------------------------- Properties
+
+
+ /**
+ * <p>The set of supported message categories for this application.</p>
+ */
+ private SelectItem supportedCategories[] = null;
+ public SelectItem[] getSupportedCategories()
+ { return this.supportedCategories; }
+ public void setSupportedCategories(SelectItem[] supportedCategories)
+ { this.supportedCategories = supportedCategories; }
+
+
+ // -------------------------------------------------- Event Handling Methods
+
+
+ // -------------------------------------------------- ViewController Methods
+
+
+ /**
+ * <p>If any calculations were required to acquire the data required to
+ * perform this rendering, that logic would go in this method.</p>
+ */
+ public void prerender() {
+
+ setSupportedCategories
+ (((Domains) getBean("domains")).getSupportedCategories());
+
+ }
+
+
+ /**
+ * <p>If any resources were allocated in the <code>prerender()</code> method
+ * that were needed for rendering, and now need to be cleaned up, that
+ * logic would go in this method.</p>
+ */
+ public void destroy() {
+
+ setSupportedCategories(null);
+
+ }
+
+
+}
Added: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/lookup/ListLocales.java
Url: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/lookup/ListLocales.java?view=auto&rev=126201
==============================================================================
--- (empty file)
+++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/lookup/ListLocales.java Sat Jan 22 23:08:49 2005
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.shale.usecases.lookup;
+
+import javax.faces.model.SelectItem;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.shale.usecases.view.BaseViewController;
+import org.apache.shale.usecases.view.Domains;
+import org.apache.shale.util.Messages;
+
+/**
+ * <p>ViewController to retrieve the locales that are
+ * supported by this application.</p>
+ *
+ * $Id$
+ */
+public class ListLocales extends BaseViewController {
+
+
+ // -------------------------------------------------------- Static Variables
+
+
+ /**
+ * <p>The <code>Log</code> instance for this class.</p>
+ */
+ private static final Log log = LogFactory.getLog(ListLocales.class);
+
+
+ /**
+ * <p>Localized messages for this application.</p>
+ */
+ private static Messages messages =
+ new Messages("org.apache.shale.usecases.view.Bundle");
+
+
+ // -------------------------------------------------------------- Properties
+
+
+ /**
+ * <p>The set of supported locales for this application.</p>
+ */
+ private SelectItem supportedLocales[] = null;
+ public SelectItem[] getSupportedLocales()
+ { return this.supportedLocales; }
+ public void setSupportedLocales(SelectItem[] supportedLocales)
+ { this.supportedLocales = supportedLocales; }
+
+
+ // -------------------------------------------------- Event Handling Methods
+
+
+ // -------------------------------------------------- ViewController Methods
+
+
+ /**
+ * <p>If any calculations were required to acquire the data required to
+ * perform this rendering, that logic would go in this method.</p>
+ */
+ public void prerender() {
+
+ setSupportedLocales
+ (((Domains) getBean("domains")).getSupportedLocales());
+
+ }
+
+
+ /**
+ * <p>If any resources were allocated in the <code>prerender()</code> method
+ * that were needed for rendering, and now need to be cleaned up, that
+ * logic would go in this method.</p>
+ */
+ public void destroy() {
+
+ setSupportedLocales(null);
+
+ }
+
+
+}
Added: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/lookup/package.html
Url: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/lookup/package.html?view=auto&rev=126201
==============================================================================
--- (empty file)
+++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/lookup/package.html Sat Jan 22 23:08:49 2005
@@ -0,0 +1,28 @@
+<!--
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+-->
+
+<!-- $Id$ -->
+
+<body>
+
+<p>This package contains <code>ViewController</code> beans for the remoting
+support that is implemented via JSP pages, instead of Java code. This allows
+the developer to leverage the controller, expression evaluation, and managed
+beans capabilities of JSF, and the templating capabilities of JSP+JSTL, with
+easy code sharing between remoting support and human user interaction support
+within the same web application.</p>
+
+</body>
Added: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/remote/ListCategories.java
Url: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/remote/ListCategories.java?view=auto&rev=126201
==============================================================================
--- (empty file)
+++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/remote/ListCategories.java Sat Jan 22 23:08:49 2005
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.shale.usecases.remote;
+
+import javax.faces.model.SelectItem;
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.shale.remote.RemoteContext;
+import org.apache.shale.remote.ResponseWrapper;
+import org.apache.shale.usecases.view.Domains;
+
+/**
+ * <p>Remote command to list the supported message categories for this application,
+ * localized based on the <code>Locale</code> specified by the request.</p>
+ *
+ * $Id$
+ */
+public class ListCategories implements Command {
+
+
+ // -------------------------------------------------------- Static Variables
+
+
+ /**
+ * <p>The context attribute key under which our {@link Domains} object
+ * may be found.</p>
+ */
+ private static final String DOMAINS = "domains";
+
+
+ // --------------------------------------------------------- Command Methods
+
+
+ /**
+ * <p>Look up the supported categories and create a response including them,
+ * with a root <code>cqategories</code> element, a <code>category</code>
+ * element for each supported category, with subordinate elements
+ * <code>label</code> and <code>value</code>.</p>
+ *
+ * @param context {@link RemoteContext} for this request
+ */
+ public boolean execute(Context context) throws Exception {
+
+ // Set up the response we will create
+ RemoteContext rcontext = (RemoteContext) context;
+ rcontext.setResponseContentType("text/xml");
+ rcontext.setResponseEncoding("UTF-8");
+ ResponseWrapper wrapper =
+ new ResponseWrapper(rcontext.getResponseWriter(), "UTF-8");
+
+ // Look up the data we need in order to complete this response
+ Domains domains = (Domains) rcontext.getContextAttributes().get(DOMAINS);
+ if (domains == null) {
+ // FIXME - fake managed beans setup because we are not a JSF request
+ domains = new Domains();
+ rcontext.getContextAttributes().put(DOMAINS, domains);
+ }
+ SelectItem items[] =
+ domains.getSupportedCategories(rcontext.getRequestLocale());
+
+ // Generate the response content
+ wrapper.startDocument();
+ wrapper.startElement("categories");
+ wrapper.writeNewline();
+ for (int i = 0; i < items.length; i++) {
+ wrapper.startElement("category");
+ wrapper.writeNewline();
+ wrapper.startElement("label");
+ wrapper.writeText(items[i].getLabel());
+ wrapper.endElement("label");
+ wrapper.writeNewline();
+ wrapper.startElement("value");
+ wrapper.writeText(items[i].getValue());
+ wrapper.endElement("value");
+ wrapper.writeNewline();
+ wrapper.endElement("category");
+ wrapper.writeNewline();
+ }
+ wrapper.endElement("categories");
+ wrapper.endDocument();
+
+ // Return true because this response is now complete
+ return true;
+
+ }
+
+
+}
Added: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/remote/ListLocales.java
Url: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/remote/ListLocales.java?view=auto&rev=126201
==============================================================================
--- (empty file)
+++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/remote/ListLocales.java Sat Jan 22 23:08:49 2005
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.shale.usecases.remote;
+
+import javax.faces.model.SelectItem;
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.shale.remote.RemoteContext;
+import org.apache.shale.remote.ResponseWrapper;
+import org.apache.shale.usecases.view.Domains;
+
+/**
+ * <p>Remote command to list the supported locales for this application,
+ * localized based on the <code>Locale</code> specified by the request.</p>
+ *
+ * $Id$
+ */
+public class ListLocales implements Command {
+
+
+ // -------------------------------------------------------- Static Variables
+
+
+ /**
+ * <p>The context attribute key under which our {@link Domains} object
+ * may be found.</p>
+ */
+ private static final String DOMAINS = "domains";
+
+
+ // --------------------------------------------------------- Command Methods
+
+
+ /**
+ * <p>Look up the supported locales and create a response including them,
+ * with a root <code>locales</code> element, a <code>locale</code> element
+ * for each supported <code>Locale</code>, with subordinate elements
+ * <code>label</code> and <code>value</code>.</p>
+ *
+ * @param context {@link RemoteContext} for this request
+ */
+ public boolean execute(Context context) throws Exception {
+
+ // Set up the response we will create
+ RemoteContext rcontext = (RemoteContext) context;
+ rcontext.setResponseContentType("text/xml");
+ rcontext.setResponseEncoding("UTF-8");
+ ResponseWrapper wrapper =
+ new ResponseWrapper(rcontext.getResponseWriter(), "UTF-8");
+
+ // Look up the data we need in order to complete this response
+ Domains domains = (Domains) rcontext.getContextAttributes().get(DOMAINS);
+ if (domains == null) {
+ // FIXME - fake managed beans setup because we are not a JSF request
+ domains = new Domains();
+ rcontext.getContextAttributes().put(DOMAINS, domains);
+ }
+ SelectItem items[] =
+ domains.getSupportedLocales(rcontext.getRequestLocale());
+
+ // Generate the response content
+ wrapper.startDocument();
+ wrapper.startElement("locales");
+ wrapper.writeNewline();
+ for (int i = 0; i < items.length; i++) {
+ wrapper.startElement("locale");
+ wrapper.writeNewline();
+ wrapper.startElement("label");
+ wrapper.writeText(items[i].getLabel());
+ wrapper.endElement("label");
+ wrapper.writeNewline();
+ wrapper.startElement("value");
+ wrapper.writeText(items[i].getValue());
+ wrapper.endElement("value");
+ wrapper.writeNewline();
+ wrapper.endElement("locale");
+ wrapper.writeNewline();
+ }
+ wrapper.endElement("locales");
+ wrapper.endDocument();
+
+ // Return true because this response is now complete
+ return true;
+
+ }
+
+
+}
Added: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/remote/package.html
Url: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/remote/package.html?view=auto&rev=126201
==============================================================================
--- (empty file)
+++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/remote/package.html Sat Jan 22 23:08:49 2005
@@ -0,0 +1,35 @@
+<!--
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+-->
+
+<!-- $Id$ -->
+
+<body>
+
+<p>This package contains <code>Command</code> implementations for remoting
+support that is implemented using the framework's capbility to map context
+relative paths to a particular command in the (by default) "remote" catalog.</p>
+
+<p>Each such command will receive a context instance that can be cast to
+<a href="RemoteContext.html">RemoteContext</a>, which conveniently abstracts
+the servlet API related issues (and makes the creation of unit tests for these
+command instances substantially easier). In addition, if a remoting command
+needs to generate XML output, it may choose to leverage the provided
+<a href="ResponseWrapper.html">ResponseWrapper</a> class, whose APIs were
+inspired by <code>javax.faces.context.ResponseWriter</code>. This is not,
+of course, the only means by which XML output can be created, but it is
+definitely convenient.</p>
+
+</body>
Modified: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties
Url: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties?view=diff&rev=126201&p1=struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties&r1=126200&p2=struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties&r2=126201
==============================================================================
--- struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties (original)
+++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties Sat Jan 22 23:08:49 2005
@@ -68,8 +68,13 @@
select.title=Select Locale
# Use Cases Menu Messages
+usecases.categories=List Categories (Remoting)
usecases.edit=Edit User Profile
+usecases.java=Remoting Support (Java Based)
+usecases.jsp=Remoting Support (JSP Based)
usecases.locale=Select Language
+usecases.locales=List Locales (Remoting)
usecases.logoff=Log Off
usecases.logon=Log On Dialog
+usecases.primary=Primary Use Cases
usecases.title=Shale Framework Use Cases
Modified: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Domains.java
Url: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Domains.java?view=diff&rev=126201&p1=struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Domains.java&r1=126200&p2=struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Domains.java&r2=126201
==============================================================================
--- struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Domains.java (original)
+++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Domains.java Sat Jan 22 23:08:49 2005
@@ -22,6 +22,9 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import javax.faces.FactoryFinder;
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.apache.shale.util.Messages;
@@ -79,6 +82,19 @@
// Return any previously cached array for this request locale
Locale locale =
FacesContext.getCurrentInstance().getViewRoot().getLocale();
+ return getSupportedCategories(locale);
+
+ }
+
+
+ /**
+ * <p>Return an array of selection items representing the message categories
+ * supported by this application, with the labels localized based on the
+ * specified <code>Locale</code>.</p>
+ */
+ public SelectItem[] getSupportedCategories(Locale locale) {
+
+ // Return any previously cached array for the specfiied locale
SelectItem items[] = null;
synchronized (categories) {
items = (SelectItem[]) categories.get(locale);
@@ -109,6 +125,7 @@
}
+
/**
* <p>Return an array of selection items representing the locales supported
* by this application, with the labels localized based on the
@@ -116,9 +133,23 @@
*/
public SelectItem[] getSupportedLocales() {
- // Return any previously cached array for this request locale
Locale locale =
FacesContext.getCurrentInstance().getViewRoot().getLocale();
+ return getSupportedLocales(locale);
+
+ }
+
+
+ /**
+ * <p>Return an array of selection items representing the locales supported
+ * by this application, with the labels localized based on the specified
+ * <code>Locale</code>.</p>
+ *
+ * @param locale <code>Locale</code> used to localize the labels
+ */
+ public SelectItem[] getSupportedLocales(Locale locale) {
+
+ // Return any previously cached array for the specified locale
SelectItem items[] = null;
synchronized (locales) {
items = (SelectItem[]) locales.get(locale);
@@ -130,8 +161,10 @@
// Construct and cache a new array, before returning it
SelectItem item = null;
List list = new ArrayList();
- Iterator supporteds =
- FacesContext.getCurrentInstance().getApplication().getSupportedLocales();
+ ApplicationFactory afactory = (ApplicationFactory)
+ FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
+ Application application = afactory.getApplication();
+ Iterator supporteds = application.getSupportedLocales();
while (supporteds.hasNext()) {
Locale supported = (Locale) supporteds.next();
item = new SelectItem(supported.toString(),
@@ -144,7 +177,7 @@
}
return items;
+
}
-
}
Modified: struts/shale/trunk/use-cases/src/web/WEB-INF/chain-config.xml
Url: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/WEB-INF/chain-config.xml?view=diff&rev=126201&p1=struts/shale/trunk/use-cases/src/web/WEB-INF/chain-config.xml&r1=126200&p2=struts/shale/trunk/use-cases/src/web/WEB-INF/chain-config.xml&r2=126201
==============================================================================
--- struts/shale/trunk/use-cases/src/web/WEB-INF/chain-config.xml (original)
+++ struts/shale/trunk/use-cases/src/web/WEB-INF/chain-config.xml Sat Jan 22 23:08:49 2005
@@ -30,4 +30,18 @@
</chain>
</catalog>
+
+ <!-- ========== Remote Processing Commands =============================== -->
+
+ <catalog name="remote">
+
+ <command name="/list/supportedCategories.remote"
+ className="org.apache.shale.usecases.remote.ListCategories"/>
+
+ <command name="/list/supportedLocales.remote"
+ className="org.apache.shale.usecases.remote.ListLocales"/>
+
+ </catalog>
+
+
</catalogs>
Modified: struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml
Url: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml?view=diff&rev=126201&p1=struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml&r1=126200&p2=struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml&r2=126201
==============================================================================
--- struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml (original)
+++ struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml Sat Jan 22 23:08:49 2005
@@ -179,6 +179,51 @@
</navigation-rule>
+ <!-- ========================= Remote Lookup Support ===================== -->
+
+
+ <!-- ViewController Beans -->
+
+ <managed-bean>
+ <description>
+ Remoting support method to retrieve the set of supported message
+ categories for this application.
+ </description>
+ <managed-bean-name>lookup$listCategories</managed-bean-name>
+ <managed-bean-class>
+ org.apache.shale.usecases.lookup.ListCategories
+ </managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+
+ <managed-bean>
+ <description>
+ Remoting support method to retrieve the set of supported locales
+ for this application.
+ </description>
+ <managed-bean-name>lookup$listLocales</managed-bean-name>
+ <managed-bean-class>
+ org.apache.shale.usecases.lookup.ListLocales
+ </managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+
+ <!-- Navigation Rules -->
+ <!-- These are only needed because we have demo links on the main menu -->
+
+ <navigation-rule>
+ <from-view-id>*</from-view-id>
+ <navigation-case>
+ <from-outcome>lookup$listCategories</from-outcome>
+ <to-view-id>/lookup/listCategories.jsp</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>lookup$listLocales</from-outcome>
+ <to-view-id>/lookup/listLocales.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+
+
<!-- ===================== Miscellaneous Facilities ====================== -->
Added: struts/shale/trunk/use-cases/src/web/lookup/listCategories.jsp
Url: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/lookup/listCategories.jsp?view=auto&rev=126201
==============================================================================
--- (empty file)
+++ struts/shale/trunk/use-cases/src/web/lookup/listCategories.jsp Sat Jan 22 23:08:49 2005
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004-2005 The Apache Software Foundation.
+
+ Licensed 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.
+
+-->
+<jsp:root version="2.0"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:s="http://struts.apache.org/shale/core">
+
+ <jsp:directive.page
+ contentType="text/xml;charset=UTF-8"/>
+
+ <categories>
+ <c:forEach var="category"
+ items="${lookup$listCategories.supportedCategories}">
+ <category>
+ <label>${category.label}</label>
+ <value>${category.value}</value>
+ </category>
+ </c:forEach>
+ </categories>
+
+</jsp:root>
Added: struts/shale/trunk/use-cases/src/web/lookup/listLocales.jsp
Url: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/lookup/listLocales.jsp?view=auto&rev=126201
==============================================================================
--- (empty file)
+++ struts/shale/trunk/use-cases/src/web/lookup/listLocales.jsp Sat Jan 22 23:08:49 2005
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004-2005 The Apache Software Foundation.
+
+ Licensed 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.
+
+-->
+<jsp:root version="2.0"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:s="http://struts.apache.org/shale/core">
+
+ <jsp:directive.page
+ contentType="text/xml;charset=UTF-8"/>
+
+ <locales>
+ <c:forEach var="locale"
+ items="${lookup$listLocales.supportedLocales}">
+ <locale>
+ <label>${locale.label}</label>
+ <value>${locale.value}</value>
+ </locale>
+ </c:forEach>
+ </locales>
+
+</jsp:root>
Modified: struts/shale/trunk/use-cases/src/web/usecases.jsp
Url: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/usecases.jsp?view=diff&rev=126201&p1=struts/shale/trunk/use-cases/src/web/usecases.jsp&r1=126200&p2=struts/shale/trunk/use-cases/src/web/usecases.jsp&r2=126201
==============================================================================
--- struts/shale/trunk/use-cases/src/web/usecases.jsp (original)
+++ struts/shale/trunk/use-cases/src/web/usecases.jsp Sat Jan 22 23:08:49 2005
@@ -33,6 +33,8 @@
<h:form id="usecasesForm">
+ <h1><h:outputText value="#{messages['usecases.primary']}"/></h1>
+
<h:panelGrid columns="1">
<f:facet name="header">
@@ -70,6 +72,36 @@
<h:outputText value="#{view.locale}"/>
</h:panelGroup>
</f:facet>
+
+ </h:panelGrid>
+
+ <h1><h:outputText value="#{messages['usecases.java']}"/></h1>
+
+ <h:panelGrid columns="1">
+
+ <h:outputLink value="list/supportedCategories.remote"
+ target="_new">
+ <h:outputText value="#{messages['usecases.categories']}"/>
+ </h:outputLink>
+
+ <h:outputLink value="list/supportedLocales.remote"
+ target="_new">
+ <h:outputText value="#{messages['usecases.locales']}"/>
+ </h:outputLink>
+
+ </h:panelGrid>
+
+ <h1><h:outputText value="#{messages['usecases.jsp']}"/></h1>
+
+ <h:panelGrid columns="1">
+
+ <h:commandLink action="lookup$listCategories">
+ <h:outputText value="#{messages['usecases.categories']}"/>
+ </h:commandLink>
+
+ <h:commandLink action="lookup$listLocales">
+ <h:outputText value="#{messages['usecases.locales']}"/>
+ </h:commandLink>
</h:panelGrid>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org