Author: husted Date: Fri Dec 22 08:47:39 2006 New Revision: 489687 URL: http://svn.apache.org/viewvc?view=rev&rev=489687 Log: Add new Web project based on Jayrock and Dojo.
Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Default.aspx struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Default.aspx.cs struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Demo.ashx struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/DemoDojo.html struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/HelloWorld.ashx struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/HelloWorld.html struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Web.Config struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/js/ Modified: struts/sandbox/trunk/overdrive/PhoneBook2/PhoneBook2.sln struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Test.csproj Modified: struts/sandbox/trunk/overdrive/PhoneBook2/PhoneBook2.sln URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/PhoneBook2.sln?view=diff&rev=489687&r1=489686&r2=489687 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/PhoneBook2.sln (original) +++ struts/sandbox/trunk/overdrive/PhoneBook2/PhoneBook2.sln Fri Dec 22 08:47:39 2006 @@ -1,32 +1,31 @@  Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 -Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "C:\...\website\", "projects\www\website\", "{E7DB67ED-E784-4A1B-9654-B37C25F7B6CE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhoneBook2", "PhoneBook2.csproj", "{EB1F252E-0AA5-4485-966D-9D7AAC18AC5E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "projects\Core\Core.csproj", "{F65FCC91-C9CB-40CE-87A6-C0CB00F73592}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "projects\Test\Test.csproj", "{C461D986-BC3C-4A48-8B6F-B4EFA47033E6}" +EndProject +Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "C:\...\Web\", "projects\Web\", "{055ABF30-6F91-48EB-B457-2D9274F0D34F}" ProjectSection(WebsiteProperties) = preProject - ProjectReferences = "{F65FCC91-C9CB-40CE-87A6-C0CB00F73592}|PhoneBook2.Core.dll;" - Debug.AspNetCompiler.VirtualPath = "/website" - Debug.AspNetCompiler.PhysicalPath = "projects\www\website\" - Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\website\" + Debug.AspNetCompiler.VirtualPath = "/Web" + Debug.AspNetCompiler.PhysicalPath = "projects\Web\" + Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\Web\" Debug.AspNetCompiler.Updateable = "true" Debug.AspNetCompiler.ForceOverwrite = "true" Debug.AspNetCompiler.FixedNames = "false" Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.VirtualPath = "/website" - Release.AspNetCompiler.PhysicalPath = "projects\www\website\" - Release.AspNetCompiler.TargetPath = "PrecompiledWeb\website\" + Release.AspNetCompiler.VirtualPath = "/Web" + Release.AspNetCompiler.PhysicalPath = "projects\Web\" + Release.AspNetCompiler.TargetPath = "PrecompiledWeb\Web\" Release.AspNetCompiler.Updateable = "true" Release.AspNetCompiler.ForceOverwrite = "true" Release.AspNetCompiler.FixedNames = "false" Release.AspNetCompiler.Debug = "False" - VWDPort = "2350" + VWDPort = "3594" EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "projects\Core\Core.csproj", "{F65FCC91-C9CB-40CE-87A6-C0CB00F73592}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "projects\Test\Test.csproj", "{C461D986-BC3C-4A48-8B6F-B4EFA47033E6}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web Site", "projects\src\Web Site.csproj", "{3EE5DA81-D2F4-4134-92E9-E65E27F5E425}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|.NET = Debug|.NET @@ -37,16 +36,16 @@ Release|Mixed Platforms = Release|Mixed Platforms EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E7DB67ED-E784-4A1B-9654-B37C25F7B6CE}.Debug|.NET.ActiveCfg = Debug|.NET - {E7DB67ED-E784-4A1B-9654-B37C25F7B6CE}.Debug|.NET.Build.0 = Debug|.NET - {E7DB67ED-E784-4A1B-9654-B37C25F7B6CE}.Debug|Any CPU.ActiveCfg = Debug|.NET - {E7DB67ED-E784-4A1B-9654-B37C25F7B6CE}.Debug|Mixed Platforms.ActiveCfg = Debug|.NET - {E7DB67ED-E784-4A1B-9654-B37C25F7B6CE}.Debug|Mixed Platforms.Build.0 = Debug|.NET - {E7DB67ED-E784-4A1B-9654-B37C25F7B6CE}.Release|.NET.ActiveCfg = Debug|.NET - {E7DB67ED-E784-4A1B-9654-B37C25F7B6CE}.Release|.NET.Build.0 = Debug|.NET - {E7DB67ED-E784-4A1B-9654-B37C25F7B6CE}.Release|Any CPU.ActiveCfg = Debug|.NET - {E7DB67ED-E784-4A1B-9654-B37C25F7B6CE}.Release|Mixed Platforms.ActiveCfg = Debug|.NET - {E7DB67ED-E784-4A1B-9654-B37C25F7B6CE}.Release|Mixed Platforms.Build.0 = Debug|.NET + {EB1F252E-0AA5-4485-966D-9D7AAC18AC5E}.Debug|.NET.ActiveCfg = Debug|Any CPU + {EB1F252E-0AA5-4485-966D-9D7AAC18AC5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EB1F252E-0AA5-4485-966D-9D7AAC18AC5E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EB1F252E-0AA5-4485-966D-9D7AAC18AC5E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {EB1F252E-0AA5-4485-966D-9D7AAC18AC5E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {EB1F252E-0AA5-4485-966D-9D7AAC18AC5E}.Release|.NET.ActiveCfg = Release|Any CPU + {EB1F252E-0AA5-4485-966D-9D7AAC18AC5E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EB1F252E-0AA5-4485-966D-9D7AAC18AC5E}.Release|Any CPU.Build.0 = Release|Any CPU + {EB1F252E-0AA5-4485-966D-9D7AAC18AC5E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {EB1F252E-0AA5-4485-966D-9D7AAC18AC5E}.Release|Mixed Platforms.Build.0 = Release|Any CPU {F65FCC91-C9CB-40CE-87A6-C0CB00F73592}.Debug|.NET.ActiveCfg = Debug|Any CPU {F65FCC91-C9CB-40CE-87A6-C0CB00F73592}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F65FCC91-C9CB-40CE-87A6-C0CB00F73592}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -67,16 +66,16 @@ {C461D986-BC3C-4A48-8B6F-B4EFA47033E6}.Release|Any CPU.Build.0 = Release|Any CPU {C461D986-BC3C-4A48-8B6F-B4EFA47033E6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {C461D986-BC3C-4A48-8B6F-B4EFA47033E6}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {3EE5DA81-D2F4-4134-92E9-E65E27F5E425}.Debug|.NET.ActiveCfg = Debug|Any CPU - {3EE5DA81-D2F4-4134-92E9-E65E27F5E425}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3EE5DA81-D2F4-4134-92E9-E65E27F5E425}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3EE5DA81-D2F4-4134-92E9-E65E27F5E425}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {3EE5DA81-D2F4-4134-92E9-E65E27F5E425}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {3EE5DA81-D2F4-4134-92E9-E65E27F5E425}.Release|.NET.ActiveCfg = Release|Any CPU - {3EE5DA81-D2F4-4134-92E9-E65E27F5E425}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3EE5DA81-D2F4-4134-92E9-E65E27F5E425}.Release|Any CPU.Build.0 = Release|Any CPU - {3EE5DA81-D2F4-4134-92E9-E65E27F5E425}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {3EE5DA81-D2F4-4134-92E9-E65E27F5E425}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {055ABF30-6F91-48EB-B457-2D9274F0D34F}.Debug|.NET.ActiveCfg = Debug|.NET + {055ABF30-6F91-48EB-B457-2D9274F0D34F}.Debug|.NET.Build.0 = Debug|.NET + {055ABF30-6F91-48EB-B457-2D9274F0D34F}.Debug|Any CPU.ActiveCfg = Debug|.NET + {055ABF30-6F91-48EB-B457-2D9274F0D34F}.Debug|Mixed Platforms.ActiveCfg = Debug|.NET + {055ABF30-6F91-48EB-B457-2D9274F0D34F}.Debug|Mixed Platforms.Build.0 = Debug|.NET + {055ABF30-6F91-48EB-B457-2D9274F0D34F}.Release|.NET.ActiveCfg = Debug|.NET + {055ABF30-6F91-48EB-B457-2D9274F0D34F}.Release|.NET.Build.0 = Debug|.NET + {055ABF30-6F91-48EB-B457-2D9274F0D34F}.Release|Any CPU.ActiveCfg = Debug|.NET + {055ABF30-6F91-48EB-B457-2D9274F0D34F}.Release|Mixed Platforms.ActiveCfg = Debug|.NET + {055ABF30-6F91-48EB-B457-2D9274F0D34F}.Release|Mixed Platforms.Build.0 = Debug|.NET EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Test.csproj URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Test.csproj?view=diff&rev=489687&r1=489686&r2=489687 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Test.csproj (original) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Test.csproj Fri Dec 22 08:47:39 2006 @@ -7,8 +7,8 @@ <ProjectGuid>{C461D986-BC3C-4A48-8B6F-B4EFA47033E6}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>PhoneBook2.Core</RootNamespace> - <AssemblyName>PhoneBook2.Test</AssemblyName> + <RootNamespace>PhoneBook.Core</RootNamespace> + <AssemblyName>PhoneBook.Test</AssemblyName> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -28,13 +28,36 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="Agility.Core, Version=1.0.2355.25640, Culture=neutral"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\local-cache\Agility\Agility.Core.dll</HintPath> + </Reference> + <Reference Include="Nexus.Core, Version=1.0.2539.22197, Culture=neutral"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\local-cache\Nexus\Nexus.Core.dll</HintPath> + </Reference> + <Reference Include="Nexus.Test, Version=1.0.2539.22198, Culture=neutral"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\local-cache\Nexus\Nexus.Test.dll</HintPath> + </Reference> + <Reference Include="Nexus.Web, Version=1.0.2539.22197, Culture=neutral"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\local-cache\Nexus\Nexus.Web.dll</HintPath> + </Reference> <Reference Include="nunit.framework, Version=2.2.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" /> + <Reference Include="Spring.Core, Version=1.1.0.2, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\local-cache\SpringNet\Spring.Core.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> - <Compile Include="Class1.cs" /> + <Compile Include="BaseTest.cs" /> + <Compile Include="Commands\DirectoryViewTest.cs" /> + <Compile Include="Commands\FilterLists.cs" /> + <Compile Include="Commands\SelectAllTest.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> @@ -42,6 +65,19 @@ <Project>{F65FCC91-C9CB-40CE-87A6-C0CB00F73592}</Project> <Name>Core</Name> </ProjectReference> + </ItemGroup> + <ItemGroup> + <Content Include="bin\Debug\sqlmap.config.xml" /> + <Content Include="Objects.xml" /> + <Content Include="Resources\AppBase.xml" /> + <Content Include="Resources\AppConfig.xml" /> + <Content Include="Resources\AppFields.xml" /> + <Content Include="Resources\Catalog.xml" /> + <Content Include="Resources\Queries.xml" /> + </ItemGroup> + <ItemGroup> + <None Include="bin\Debug\providers.config" /> + <None Include="bin\Debug\sqlmap.config" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Default.aspx URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Default.aspx?view=auto&rev=489687 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Default.aspx (added) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Default.aspx Fri Dec 22 08:47:39 2006 @@ -0,0 +1,16 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" > +<head runat="server"> + <title>Untitled Page</title> +</head> +<body> + <form id="form1" runat="server"> + <div> + Howdy! + </div> + </form> +</body> +</html> Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Default.aspx.cs URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Default.aspx.cs?view=auto&rev=489687 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Default.aspx.cs (added) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Default.aspx.cs Fri Dec 22 08:47:39 2006 @@ -0,0 +1,17 @@ +using System; +using System.Data; +using System.Configuration; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +public partial class _Default : System.Web.UI.Page +{ + protected void Page_Load(object sender, EventArgs e) + { + + } +} Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Demo.ashx URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Demo.ashx?view=auto&rev=489687 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Demo.ashx (added) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Demo.ashx Fri Dec 22 08:47:39 2006 @@ -0,0 +1,310 @@ +<%@ WebHandler Class="JayrockWeb.DemoService" Language="C#" %> + +namespace JayrockWeb +{ + using System; + using System.Configuration; + using System.Data; + using System.Data.SqlClient; + using System.Collections; + using System.Collections.Specialized; + using System.Web; + using System.Web.SessionState; + using System.Web.UI; + using System.Web.UI.WebControls; + using Jayrock.JsonRpc; + using Jayrock.JsonRpc.Web; + + [ JsonRpcHelp("This is a JSON-RPC service that demonstrates the basic features of the Jayrock library.") ] + public class DemoService : JsonRpcHandler, IRequiresSessionState + { + [ JsonRpcMethod("echo", Idempotent = true)] + [ JsonRpcHelp("Echoes back the text sent as input.") ] + public string Echo(string text) + { + return text; + } + + [ JsonRpcMethod("echoObject", Idempotent = true)] + [ JsonRpcHelp("Echoes back the object sent as input.") ] + public object EchoOject(object o) + { + return o; + } + + [ JsonRpcMethod("echoArgs", Idempotent = true)] + [ JsonRpcHelp("Echoes back the arguments sent as input. This method demonstrates variable number of arguments.") ] + public object EchoArgs(params object[] args) + { + return args; + } + + [ JsonRpcMethod("echoAsStrings", Idempotent = true)] + [ JsonRpcHelp("Echoes back the arguments as an array of strings. This method demonstrates working with variable number of arguments.") ] + public object EchoAsStrings(params object[] args) + { + string[] strings = new string[args.Length]; + + for (int i = 0; i < args.Length; i++) + { + if (args[i] != null) + strings[i] = args[i].ToString(); + } + + return strings; + } + + [ JsonRpcMethod("echoGuid", Idempotent = true)] + [ JsonRpcHelp("Echoes back the given GUID. This method demonstrates working with an argument typed as System.Guid.") ] + public Guid EchoGuid(Guid id) + { + return id; + } + + [ JsonRpcMethod("sum", Idempotent = true)] + [ JsonRpcHelp("Return the sum of two integers.") ] + [ JsonRpcObsolete("Use the total method instead.") ] + public int Sum(int a, int b) + { + return a + b; + } + + [ JsonRpcMethod("getStringArray", Idempotent = true)] + [ JsonRpcHelp("Returns an array of city names. Demonstrates returning a strongly-typed array.") ] + public string[] GetCities() + { + return new string[] { "London", "Zurich", "Paris", "New York" }; + } + + [ JsonRpcMethod("now", Idempotent = true)] + [ JsonRpcHelp("Returns the local time on the server. Demonstrates how DateTime is returned simply as a string using the ISO 8601 format.") ] + public DateTime Now() + { + return DateTime.Now; + } + + [ JsonRpcMethod("newGuid", Idempotent = true)] + [ JsonRpcHelp("Generates and returns a GUID as a string.") ] + public Guid NewGuid() + { + return Guid.NewGuid(); + } + + [ JsonRpcMethod("cookies", Idempotent = true)] + [ JsonRpcHelp("Returns the cookie names seen by the server.") ] + public HttpCookieCollection Cookies() + { + return Request.Cookies; + } + + [ JsonRpcMethod("serverVariables", Idempotent = true)] + [ JsonRpcHelp("Returns the server variables collection at the server. Demonstrates returning NameValueCollection.") ] + public NameValueCollection ServerVariables() + { + return Request.ServerVariables; + } + + [ JsonRpcMethod("getAuthor", Idempotent = true)] + [ JsonRpcHelp("Returns information about the author. Demonstrates how a Hashtable from the server is automatically converted into an object on the client-side.") ] + public IDictionary GetAuthor() + { + Hashtable author = new Hashtable(); + author["FirstName"] = "Atif"; + author["LastName"] = "Aziz"; + return author; + } + + [ JsonRpcMethod("getCouple", Idempotent = true) ] + [ JsonRpcHelp("Returns a server-typed object representing a couple. Demonstrates to returning server-typed objects.")] + public Marriage GetCouple() + { + return new Marriage( + new Person("Mickey", "Mouse"), + new Person("Minnie", "Mouse")); + } + + [ JsonRpcMethod("swapNames", Idempotent = true)] + [ JsonRpcHelp("Swaps first and last name of person. Demonstrates receiving and returning a server-typed object.")] + public Person SwapPersonNames(Person p) + { + return p == null ? new Person() : new Person(p.LastName, p.FirstName); + } + + [JsonRpcMethod("getDataSet", Idempotent = true)] + [ JsonRpcHelp("Returns the Northwind employees as a DataSet.") ] + public DataSet GetEmployeeSet() + { + using (SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["NorthwindConnectionString"])) + { + SqlDataAdapter a = new SqlDataAdapter(); + a.SelectCommand = new SqlCommand("SELECT EmployeeID, LastName, FirstName, Title, TitleOfCourtesy, BirthDate, HireDate, Address, City, Region, PostalCode, Country, HomePhone, Extension, Notes, ReportsTo, PhotoPath FROM Employees", connection); + DataSet ds = new DataSet(); + a.Fill(ds, "Employee"); + return ds; + } + } + + [ JsonRpcMethod("getDataTable", Idempotent = true)] + [ JsonRpcHelp("Returns the Northwind employees as a DataTable.") ] + public DataTable GetEmployeeTable() + { + return GetEmployeeSet().Tables[0]; + } + + [ JsonRpcMethod("getRowArray", Idempotent = true)] + [ JsonRpcHelp("Returns the Northwind employees as an array of DataRow objects.") ] + public DataRow[] GetEmployeeRowArray() + { + return GetEmployeeSet().Tables[0].Select(); + } + + [ JsonRpcMethod("getRowCollection", Idempotent = true)] + [ JsonRpcHelp("Returns the Northwind employees as a DataRowCollection.") ] + public DataRowCollection GetEmployeeRows() + { + return GetEmployeeSet().Tables[0].Rows; + } + + [ JsonRpcMethod("getDataView", Idempotent = true)] + [ JsonRpcHelp("Returns the Northwind employees as a DataView object.") ] + public DataView GetEmployeeView() + { + return GetEmployeeSet().Tables[0].DefaultView; + } + + [ JsonRpcMethod("getFirstDataRow", Idempotent = true)] + [ JsonRpcHelp("Returns the first Northwind employee as a DataRow object.") ] + public DataRow GetFirstEmployeeRow() + { + return GetEmployeeSet().Tables[0].Rows[0]; + } + + [ JsonRpcMethod("getFirstDataRowView", Idempotent = true)] + [ JsonRpcHelp("Returns the first Northwind employee as a DataRowView object.") ] + public DataRowView GetFirstEmployeeRowView() + { + return GetEmployeeSet().Tables[0].DefaultView[0]; + } + + [ JsonRpcMethod("getDropDown", Idempotent = true)] + [ JsonRpcHelp("Returns a data-bound DropDownList to the client as HTML.") ] + public Control EmployeeDropDown() + { + DropDownList ddl = new DropDownList(); + DataSet ds = GetEmployeeSet(); + ds.Tables[0].Columns.Add("FullName", typeof(string), "FirstName + ' ' + LastName"); + ddl.DataSource = ds; + ddl.DataMember = "Employee"; + ddl.DataTextField = "FullName"; + ddl.DataValueField = "EmployeeID"; + ddl.DataBind(); + return ddl; + } + + [ JsonRpcMethod("getDataGrid", Idempotent = true)] + [ JsonRpcHelp("Returns a data-bound DataGrid to the client as HTML.") ] + public Control EmployeeDataGrid() + { + DataGrid grid = new DataGrid(); + grid.DataSource = GetEmployeeSet(); + grid.DataBind(); + return grid; + } + + [ JsonRpcMethod("total", Idempotent = true)] + [ JsonRpcHelp("Returns the total of all integers sent in an array.") ] + public int Total(int[] values) + { + int total = 0; + + if (values != null) + { + foreach (int value in values) + total += value; + } + + return total; + } + + [ JsonRpcMethod("sleep", Idempotent = true) ] + [ JsonRpcHelp("Blocks the request for the specified number of milliseconds (maximum 7 seconds).") ] + public void Sleep(int milliseconds) + { + System.Threading.Thread.Sleep(Math.Min(7000, milliseconds)); + } + + [ JsonRpcMethod("throwError", Idempotent = true)] + [ JsonRpcHelp("Throws an error if you try to call this method.") ] + public void ThrowError() + { + throw new ApplicationException(); + } + + [ JsonRpcMethod("format", Idempotent = true)] + [ JsonRpcHelp("Formats placeholders in a format specification with supplied replacements. This method demonstrates fixed and variable arguments.") ] + public string Format(string format, params object[] args) + { + return string.Format(format, args); + } + + [ JsonRpcMethod("counter", Idempotent = true)] + [ JsonRpcHelp("Increments a counter and returns its new value. Demonstrates use of session state.") ] + public int SessionCounter() + { + int counter = 0; + object counterObject = Session["Counter"]; + if (counterObject != null) + counter = (int) counterObject; + Session["Counter"] = ++counter; + return counter; + } + + [ JsonRpcMethod("encode", Idempotent = true)] + [ JsonRpcHelp("Returns the bytes of a string in a given encoding that are transmitted as a Base64 string.") ] + public byte[] EncodeBytes(string s, string encoding) + { + return System.Text.Encoding.GetEncoding(encoding).GetBytes(s); + } + + [JsonRpcMethod("decode", Idempotent = true)] + [JsonRpcHelp("Returns the string from encoded bytes (transmitted as a Base64 string).")] + public string DecodeString(byte[] bytes, string encoding) + { + return System.Text.Encoding.GetEncoding(encoding).GetString(bytes); + } + + // + // NOTE: To send and receive typed objects, use public types only + // that have a default constructor. Only public read/write fields + // and properties are convert to and from JSON. + // + + public class Marriage + { + public Person Husband; + public Person Wife; + + public Marriage() { } + + public Marriage(Person husband, Person wife) + { + Husband = husband; + Wife = wife; + } + } + + public class Person + { + public string FirstName; + public string LastName; + + public Person() { } + + public Person(string fn, string ln) + { + FirstName = fn; + LastName = ln; + } + } + } +} Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/DemoDojo.html URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/DemoDojo.html?view=auto&rev=489687 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/DemoDojo.html (added) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/DemoDojo.html Fri Dec 22 08:47:39 2006 @@ -0,0 +1,54 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> + <head> + <title>DojoJayrocksDemo</title> + <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> + <meta name=ProgId content=VisualStudio.HTML> + <meta name=Originator content="Microsoft Visual Studio .NET 7.1"> + <script language="javascript" src="Demo.ashx?proxy&v=2"></script> + <script language="javascript" src="js/dojo/dojo.js"></script> + <script language="javascript"> + dojo.require("dojo.io.*"); + dojo.require("dojo.event.*"); + dojo.require("dojo.html.*"); + dojo.require("dojo.json"); + + function dojoChannel(call) + { + var bindArgs = { + url: call.url+'?rpc', + error: function(type, data, evt){alert("error");}, + method: "POST", + mimetype: "text/json", + handle: call.callback, + postContent: dojo.json.serialize(call.request) + }; + var req = dojo.io.bind(bindArgs); + dojo.event + return req; + } + + function handleResponse(type, data, evt) + { + var arr = data.result; + var theDiv = dojo.byId('theDiv'); + var select = document.createElement('select'); + for(var i=0; i < arr.length; i++) + { + select.options[i] = new Option(arr[i], arr[i]); + } + theDiv.appendChild(select); + } + + function getArray() + { + DemoService.rpc.getStringArray(handleResponse).call(dojoChannel); + } + + dojo.event.connect(window, "onload", getArray); + </script> + </head> + <body> + <div id="theDiv"></div> + </body> +</html> \ No newline at end of file Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/HelloWorld.ashx URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/HelloWorld.ashx?view=auto&rev=489687 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/HelloWorld.ashx (added) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/HelloWorld.ashx Fri Dec 22 08:47:39 2006 @@ -0,0 +1,16 @@ +<%@ WebHandler Class="JayrockWeb.HelloWorld" Language="C#" %> + +namespace JayrockWeb +{ + using Jayrock.JsonRpc; + using Jayrock.JsonRpc.Web; + + public class HelloWorld : JsonRpcHandler + { + [ JsonRpcMethod("greetings") ] + public string Greetings() + { + return "Welcome to Jayrock!"; + } + } +} \ No newline at end of file Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/HelloWorld.html URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/HelloWorld.html?view=auto&rev=489687 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/HelloWorld.html (added) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/HelloWorld.html Fri Dec 22 08:47:39 2006 @@ -0,0 +1,27 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> +<head> + <title>Hello Jayrock</title> + <script type="text/javascript" src="js/json.js"></script> + <script type="text/javascript" src="helloworld.ashx?proxy"></script> + <script type="text/javascript"> +/* <![CDATA[ */ + +window.onload = function() +{ + var s = new HelloWorld(); + + alert("sync:" + s.greetings()); + + s.greetings(function(response) { + alert("async:" + response.result) + }); +} + +/* ]]> */ + </script> +</head> +<body> + <p>This page tests the HelloWorld service with Jayrock.</p> +</body> Added: struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Web.Config URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Web.Config?view=auto&rev=489687 ============================================================================== --- struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Web.Config (added) +++ struts/sandbox/trunk/overdrive/PhoneBook2/projects/Web/Web.Config Fri Dec 22 08:47:39 2006 @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<!-- + Note: As an alternative to hand editing this file you can use the + web admin tool to configure settings for your application. Use + the Website->Asp.Net Configuration option in Visual Studio. + A full list of settings and comments can be found in + machine.config.comments usually located in + \Windows\Microsoft.Net\Framework\v2.x\Config +--> +<configuration> + <appSettings/> + <connectionStrings/> + <system.web> + <!-- + Set compilation debug="true" to insert debugging + symbols into the compiled page. Because this + affects performance, set this value to true only + during development. + --> + <compilation debug="true"/> + <!-- + The <authentication> section enables configuration + of the security authentication mode used by + ASP.NET to identify an incoming user. + --> + <authentication mode="Windows"/> + <!-- + The <customErrors> section enables configuration + of what to do if/when an unhandled error occurs + during the execution of a request. Specifically, + it enables developers to configure html error pages + to be displayed in place of a error stack trace. + + <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> + <error statusCode="403" redirect="NoAccess.htm" /> + <error statusCode="404" redirect="FileNotFound.htm" /> + </customErrors> + --> + </system.web> +</configuration>