Added VS2010 solution to Spring.Web.Extensions example.
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Spring.Web.Extensions.Example.2005", "src\Spring.Web.Extensions.Example.2005\", "{DE2A587C-01A4-49E2-A3CD-664B293A8A6F}"
|
||||
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Spring.Web.Extensions.Example.2008", "src\Spring.Web.Extensions.Example.2008\", "{DE2A587C-01A4-49E2-A3CD-664B293A8A6F}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
TargetFramework = "2.0"
|
||||
TargetFramework = "3.5"
|
||||
ProjectReferences = ""
|
||||
Debug.AspNetCompiler.VirtualPath = "/Spring.Web.Extensions.Example.2005"
|
||||
Debug.AspNetCompiler.PhysicalPath = "src\Spring.Web.Extensions.Example.2005\"
|
||||
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\Spring.Web.Extensions.Example.2005\"
|
||||
Debug.AspNetCompiler.VirtualPath = "/Spring.Web.Extensions.Example.2008"
|
||||
Debug.AspNetCompiler.PhysicalPath = "src\Spring.Web.Extensions.Example.2008\"
|
||||
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\Spring.Web.Extensions.Example.2008\"
|
||||
Debug.AspNetCompiler.Updateable = "true"
|
||||
Debug.AspNetCompiler.ForceOverwrite = "true"
|
||||
Debug.AspNetCompiler.FixedNames = "false"
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.VirtualPath = "/Spring.Web.Extensions.Example.2005"
|
||||
Release.AspNetCompiler.PhysicalPath = "src\Spring.Web.Extensions.Example.2005\"
|
||||
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\Spring.Web.Extensions.Example.2005\"
|
||||
Release.AspNetCompiler.VirtualPath = "/Spring.Web.Extensions.Example.2008"
|
||||
Release.AspNetCompiler.PhysicalPath = "src\Spring.Web.Extensions.Example.2008\"
|
||||
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\Spring.Web.Extensions.Example.2008\"
|
||||
Release.AspNetCompiler.Updateable = "true"
|
||||
Release.AspNetCompiler.ForceOverwrite = "true"
|
||||
Release.AspNetCompiler.FixedNames = "false"
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Spring.Web.Extensions.Example.2010", "src\Spring.Web.Extensions.Example.2010\", "{DE2A587C-01A4-49E2-A3CD-664B293A8A6F}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
|
||||
ProjectReferences = ""
|
||||
Debug.AspNetCompiler.VirtualPath = "/Spring.Web.Extensions.Example.2010"
|
||||
Debug.AspNetCompiler.PhysicalPath = "src\Spring.Web.Extensions.Example.2010\"
|
||||
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\Spring.Web.Extensions.Example.2010\"
|
||||
Debug.AspNetCompiler.Updateable = "true"
|
||||
Debug.AspNetCompiler.ForceOverwrite = "true"
|
||||
Debug.AspNetCompiler.FixedNames = "false"
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.VirtualPath = "/Spring.Web.Extensions.Example.2010"
|
||||
Release.AspNetCompiler.PhysicalPath = "src\Spring.Web.Extensions.Example.2010\"
|
||||
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\Spring.Web.Extensions.Example.2010\"
|
||||
Release.AspNetCompiler.Updateable = "true"
|
||||
Release.AspNetCompiler.ForceOverwrite = "true"
|
||||
Release.AspNetCompiler.FixedNames = "false"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
VWDPort = "3792"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|.NET = Debug|.NET
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
Release|.NET = Release|.NET
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|Mixed Platforms = Release|Mixed Platforms
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{DE2A587C-01A4-49E2-A3CD-664B293A8A6F}.Debug|.NET.ActiveCfg = Debug|.NET
|
||||
{DE2A587C-01A4-49E2-A3CD-664B293A8A6F}.Debug|.NET.Build.0 = Debug|.NET
|
||||
{DE2A587C-01A4-49E2-A3CD-664B293A8A6F}.Debug|Any CPU.ActiveCfg = Debug|.NET
|
||||
{DE2A587C-01A4-49E2-A3CD-664B293A8A6F}.Debug|Mixed Platforms.ActiveCfg = Debug|.NET
|
||||
{DE2A587C-01A4-49E2-A3CD-664B293A8A6F}.Debug|Mixed Platforms.Build.0 = Debug|.NET
|
||||
{DE2A587C-01A4-49E2-A3CD-664B293A8A6F}.Release|.NET.ActiveCfg = Debug|.NET
|
||||
{DE2A587C-01A4-49E2-A3CD-664B293A8A6F}.Release|.NET.Build.0 = Debug|.NET
|
||||
{DE2A587C-01A4-49E2-A3CD-664B293A8A6F}.Release|Any CPU.ActiveCfg = Debug|.NET
|
||||
{DE2A587C-01A4-49E2-A3CD-664B293A8A6F}.Release|Mixed Platforms.ActiveCfg = Debug|.NET
|
||||
{DE2A587C-01A4-49E2-A3CD-664B293A8A6F}.Release|Mixed Platforms.Build.0 = Debug|.NET
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -46,48 +46,4 @@
|
||||
<add name="SpringModule" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
|
||||
</httpModules>
|
||||
</system.web>
|
||||
<system.web.extensions>
|
||||
<scripting>
|
||||
<webServices>
|
||||
<!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
|
||||
<!--
|
||||
<jsonSerialization maxJsonLength="500">
|
||||
<converters>
|
||||
<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
|
||||
</converters>
|
||||
</jsonSerialization>
|
||||
-->
|
||||
<!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
|
||||
<!--
|
||||
<authenticationService enabled="true" requireSSL = "true|false"/>
|
||||
-->
|
||||
<!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
|
||||
and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
|
||||
writeAccessProperties attributes. -->
|
||||
<!--
|
||||
<profileService enabled="true"
|
||||
readAccessProperties="propertyname1,propertyname2"
|
||||
writeAccessProperties="propertyname1,propertyname2" />
|
||||
-->
|
||||
</webServices>
|
||||
<!--
|
||||
<scriptResourceHandler enableCompression="true" enableCaching="true" />
|
||||
-->
|
||||
</scripting>
|
||||
</system.web.extensions>
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
<modules>
|
||||
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add name="SpringModule" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
|
||||
</modules>
|
||||
<handlers>
|
||||
<remove name="WebServiceHandlerFactory-Integrated"/>
|
||||
<!--<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
|
||||
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>-->
|
||||
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="Spring.Web.Script.Services.ScriptHandlerFactory, Spring.Web.Extensions"/>
|
||||
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2006 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Default implementation of the <see cref="IContactService"/>
|
||||
/// service interface.
|
||||
/// </summary>
|
||||
/// <author>Bruno Baia</author>
|
||||
/// <version>$Id: ContactService.cs,v 1.1 2007/05/31 18:34:54 markpollack Exp $</version>
|
||||
public class ContactService : IContactService
|
||||
{
|
||||
private List<string> _emails;
|
||||
|
||||
/// <summary>
|
||||
/// List of emails addresses for all contacts.
|
||||
/// </summary>
|
||||
public List<string> Emails
|
||||
{
|
||||
get { return _emails; }
|
||||
set { _emails = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="ContactService"/> class.
|
||||
/// </summary>
|
||||
public ContactService()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an array of emails, with a maximum of <paramref name="count"/>
|
||||
/// values, that complete the given <paramref name="prefixText"/>.
|
||||
/// </summary>
|
||||
/// <param name="prefixText">Text entered by the user.</param>
|
||||
/// <param name="count">Maximum number of possible values.</param>
|
||||
/// <returns>The array of emails for completing the text.</returns>
|
||||
public string[] GetEmails(string prefixText, int count)
|
||||
{
|
||||
List<String> emails = new List<string>();
|
||||
int i = 0;
|
||||
foreach (string email in _emails)
|
||||
{
|
||||
if (email.ToLower().StartsWith(prefixText.ToLower()))
|
||||
{
|
||||
emails.Add(email);
|
||||
if (++i == count) break;
|
||||
}
|
||||
}
|
||||
|
||||
return emails.ToArray();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2006 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Service interface for contact management.
|
||||
/// </summary>
|
||||
/// <author>Bruno Baia</author>
|
||||
/// <version>$Id: IContactService.cs,v 1.1 2007/05/31 18:34:54 markpollack Exp $</version>
|
||||
public interface IContactService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns an array of emails, with a maximum of <paramref name="count"/>
|
||||
/// values, that complete the given <paramref name="prefixText"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This signature method is required
|
||||
/// to apply the auto-completion behavior.
|
||||
/// </remarks>
|
||||
/// <param name="prefixText">Text entered by the user.</param>
|
||||
/// <param name="count">Maximum number of possible values.</param>
|
||||
/// <returns>The array of emails for completing the text.</returns>
|
||||
string[] GetEmails(string prefixText, int count);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2006 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using AopAlliance.Intercept;
|
||||
using Spring.Util;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// A simple interception around advice that filters
|
||||
/// a string array matching a given pattern.
|
||||
/// </summary>
|
||||
/// <author>Bruno Baia</author>
|
||||
/// <version>$Id: StringArrayFilterAdvice.cs,v 1.1 2007/05/31 18:34:54 markpollack Exp $</version>
|
||||
public class StringArrayFilterAdvice : IMethodInterceptor
|
||||
{
|
||||
private string _pattern = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// A pattern to be used for filtering a string array.
|
||||
/// </summary>
|
||||
public string Pattern
|
||||
{
|
||||
get { return _pattern; }
|
||||
set { _pattern = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="StringArrayFilterAdvice"/> class.
|
||||
/// </summary>
|
||||
public StringArrayFilterAdvice()
|
||||
{
|
||||
}
|
||||
|
||||
#region IMethodInterceptor Members
|
||||
|
||||
public object Invoke(IMethodInvocation invocation)
|
||||
{
|
||||
if (invocation.Method.ReturnType != typeof(string[]))
|
||||
throw new NotSupportedException(
|
||||
"StringArrayFilterAdvice must be applied on methods " +
|
||||
"that return an array of string.");
|
||||
|
||||
string[] stringArray = (string[])invocation.Proceed();
|
||||
|
||||
if (_pattern.Length > 0)
|
||||
{
|
||||
List<string> strings = new List<string>();
|
||||
foreach (string item in stringArray)
|
||||
{
|
||||
if (PatternMatchUtils.SimpleMatch(_pattern, item))
|
||||
{
|
||||
strings.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return strings.ToArray();
|
||||
}
|
||||
|
||||
return stringArray;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
// JScript File
|
||||
|
||||
// This function calls the Contact Web service method
|
||||
// passing simple type parameters and the callback function
|
||||
function GetEmails(prefix, count)
|
||||
{
|
||||
ContactWebService.GetEmails(prefix, count, GetEmailsOnSucceeded);
|
||||
}
|
||||
|
||||
// This is the callback function invoked if the Web service succeeded.
|
||||
// It accepts the result object as a parameter.
|
||||
function GetEmailsOnSucceeded(result, eventArgs)
|
||||
{
|
||||
// Page element to display feedback.
|
||||
var ResultSpan = document.getElementById("ResultSpan");
|
||||
ResultSpan.innerHTML = '';
|
||||
var i = 0;
|
||||
for(email in result)
|
||||
{
|
||||
ResultSpan.innerHTML += (result[i] + '<br />');
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<%@ Page Language="C#" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title>ASP.NET AJAX 1.0 integration with Spring.NET</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<asp:ScriptManager runat="server" ID="scriptManager">
|
||||
<Scripts>
|
||||
<asp:ScriptReference Path="ContactWebServiceMethods.js" />
|
||||
</Scripts>
|
||||
<Services>
|
||||
<asp:ServiceReference Path="ContactWebService.asmx" />
|
||||
</Services>
|
||||
</asp:ScriptManager>
|
||||
<div>
|
||||
<p>
|
||||
Web Service available at this url : <a href="ContactWebService.asmx">ContactWebService.asmx</a>
|
||||
<br />
|
||||
<br />
|
||||
Client scripts generated at this url : <a href="ContactWebService.asmx/js">ContactWebService.asmx/js</a>
|
||||
& <a href="ContactWebService.asmx/jsdebug">ContactWebService.asmx/jsdebug</a>
|
||||
</p>
|
||||
<hr />
|
||||
<p>
|
||||
This sample demonstrates the use of client script with a web service created by
|
||||
Spring.NET's WebServiceExporter.
|
||||
</p>
|
||||
<p>
|
||||
Email :
|
||||
<input id="emailInput" name="emailInput" type="text" />
|
||||
<button onclick="GetEmails(emailInput.value, 10); return false;">
|
||||
Search</button>
|
||||
(Hint : type the letter 'b' or 'm')
|
||||
</p>
|
||||
<p>
|
||||
Results :
|
||||
<br />
|
||||
<span id="ResultSpan" />
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns="http://www.springframework.net">
|
||||
<description>Object definitions.</description>
|
||||
|
||||
<!-- Creates an advisor (advice + pointcut). -->
|
||||
<object id="StringArrayFilterAspect" type="Spring.Aop.Support.RegularExpressionMethodPointcutAdvisor, Spring.Aop">
|
||||
<property name="advice">
|
||||
<object type="StringArrayFilterAdvice">
|
||||
<property name="Pattern" value="*spring.net"/>
|
||||
</object>
|
||||
</property>
|
||||
<property name="patterns">
|
||||
<list>
|
||||
<value>GetEmails</value>
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<!-- Defines the contact service. -->
|
||||
<object id="ContactService" type="ContactService">
|
||||
<property name="Emails">
|
||||
<list element-type="string">
|
||||
<value>manuel@spring.pt</value>
|
||||
<value>bruno@spring.net</value>
|
||||
<value>marie@spring.net</value>
|
||||
<value>brice@spring.net</value>
|
||||
<value>bertrand@spring.net</value>
|
||||
<value>marcel@spring.net</value>
|
||||
<value>bernadette@spring.net</value>
|
||||
<value>bruno@spring.pt</value>
|
||||
<value>baptiste@spring.net</value>
|
||||
<value>brad@spring.net</value>
|
||||
<value>marc@spring.net</value>
|
||||
<value>barbie@spring.net</value>
|
||||
<value>bernie@spring.net</value>
|
||||
<value>betty@spring.net</value>
|
||||
<value>maria@spring.pt</value>
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<!-- Applies AOP on the contact service. -->
|
||||
<object id="ContactServiceWeaved" type="Spring.Aop.Framework.ProxyFactoryObject, Spring.Aop">
|
||||
<property name="target" ref="ContactService"/>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<value>StringArrayFilterAspect</value>
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<!-- Exports contact service (weaved or not) as a web service. -->
|
||||
<object id="ContactWebService" type="Spring.Web.Services.WebServiceExporter, Spring.Web">
|
||||
<!--<property name="TargetName" value="ContactService"/>-->
|
||||
<property name="TargetName" value="ContactServiceWeaved"/>
|
||||
<property name="Namespace" value="http://Spring.Examples.Atlas/ContactService"/>
|
||||
<property name="Description" value="Contact Web Services"/>
|
||||
<property name="TypeAttributes">
|
||||
<list>
|
||||
<object type="System.Web.Script.Services.ScriptServiceAttribute, System.Web.Extensions"/>
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="spring">
|
||||
<section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
|
||||
</sectionGroup>
|
||||
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
|
||||
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||
</sectionGroup>
|
||||
</sectionGroup>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<spring>
|
||||
<context>
|
||||
<resource uri="~/Spring.config"/>
|
||||
</context>
|
||||
</spring>
|
||||
<system.web>
|
||||
<pages>
|
||||
<controls>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</controls>
|
||||
</pages>
|
||||
<!--
|
||||
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">
|
||||
<assemblies>
|
||||
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</assemblies>
|
||||
</compilation>
|
||||
<httpHandlers>
|
||||
<remove verb="*" path="*.asmx"/>
|
||||
<!--<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>-->
|
||||
<add verb="*" path="*.asmx" validate="false" type="Spring.Web.Script.Services.ScriptHandlerFactory, Spring.Web.Extensions"/>
|
||||
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
|
||||
</httpHandlers>
|
||||
<httpModules>
|
||||
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="SpringModule" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
|
||||
</httpModules>
|
||||
</system.web>
|
||||
</configuration>
|
||||
@@ -0,0 +1,77 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2006 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Default implementation of the <see cref="IContactService"/>
|
||||
/// service interface.
|
||||
/// </summary>
|
||||
/// <author>Bruno Baia</author>
|
||||
/// <version>$Id: ContactService.cs,v 1.1 2007/05/31 18:34:54 markpollack Exp $</version>
|
||||
public class ContactService : IContactService
|
||||
{
|
||||
private List<string> _emails;
|
||||
|
||||
/// <summary>
|
||||
/// List of emails addresses for all contacts.
|
||||
/// </summary>
|
||||
public List<string> Emails
|
||||
{
|
||||
get { return _emails; }
|
||||
set { _emails = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="ContactService"/> class.
|
||||
/// </summary>
|
||||
public ContactService()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an array of emails, with a maximum of <paramref name="count"/>
|
||||
/// values, that complete the given <paramref name="prefixText"/>.
|
||||
/// </summary>
|
||||
/// <param name="prefixText">Text entered by the user.</param>
|
||||
/// <param name="count">Maximum number of possible values.</param>
|
||||
/// <returns>The array of emails for completing the text.</returns>
|
||||
public string[] GetEmails(string prefixText, int count)
|
||||
{
|
||||
List<String> emails = new List<string>();
|
||||
int i = 0;
|
||||
foreach (string email in _emails)
|
||||
{
|
||||
if (email.ToLower().StartsWith(prefixText.ToLower()))
|
||||
{
|
||||
emails.Add(email);
|
||||
if (++i == count) break;
|
||||
}
|
||||
}
|
||||
|
||||
return emails.ToArray();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2006 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Service interface for contact management.
|
||||
/// </summary>
|
||||
/// <author>Bruno Baia</author>
|
||||
/// <version>$Id: IContactService.cs,v 1.1 2007/05/31 18:34:54 markpollack Exp $</version>
|
||||
public interface IContactService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns an array of emails, with a maximum of <paramref name="count"/>
|
||||
/// values, that complete the given <paramref name="prefixText"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This signature method is required
|
||||
/// to apply the auto-completion behavior.
|
||||
/// </remarks>
|
||||
/// <param name="prefixText">Text entered by the user.</param>
|
||||
/// <param name="count">Maximum number of possible values.</param>
|
||||
/// <returns>The array of emails for completing the text.</returns>
|
||||
string[] GetEmails(string prefixText, int count);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2006 the original author or authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using AopAlliance.Intercept;
|
||||
using Spring.Util;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// A simple interception around advice that filters
|
||||
/// a string array matching a given pattern.
|
||||
/// </summary>
|
||||
/// <author>Bruno Baia</author>
|
||||
/// <version>$Id: StringArrayFilterAdvice.cs,v 1.1 2007/05/31 18:34:54 markpollack Exp $</version>
|
||||
public class StringArrayFilterAdvice : IMethodInterceptor
|
||||
{
|
||||
private string _pattern = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// A pattern to be used for filtering a string array.
|
||||
/// </summary>
|
||||
public string Pattern
|
||||
{
|
||||
get { return _pattern; }
|
||||
set { _pattern = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="StringArrayFilterAdvice"/> class.
|
||||
/// </summary>
|
||||
public StringArrayFilterAdvice()
|
||||
{
|
||||
}
|
||||
|
||||
#region IMethodInterceptor Members
|
||||
|
||||
public object Invoke(IMethodInvocation invocation)
|
||||
{
|
||||
if (invocation.Method.ReturnType != typeof(string[]))
|
||||
throw new NotSupportedException(
|
||||
"StringArrayFilterAdvice must be applied on methods " +
|
||||
"that return an array of string.");
|
||||
|
||||
string[] stringArray = (string[])invocation.Proceed();
|
||||
|
||||
if (_pattern.Length > 0)
|
||||
{
|
||||
List<string> strings = new List<string>();
|
||||
foreach (string item in stringArray)
|
||||
{
|
||||
if (PatternMatchUtils.SimpleMatch(_pattern, item))
|
||||
{
|
||||
strings.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return strings.ToArray();
|
||||
}
|
||||
|
||||
return stringArray;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
// JScript File
|
||||
|
||||
// This function calls the Contact Web service method
|
||||
// passing simple type parameters and the callback function
|
||||
function GetEmails(prefix, count)
|
||||
{
|
||||
ContactWebService.GetEmails(prefix, count, GetEmailsOnSucceeded);
|
||||
}
|
||||
|
||||
// This is the callback function invoked if the Web service succeeded.
|
||||
// It accepts the result object as a parameter.
|
||||
function GetEmailsOnSucceeded(result, eventArgs)
|
||||
{
|
||||
// Page element to display feedback.
|
||||
var ResultSpan = document.getElementById("ResultSpan");
|
||||
ResultSpan.innerHTML = '';
|
||||
var i = 0;
|
||||
for(email in result)
|
||||
{
|
||||
ResultSpan.innerHTML += (result[i] + '<br />');
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<%@ Page Language="C#" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title>ASP.NET AJAX 1.0 integration with Spring.NET</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<asp:ScriptManager runat="server" ID="scriptManager">
|
||||
<Scripts>
|
||||
<asp:ScriptReference Path="ContactWebServiceMethods.js" />
|
||||
</Scripts>
|
||||
<Services>
|
||||
<asp:ServiceReference Path="ContactWebService.asmx" />
|
||||
</Services>
|
||||
</asp:ScriptManager>
|
||||
<div>
|
||||
<p>
|
||||
Web Service available at this url : <a href="ContactWebService.asmx">ContactWebService.asmx</a>
|
||||
<br />
|
||||
<br />
|
||||
Client scripts generated at this url : <a href="ContactWebService.asmx/js">ContactWebService.asmx/js</a>
|
||||
& <a href="ContactWebService.asmx/jsdebug">ContactWebService.asmx/jsdebug</a>
|
||||
</p>
|
||||
<hr />
|
||||
<p>
|
||||
This sample demonstrates the use of client script with a web service created by
|
||||
Spring.NET's WebServiceExporter.
|
||||
</p>
|
||||
<p>
|
||||
Email :
|
||||
<input id="emailInput" name="emailInput" type="text" />
|
||||
<button onclick="GetEmails(emailInput.value, 10); return false;">
|
||||
Search</button>
|
||||
(Hint : type the letter 'b' or 'm')
|
||||
</p>
|
||||
<p>
|
||||
Results :
|
||||
<br />
|
||||
<span id="ResultSpan" />
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns="http://www.springframework.net">
|
||||
<description>Object definitions.</description>
|
||||
|
||||
<!-- Creates an advisor (advice + pointcut). -->
|
||||
<object id="StringArrayFilterAspect" type="Spring.Aop.Support.RegularExpressionMethodPointcutAdvisor, Spring.Aop">
|
||||
<property name="advice">
|
||||
<object type="StringArrayFilterAdvice">
|
||||
<property name="Pattern" value="*spring.net"/>
|
||||
</object>
|
||||
</property>
|
||||
<property name="patterns">
|
||||
<list>
|
||||
<value>GetEmails</value>
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<!-- Defines the contact service. -->
|
||||
<object id="ContactService" type="ContactService">
|
||||
<property name="Emails">
|
||||
<list element-type="string">
|
||||
<value>manuel@spring.pt</value>
|
||||
<value>bruno@spring.net</value>
|
||||
<value>marie@spring.net</value>
|
||||
<value>brice@spring.net</value>
|
||||
<value>bertrand@spring.net</value>
|
||||
<value>marcel@spring.net</value>
|
||||
<value>bernadette@spring.net</value>
|
||||
<value>bruno@spring.pt</value>
|
||||
<value>baptiste@spring.net</value>
|
||||
<value>brad@spring.net</value>
|
||||
<value>marc@spring.net</value>
|
||||
<value>barbie@spring.net</value>
|
||||
<value>bernie@spring.net</value>
|
||||
<value>betty@spring.net</value>
|
||||
<value>maria@spring.pt</value>
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<!-- Applies AOP on the contact service. -->
|
||||
<object id="ContactServiceWeaved" type="Spring.Aop.Framework.ProxyFactoryObject, Spring.Aop">
|
||||
<property name="target" ref="ContactService"/>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<value>StringArrayFilterAspect</value>
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<!-- Exports contact service (weaved or not) as a web service. -->
|
||||
<object id="ContactWebService" type="Spring.Web.Services.WebServiceExporter, Spring.Web">
|
||||
<!--<property name="TargetName" value="ContactService"/>-->
|
||||
<property name="TargetName" value="ContactServiceWeaved"/>
|
||||
<property name="Namespace" value="http://Spring.Examples.Atlas/ContactService"/>
|
||||
<property name="Description" value="Contact Web Services"/>
|
||||
<property name="TypeAttributes">
|
||||
<list>
|
||||
<object type="System.Web.Script.Services.ScriptServiceAttribute, System.Web.Extensions"/>
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="spring">
|
||||
<section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<spring>
|
||||
<context>
|
||||
<resource uri="~/Spring.config"/>
|
||||
</context>
|
||||
</spring>
|
||||
<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" targetFramework="4.0">
|
||||
</compilation>
|
||||
<httpHandlers>
|
||||
<add verb="*" path="*.asmx" validate="false" type="Spring.Web.Script.Services.ScriptHandlerFactory, Spring.Web.Extensions"/>
|
||||
</httpHandlers>
|
||||
<httpModules>
|
||||
<add name="SpringModule" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
|
||||
</httpModules>
|
||||
</system.web>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user