在这里,我们将给大家分享关于如何configurationSVN的Web访问不同的写权限?的知识,让您更了解webdav访问nas的本质,同时也会涉及到如何更有效地@EnableWebMvc,WebM
在这里,我们将给大家分享关于如何configurationSVN的Web访问不同的写权限?的知识,让您更了解webdav访问nas的本质,同时也会涉及到如何更有效地@EnableWebMvc,WebMvcConfigurationSupport,WebMvcConfigurer和WebMvcConfigurationAdapter区别、c# – Azure类库访问GetConfigurationSettingValue与web.config、io.dropwizard.configuration.ConfigurationValidationException的实例源码、java – ContextConfiguration一起运行WebAppConfiguration注释的内容。
本文目录一览:- 如何configurationSVN的Web访问不同的写权限?(webdav访问nas)
- @EnableWebMvc,WebMvcConfigurationSupport,WebMvcConfigurer和WebMvcConfigurationAdapter区别
- c# – Azure类库访问GetConfigurationSettingValue与web.config
- io.dropwizard.configuration.ConfigurationValidationException的实例源码
- java – ContextConfiguration一起运行WebAppConfiguration注释
如何configurationSVN的Web访问不同的写权限?(webdav访问nas)
我正在尝试在Windows Server 2008下的Apache2上configurationSVN Web访问,以获得不同的写入权限。
我有下一个Apache2 conf:
<Location /svn> SVNParentPath "E:SVN" DAV svn SVNListParentPath on AuthType Basic AuthName "Subversion repositories" Require valid-user AuthUserFile svn-auth.txt AuthzSVNAccessFile svn-acl.txt </Location> <Location /svn/foobar> SVNParentPath "E:SVNfoobar" DAV svn SVNListParentPath on AuthType Basic AuthName "Subversion repositories" Require valid-user AuthUserFile svn-auth.txt AuthzSVNAccessFile svn-acl.txt </Location>
E:SVN是所有存储库的根目录 – 我想列出所有。 它包含E:SVNtest – 是一个项目存储库。
和E:SVNfoobar – 是一个包含E:SVNfoobarfoo和E:SVNfoobarbar – 项目存储库的子目录。
从XAMPP运行Apache服务时出错
PHP不parsing文件; 只是返回代码
如何将多个JavaScript文件的请求合并成一个http请求?
.htaccess,将404错误重写到其他域
如何在多个Linux系统上同时运行相同的脚本
文件svn-auth.txt包含由htpasswd.exe生成的许多用户密码
文件svn-acl.txt包含写入访问规则,但不起作用! 它只包含一个全局权限的事件:
[/] * = rw
在SVN的SVNPath和SVNParentPath之间有什么不同? 也许这是有道理的?
当然,如果我添加一个组或一个用户,它也不起作用:
[groups] full = abatishchev [/] * = r @full = rw abatishchev = rw
我得到403 Forbiden 。
我究竟做错了什么? TIA!
更新:我从error.log中find了一条logging:
The URI does not contain the name of a repository. [403,#190001]
这意味着什么?
HttpClient连接由peer重置:套接字写入错误
Apache – 将URL映射到静态内容的本地path
PHP的所有GET参数与mod_rewrite
Lucene的StopFilter中使用的停用词的默认列表是什么?
Apache上的Phlex http访问(Windows)
SVNPath用于一个存储库, SVNParentPath用于包含多个存储库的根目录。 所以你应该删除你在Apache配置文件中的第二个位置,因为如果你尝试访问http://<host>/svn/foobar它会与第一个位置冲突。
您应该为访问和身份验证文件设置绝对路径,确保Apache服务具有对父目录和所有存储库的读/写访问权限,并且可以读取这些访问和身份验证文件的访问权限,这在手动安装中经常被忽略。
例如:
<Location /svn> RedirectMatch ^(/svn)$ $1/ SVNParentPath E:SVN DAV svn SVNListParentPath on AuthType Basic AuthName "Subversion repositories" Require valid-user AuthUserFile C:SVNconfsvn-auth.txt AuthzSVNAccessFile C:SVNconfsvn-acl.txt </Location>
您将在使用Subversion的版本控制中找到所有必要的信息(这是最新版本的链接,尽管Apache配置设置最近没有更改)。
然后,您应该能够为组和用户指定全局或个人权限,以供您的存储库使用。 这个例子可以在这里找到,用你给的名字:
[groups] full = abatishchev,anotherguy main = abatishchev [/] * = r @full = rw abatishchev = rw [foobar:/] * = @main = rw full = r [otherproject:/] @main = rw full = r
在这个例子中,你已经在[/]设置了一般的规则,然后是foorbar (以及下面的所有内容)和其他项目的特定规则。 您甚至可以为存储库的单个目录指定特定的规则。
更改Apache配置
<Location /svn>
至
<Location /svn/>
解决目录列表中403错误的问题
这不是对你的问题的直接回答,从现在开始从头开始学习东西总是很棒的,但是当你在Windows机器上时,我想我会提到VisualSVN服务器 。 这是一个点击,非常好的配置封装到SVN的二进制文件,也提供了自己的网络访问。
总结
以上是小编为你收集整理的如何configurationSVN的Web访问不同的写权限?全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
@EnableWebMvc,WebMvcConfigurationSupport,WebMvcConfigurer和WebMvcConfigurationAdapter区别
@EnableWebMvc是什么
直接看源码,@EnableWebMvc实际上引入一个DelegatingWebMvcConfiguration。
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Documented
@Import({DelegatingWebMvcConfiguration.class})
public @interface EnableWebMvc {
}
DelegatingWebMvcConfiguration继承了WebMvcConfigurationSupport
@Configuration
public class DelegatingWebMvcConfiguration extends WebMvcConfigurationSupport {
...
所以@EnableWebMvc=继承DelegatingWebMvcConfiguration=继承WebMvcConfigurationSupport
@EnableWebMvc和@EnableAutoConfiguration的关系
@EnableAutoConfiguration是springboot项目的启动类注解@SpringBootApplication的子元素,主要功能为自动配置。
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan(
excludeFilters = {@Filter(
type = FilterType.CUSTOM,
classes = {TypeExcludeFilter.class}
), @Filter(
type = FilterType.CUSTOM,
classes = {AutoConfigurationExcludeFilter.class}
)}
)
public @interface SpringBootApplication {
...
}
@EnableAutoConfiguration实际是导入了EnableAutoConfigurationImportSelector和Registrar两个类
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@AutoConfigurationPackage
@Import({AutoConfigurationImportSelector.class})
public @interface EnableAutoConfiguration {
...
}
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@Import({Registrar.class})
public @interface AutoConfigurationPackage {
}
这两个类的具体原理有些复杂,不太清除,主要内容是通过SpringFactoriesLoader.loadFactoryNames()导入jar下面的配置文件META-INF/spring.factories
protected List<String> getCandidateConfigurations(AnnotationMetadata metadata, AnnotationAttributes attributes) {
List<String> configurations = SpringFactoriesLoader.loadFactoryNames(this.getSpringFactoriesLoaderFactoryClass(), this.getBeanClassLoader());
Assert.notEmpty(configurations, "No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct.");
return configurations;
}
配置文件中的内容如下
# Auto Configure
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration,\
...
org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration,\
org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration,\
org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration,\
...
其中有WebMvcAutoConfiguration,WebMvcAutoConfiguration源码如下
@Configuration
@ConditionalOnWebApplication(
type = Type.SERVLET
)
@ConditionalOnClass({Servlet.class, DispatcherServlet.class, WebMvcConfigurer.class})
@ConditionalOnMissingBean({WebMvcConfigurationSupport.class})
@AutoConfigureOrder(-2147483638)
@AutoConfigureAfter({DispatcherServletAutoConfiguration.class, ValidationAutoConfiguration.class})
public class WebMvcAutoConfiguration {
...
}
@ConditionalOnMissingBean({WebMvcConfigurationSupport.class})意思是如果存在它修饰的类的bean
,则不需要再创建这个bean。
由此可得出结论:
如果有配置文件继承了DelegatingWebMvcConfiguration,
或者WebMvcConfigurationSupport,或者配置文件有@EnableWebMvc,那么 @EnableAutoConfiguration 中的
WebMvcAutoConfiguration 将不会被自动配置,而是使用WebMvcConfigurationSupport的配置。
@EnableWebMvc,WebMvcConfigurationSupport,WebMvcConfigurer和WebMvcConfigurationAdapter使用
WebMvcConfigurationAdapter已经废弃,最好用implements WebMvcConfigurer代替
@Configuration
public class MyConfig implements WebMvcConfigurer {
}
如果使用继承,WebMvcConfigurationSupport,DelegatingWebMvcConfiguration,或者使用@EnableWebMvc,
需要注意会覆盖application.properties中关于WebMvcAutoConfiguration的设置,需要在自定义配置中实现,如
springboot2.0、spring5.0 拦截器配置WebMvcConfigurerAdapter过时使用WebMvcConfigurationSupport来代替 新坑
示例如下
Configuration
@EnableWebMvc
public class MyConfig implements WebMvcConfigurer {
}
@Configuration
public class MyConfig extends WebMvcConfigurationSupport {
}
@Configuration
public class MyConfig extends DelegatingWebMvcConfiguration {
}
上面代码中需要在类中实现关于WebMvcAutoConfiguration的配置,而不是在application.properties中。
总结
implements WebMvcConfigurer : 不会覆盖@EnableAutoConfiguration关于WebMvcAutoConfiguration的配置
@EnableWebMvc + implements WebMvcConfigurer : 会覆盖@EnableAutoConfiguration关于WebMvcAutoConfiguration的配置
extends WebMvcConfigurationSupport :会覆盖@EnableAutoConfiguration关于WebMvcAutoConfiguration的配置
extends DelegatingWebMvcConfiguration :会覆盖@EnableAutoConfiguration关于WebMvcAutoConfiguration的配置
c# – Azure类库访问GetConfigurationSettingValue与web.config
在ASP.NET站点中,设置位于web.config中:
<add key="SendEmails" value="true"/>
在Azure辅助角色中,它位于ServiceConfiguration.Cloud.cscfg中:
<Setting name="SendEmails" value="true"/>
我想要做的是让我的类库能够访问任一配置设置,具体取决于它运行的环境.
解决方法
if (RoleEnvironment.IsAvailable) return RoleEnvironment.GetConfigurationSettingValue("mySetting"); else return ConfigurationManager.AppSettings["mySetting"].ToString();
RoleEnvironment.IsAvailable将检测是否应检测您是否在Windows Azure结构中并返回true.它将要求您在ASP.NET项目中包含Microsoft.WindowsAzure.ServiceRuntime程序集/引用.
如果你想了解更多信息我做了a blog post on this topic.
io.dropwizard.configuration.ConfigurationValidationException的实例源码
@Override public T get() { final Configuration configuration = clazz.getAnnotation(Configuration.class); try { final File baseFile = new File(configuration.filename()); final T baseConfig = baseFile.exists() ? objectMapper.readValue(baseFile,clazz) : clazz.newInstance(); final JsonNode overrideNode = filename.isPresent() ? loadYamlField(filename.get(),configuration.consolidatedField()) : objectMapper.createObjectNode(); final T config = objectMapper.readerForUpdating(baseConfig).readValue(overrideNode); final Set<ConstraintViolation<T>> violations = validator.validate(config); if (!violations.isEmpty()) { throw new ConfigurationValidationException(filename.or(configuration.filename()),violations); } return config; } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public T get() { final Configuration configuration = clazz.getAnnotation(Configuration.class); try { final File baseFile = new File(configuration.filename()); final T baseConfig = baseFile.exists() ? objectMapper.readValue(baseFile,violations); } return config; } catch (Exception e) { throw Throwables.propagate(e); } }
public static DdlConfiguration parseDdlConfiguration(File file) throws IOException,ConfigurationException { // Similar to Dropwizard's ConfigurationFactory but ignores System property overrides. ObjectMapper mapper = CustomJsonObjectMapperFactory.build(new YAMLFactory()); mapper.configure(DeserializationFeature.FAIL_ON_UNKNowN_PROPERTIES,true); DdlConfiguration ddlConfiguration = mapper.readValue(file,DdlConfiguration.class); Set<ConstraintViolation<DdlConfiguration>> errors = _validator.validate(ddlConfiguration); if (!errors.isEmpty()) { throw new ConfigurationValidationException(file.toString(),errors); } return ddlConfiguration; }
@Test(expected = ConfigurationValidationException.class) public void testThatInvalidConfigurationFailsToBeBuilt() throws Exception { buildConfigurationFromString("dropwizard/invalid-conf.yml"); }
@Test(expected = ConfigurationValidationException.class) public void testThatConfigurationWithEmptyValueFailsToBeBuilt() throws Exception { buildConfigurationFromString("dropwizard/empty-conf.yml"); }
java – ContextConfiguration一起运行WebAppConfiguration注释
我有一个注释这些注释的类:
@ContextConfiguration(locations = { "classpath:pathToXml.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
你能解释一下我在课堂上添加这些注释后的功能吗?
WebApplicationContext主要更改资源的加载方式,即具有未指定资源前缀的资源将从src / main / webapp或value参数中的位置加载(否则它们在Spring上下文中不可用,因为通常不包含webapp文件夹到classpath)而不是classpath:
此外,您还可以测试使用其他WebApplicationContext功能的代码 – ServletContextAware bean,Session和Request bean范围等.
这意味着您将能够使用Spring MVC Test Framework
我们今天的关于如何configurationSVN的Web访问不同的写权限?和webdav访问nas的分享已经告一段落,感谢您的关注,如果您想了解更多关于@EnableWebMvc,WebMvcConfigurationSupport,WebMvcConfigurer和WebMvcConfigurationAdapter区别、c# – Azure类库访问GetConfigurationSettingValue与web.config、io.dropwizard.configuration.ConfigurationValidationException的实例源码、java – ContextConfiguration一起运行WebAppConfiguration注释的相关信息,请在本站查询。
本文标签: