我们有一个使用URL托管的Web应用程序http://example.com
.现在我们想要扩展这个应用程序的一部分作为一个宁静的服务,我们正在讨论最好的URL模式.我搜索过,但找不到任何具体的指导.
我们应该有URL模式http://api.example.com
还是http://example.com/api/v1
?
对此有任何标准指导吗?
我们在Spring 3.0中使用RestTemplate与xml配置,它工作得非常好.
<bean id="httpClient" class="org.apache.commons.httpclient.HttpClient">
<!-- <constructor-arg ref="httpClientParams"/> -->
</bean>
<bean id="httpClientFactory" class="org.springframework.http.client.CommonsClientHttpRequestFactory">
<constructor-arg ref="httpClient"/>
</bean>
<bean id="restTemplate" name="restTemplate" class="org.springframework.web.client.RestTemplate" autowire-candidate="true">
<constructor-arg ref="httpClientFactory" />
<property name="messageConverters">
<list>
<bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
</bean>
<bean class="org.springframework.http.converter.FormHttpMessageConverter"/>
<bean class="org.springframework.http.converter.StringHttpMessageConverter" />
</list>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
但是,当我们尝试迁移到Spring 3.1时,不推荐使用CommonsClientHttpRequestFactory类,并且不再使用公共HttpClient.
我试图使用HttpComponentsClientHttpRequestFactory类和Apache HttpClient设置类似的配置,但没有得到如何设置凭据提供程序.
我们希望httpclient具有基本身份验证.有没有人这样做或任何指针将是很大的帮助.提前致谢.
java spring restful-authentication resttemplate apache-httpclient-4.x
我想根据从客户端传递的String参数注入一个bean.
public interface Report {
generateFile();
}
public class ExcelReport extends Report {
//implementation for generateFile
}
public class CSVReport extends Report {
//implementation for generateFile
}
class MyController{
Report report;
public HttpResponse getReport() {
}
}
Run Code Online (Sandbox Code Playgroud)
我希望根据传递的参数注入报表实例.任何帮助都会有很大的吸引力.提前致谢
我们有一个包含2个JBOSS节点的集群.我们有一个批处理作业,它将所有用户详细信息从活动目录加载到数据库.这项工作每天都在运行.它之前在非集群环境中运行,因此我们将其设计为单例.现在我们有一个集群环境,我不知道什么是实现相同结果的最佳方法.我希望批处理作业每天只运行一次.我们使用spring和hibernate,然后看了Spring批处理.我无法对我的问题得到任何简明的答案.
如果你在集群环境中实现批处理,请问有谁可以告诉我吗?在这种情况下,最好的解决方案是什么?
我们正在使用Grails框架构建Restful服务,并使用Spring Security插件为其提供安全性.当您想要使用自定义授权标头进行身份验证时,我想与您联系,了解最佳方法.有关此方法的更多信息,请参阅此处 自定义HTTP授权标头
在我的例子中,客户端ID和密码存储在Ldap中,头部附带SHA1加密.使用Spring Security实现此目的的最佳方法是什么?
我也在Grails邮件列表中问了同样的问题.
任何见解都会有所帮助.谢谢.
〜ABHI
java ×4
spring ×2
api ×1
grails ×1
http-headers ×1
jboss ×1
rest ×1
restful-url ×1
resttemplate ×1
sha1 ×1
spring-batch ×1