File tree Expand file tree Collapse file tree 8 files changed +78
-8
lines changed
React.Sample.Mvc4/Content Expand file tree Collapse file tree 8 files changed +78
-8
lines changed Original file line number Diff line number Diff line change @@ -106,4 +106,4 @@ var Avatar = React.createClass({
106
106
getPhotoUrl : function ( author ) {
107
107
return 'http://graph.facebook.com/' + author . Facebook + '/picture' ;
108
108
}
109
- } ) ;
109
+ } ) ;
Original file line number Diff line number Diff line change @@ -37,9 +37,19 @@ public void Register(TinyIoCContainer container)
37
37
38
38
// Unique per request
39
39
container . Register < IFileSystem , AspNetFileSystem > ( ) . AsPerRequestSingleton ( ) ;
40
- container . Register < ICache , AspNetCache > ( ) . AsPerRequestSingleton ( ) ;
41
40
container . Register < IJsxHandler , JsxHandler > ( ) . AsPerRequestSingleton ( ) ;
42
41
42
+ // Mono for Mac OS does not properly handle caching
43
+ // TODO: Remove this once https://bugzilla.xamarin.com/show_bug.cgi?id=19071 is fixed
44
+ if ( SystemEnvironmentUtils . IsRunningOnMac ( ) )
45
+ {
46
+ container . Register < ICache , NullCache > ( ) . AsSingleton ( ) ;
47
+ }
48
+ else
49
+ {
50
+ container . Register < ICache , AspNetCache > ( ) . AsPerRequestSingleton ( ) ;
51
+ }
52
+
43
53
// Wrappers for built-in objects
44
54
container . Register < HttpContextBase > ( ( c , o ) => new HttpContextWrapper ( HttpContext . Current ) ) ;
45
55
container . Register < HttpServerUtilityBase > ( ( c , o ) => c . Resolve < HttpContextBase > ( ) . Server ) ;
Original file line number Diff line number Diff line change 1
1
<configuration>
2
2
<system.web>
3
- <!-- Uncomment if using IIS 7 Classic Mode or IIS 6 -->
3
+ <!-- Uncomment if using IIS 7 Classic Mode, IIS 6, or Mono -->
4
4
<!--
5
5
<httpHandlers>
6
6
<add verb="GET" path="*.jsx" type="React.Web.JsxHandlerFactory, React.Web" />
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ public void Execute()
51
51
var result = _environment . JsxTransformer . TransformJsxFile ( relativePath ) ;
52
52
53
53
// Only cache on the server-side for now
54
- _response . AddCacheDependency ( new CacheDependency ( _fileSystem . MapPath ( relativePath ) ) ) ;
54
+ _response . AddFileDependency ( _fileSystem . MapPath ( relativePath ) ) ;
55
55
_response . Cache . SetCacheability ( HttpCacheability . Server ) ;
56
56
_response . Cache . SetLastModifiedFromFileDependencies ( ) ;
57
57
_response . Cache . SetETagFromFileDependencies ( ) ;
Original file line number Diff line number Diff line change 7
7
* of patent rights can be found in the PATENTS file in the same directory.
8
8
*/
9
9
10
- using JavaScriptEngineSwitcher . Msie ;
11
- using JavaScriptEngineSwitcher . Msie . Configuration ;
12
10
using React . TinyIoC ;
13
11
14
12
namespace React
Original file line number Diff line number Diff line change 9
9
10
10
using System ;
11
11
using System . IO ;
12
- using System . Security . Cryptography ;
13
- using System . Text ;
14
12
using Newtonsoft . Json ;
15
13
using React . Exceptions ;
16
14
Original file line number Diff line number Diff line change 83
83
<Link >Properties\SharedAssemblyVersionInfo.cs</Link >
84
84
</Compile >
85
85
<Compile Include =" AssemblyRegistration.cs" />
86
+ <Compile Include =" SystemEnvironmentUtils.cs" />
86
87
<Compile Include =" Exceptions\JsxUnsupportedEngineException.cs" />
87
88
<Compile Include =" Exceptions\ReactConfigurationException.cs" />
88
89
<Compile Include =" Exceptions\ReactException.cs" />
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2014, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ */
9
+
10
+ using System ;
11
+ using System . Runtime . InteropServices ;
12
+
13
+ namespace React
14
+ {
15
+ /// <summary>
16
+ /// Utility functions for handling system environmental differences
17
+ /// </summary>
18
+ public class SystemEnvironmentUtils
19
+ {
20
+ [ DllImport ( "libc" ) ]
21
+ private static extern int uname ( IntPtr buf ) ;
22
+
23
+ /// <summary>
24
+ /// Determines whether the application is running on Mac OS.
25
+ /// Based off Mono's XplatUI.cs, licensed under LGPL.
26
+ /// </summary>
27
+ /// <returns><c>true</c> if running on Mac OS</returns>
28
+ public static bool IsRunningOnMac ( )
29
+ {
30
+ return _isRunningOnMac . Value ;
31
+ }
32
+
33
+ private readonly static Lazy < bool > _isRunningOnMac = new Lazy < bool > ( ( ) =>
34
+ {
35
+ if ( Environment . OSVersion . Platform != PlatformID . Unix )
36
+ {
37
+ return false ;
38
+ }
39
+
40
+ var buf = IntPtr . Zero ;
41
+ try
42
+ {
43
+ buf = Marshal . AllocHGlobal ( 8192 ) ;
44
+ if ( uname ( buf ) == 0 )
45
+ {
46
+ string os = Marshal . PtrToStringAnsi ( buf ) ;
47
+ if ( os == "Darwin" )
48
+ return true ;
49
+ }
50
+ }
51
+ catch
52
+ {
53
+ // YOLO
54
+ }
55
+ finally
56
+ {
57
+ if ( buf != IntPtr . Zero )
58
+ Marshal . FreeHGlobal ( buf ) ;
59
+ }
60
+ return false ;
61
+ } ) ;
62
+ }
63
+ }
You can’t perform that action at this time.
0 commit comments