Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3d53aff
implement mock response SendFile
antp Feb 28, 2011
2cee52f
implement missing mock request/response
antp Mar 1, 2011
66513b3
Merge remote branch 'upstream/master'
antp Mar 3, 2011
c8cf3a7
Merge remote branch 'upstream/master'
antp Mar 11, 2011
d344806
Pipe processing pre/post target
antp Mar 11, 2011
3066965
Basic 404 and 500 pages ala Rails for pipeline problems
antp Mar 11, 2011
80e4edf
Fix MockResponse complete bug
antp Mar 13, 2011
3365768
Fix bug in MockRequest GetProperty
antp Mar 13, 2011
ee8f25d
Merge remote branch 'upstream/master'
antp Mar 15, 2011
7c03c16
Merge remote branch 'upstream/master'
antp Mar 18, 2011
db236dc
Added IManosModule interface
antp Mar 21, 2011
3a70cde
two phase initialisation for applications
antp Mar 22, 2011
5b21545
Added ManosBrowser to aid testing apps
antp Mar 22, 2011
d5139b2
Merge remote branch 'upstream/master'
antp Mar 22, 2011
9f7017f
Implemented remove cookie
antp Mar 22, 2011
46807a3
Merge remote branch 'upstream/master'
antp Mar 28, 2011
2b344e0
Merge remote branch 'upstream/master'
antp Mar 29, 2011
8c4a900
Added match type to module route setup
antp Mar 30, 2011
a8f0e1c
Removed debug statement
antp Mar 30, 2011
af28e08
Re-arange module route signatures
antp Mar 30, 2011
ecabae4
Refactor AddImplicitRoute method names
antp Mar 31, 2011
12f1c4f
Make case insensitive matching
antp Mar 31, 2011
4a709cf
Fix paramaterised url problem - needs MatchType.Simple
antp Apr 2, 2011
b0fddea
Removed superfluous namespace
antp Apr 2, 2011
726fafb
Change string comparison
antp Apr 3, 2011
7472b6b
Changed Ignore attribute to IgnoreHandler to stop collision with othe…
antp Apr 4, 2011
f0160c4
Allow verb attributes with default ctor
antp Apr 4, 2011
8e01368
Fix start index for string - sub mounting modules
antp Apr 7, 2011
3a84bb7
Fix paramaterised route - sub mounting modules
antp Apr 7, 2011
34a9d77
allow sub module to to route parent path '/path' to '/' sub module ha…
antp Apr 7, 2011
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/Manos/Manos.Routing/SimpleMatchOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,8 @@ public bool IsMatch (string input, int start, out DataDictionary data, out int e
// scan until start
int g_start = start + g.Start;

if (g_start > pattern.Length)
return false;

int len = g_start - pattern_pos;
for (int i = 0; i < len; i++) {
for (int i = start; i < len; i++) {
if (input [input_pos] != pattern [pattern_pos])
return false;

Expand Down
27 changes: 16 additions & 11 deletions src/Manos/Manos.Routing/StringMatchOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,26 @@ public string String {
throw new ArgumentNullException ("value");
if (value.Length == 0)
throw new ArgumentException ("StringMatch operations should not use empty strings.");
str = value;
str = value.ToLower();
}
}

public bool IsMatch (string input, int start, out DataDictionary data, out int end)
{
if (!StartsWith (input, start, String)) {
data = null;
end = start;
return false;

// some special processing - ugh
// route to '/' when the parent app has Route("/test", new SubModule)
// and sub module has [Get("/")]
if ("/" == String && (input.Length + 1 == str.Length + start)) {
data = null;
end = input.Length; // force acceptance
return true;
} else {
data = null;
end = start;
return false;
}
}

data = null;
Expand All @@ -68,13 +78,8 @@ public static bool StartsWith (string input, int start, string str)
{
if (input.Length < str.Length + start)
return false;

for (int i = 0; i < str.Length; i++) {
if (input [start + i] != str [i])
return false;
}

return true;

return String.Compare (input, start, str, 0, str.Length, StringComparison.OrdinalIgnoreCase) == 0;
}

}
Expand Down
12 changes: 12 additions & 0 deletions src/Manos/Manos.Testing/ManosBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,17 @@ public string ResponseString {
public string RedirectedUrl {
get { return Response.RedirectedUrl; }
}

public string ContentType {
get {
string value;

if(Response.Headers.TryGetValue("Content-Type", out value)) {
return value;
}

return string.Empty;
}
}
}
}
9 changes: 7 additions & 2 deletions src/Manos/Manos/DeleteAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ namespace Manos {
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public class DeleteAttribute : HttpMethodAttribute {

public DeleteAttribute (params string [] patterns) : base (patterns)
public DeleteAttribute ()
{
Methods = new HttpMethod [] { HttpMethod.HTTP_DELETE };
Methods = new HttpMethod[] { HttpMethod.HTTP_DELETE };
}

public DeleteAttribute (params string[] patterns) : base(patterns)
{
Methods = new HttpMethod[] { HttpMethod.HTTP_DELETE };
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Manos/Manos/GetAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class GetAttribute : HttpMethodAttribute {
/// </summary>
public GetAttribute ()
{
Methods = new HttpMethod[] { HttpMethod.HTTP_GET };
}

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/Manos/Manos/HeadAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class HeadAttribute : HttpMethodAttribute {
/// </summary>
public HeadAttribute ()
{
Methods = new HttpMethod[] { HttpMethod.HTTP_HEAD };
}

/// <summary>
Expand Down
4 changes: 3 additions & 1 deletion src/Manos/Manos/HttpMethodAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ public abstract class HttpMethodAttribute : Attribute {

public HttpMethodAttribute ()
{
MatchType = MatchType.String;
}

public HttpMethodAttribute (string [] patterns)
public HttpMethodAttribute (string[] patterns)
{
Patterns = patterns;
MatchType = MatchType.String;
}

public string Name {
Expand Down
8 changes: 8 additions & 0 deletions src/Manos/Manos/IManosModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,41 +40,49 @@ public interface IManosModule

RouteHandler Route (string pattern, IManosModule module);
RouteHandler Route (string pattern, ManosAction action);
RouteHandler Route (string pattern, Manos.Routing.MatchType matchType, ManosAction action);
RouteHandler Route (ManosAction action, params string [] patterns);
RouteHandler Route (IManosModule module, params string [] patterns);

RouteHandler Get (string pattern, IManosModule module);
RouteHandler Get (string pattern, ManosAction action);
RouteHandler Get (string pattern, Manos.Routing.MatchType matchType, ManosAction action);
RouteHandler Get (ManosAction action, params string [] patterns);
RouteHandler Get (IManosModule module, params string [] patterns);

RouteHandler Put (string pattern, IManosModule module);
RouteHandler Put (string pattern, ManosAction action);
RouteHandler Put (string pattern, Manos.Routing.MatchType matchType, ManosAction action);
RouteHandler Put (ManosAction action, params string [] patterns);
RouteHandler Put (IManosModule module, params string [] patterns);

RouteHandler Post (string pattern, IManosModule module);
RouteHandler Post (string pattern, ManosAction action);
RouteHandler Post (string pattern, Manos.Routing.MatchType matchType, ManosAction action);
RouteHandler Post (ManosAction action, params string [] patterns);
RouteHandler Post (IManosModule module, params string [] patterns);

RouteHandler Delete (string pattern, IManosModule module);
RouteHandler Delete (string pattern, ManosAction action);
RouteHandler Delete (string pattern, Manos.Routing.MatchType matchType, ManosAction action);
RouteHandler Delete (ManosAction action, params string [] patterns);
RouteHandler Delete (IManosModule module, params string [] patterns);

RouteHandler Head (string pattern, IManosModule module);
RouteHandler Head (string pattern, ManosAction action);
RouteHandler Head (string pattern, Manos.Routing.MatchType matchType, ManosAction action);
RouteHandler Head (ManosAction action, params string [] patterns);
RouteHandler Head (IManosModule module, params string [] patterns);

RouteHandler Options (string pattern, IManosModule module);
RouteHandler Options (string pattern, ManosAction action);
RouteHandler Options (string pattern, Manos.Routing.MatchType matchType, ManosAction action);
RouteHandler Options (ManosAction action, params string [] patterns);
RouteHandler Options (IManosModule module, params string [] patterns);

RouteHandler Trace (string pattern, IManosModule module);
RouteHandler Trace (string pattern, ManosAction action);
RouteHandler Trace (string pattern, Manos.Routing.MatchType matchType, ManosAction action);
RouteHandler Trace (ManosAction action, params string [] patterns);
RouteHandler Trace (IManosModule module, params string [] patterns);

Expand Down
2 changes: 1 addition & 1 deletion src/Manos/Manos/IgnoreAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace Manos {
/// Indicates that the decorated method should not be used to respond to requests (even if a route would otherwise select it.)
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public class IgnoreAttribute : Attribute {
public class IgnoreHandlerAttribute : Attribute {


}
Expand Down
Loading