草庐IT

java - 如何正确构建 REST-API 端点

我对REST-API很陌生。我想要这样的东西POSThttp://localhost/posts/以下Controller处理/posts和另一个Controller处理程序/commentsPostsController.java@RestController@RequestMapping("/posts")publicclassPostsController{//something}CommentsController.java@RestController@RequestMapping("/comments")publicclassCommentsController{//dos

java - 在运行时更改 WebService 端点地址

我使用Netbeans从WSDLurl生成Web服务客户端代码。但我无法在运行时使用代码更改端点地址。请帮我解决这个问题! 最佳答案 有两种方式:1)将port转换为BindingProvider并指定BindingProvider.ENDPOINT_ADDRESS_PROPERTY属性MyServiceservice=newMyService();MyPortport=service....BindingProviderbindingProvider=(BindingProvider)port;bindingProvider.ge

java - Spring Boot 中的日志文件端点

我读了SpringBootActuatordocumentation并看到那里提到的logfile端点,它真的会派上用场。但是这个端点没有在我的应用程序中注册,我不知道如何让它可用。这里需要什么? 最佳答案 为了启用此功能,需要设置以下两个参数之一:logging.file.namelogging.file.pathLoggingconfiguration之后端点应该默认启用。 关于java-SpringBoot中的日志文件端点,我们在StackOverflow上找到一个类似的问题:

java - token 端点 : Handling Null Pointer Exception

我尝试通过curl执行此命令从我的oauth2服务器请求代码curl-XPOST-k-vuclientapp:123456http://localhost:8080/oauth/token-H"Accept:application/json"-d"grant_type=authorization_code&scope=read%20write&client_secret=123456&client_id=clientapp&code=appcode&redirect_uri=localhost:3000"响应是*Addinghandle:conn:0x608860*Addinghand

java - appengine 端点无法检索状态为 : 500 的 API 配置

我在eclipse中使用参数0.0.0.0运行appengine本地开发服务器当我尝试访问任何方法时,出现以下错误。如果我尝试访问apiexplorer,我会得到同样的错误http://localhost:8888/_ah/api/explorer注意:我刚刚将我的应用引擎服务器更新为java7。有谁知道如何解决这个问题?java.io.IOException:FailedtoretrieveAPIconfigswithstatus:500atcom.google.api.server.spi.tools.devserver.ApiServlet.getApiConfigSources

java - SOAP 1.2 消息在发送到仅 SOAP 1.1 端点时无效

从spring批处理应用程序调用spring-cxf-webservice时出现错误。此错误仅在从批处理调用时发生。从普通soapUI调用时它工作正常。一旦从批处理调用一些记录正在处理。一些记录发生错误。检查了批处理和web服务的SOAP版本及其相同。org.apache.cxf.binding.soap.SoapFault:ASOAP1.2messageisnotvalidwhensenttoaSOAP1.1onlyendpoint.atorg.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessa

java - Spring 将浏览器访问者与对端点的 API 调用区分开来

在我的Springboot应用程序中,我在/api/**有一堆端点。以下是我的App配置:@ConfigurationpublicclassAppConfigextendsWebMvcConfigurerAdapter{privateclassPushStateResourceResolverimplementsResourceResolver{privateResourceindex=newClassPathResource("/public/index.html");privateListhandledExtensions=Arrays.asList("html","js","js

java - 将文档流发送到 Jersey @POST 端点

我希望能够发送一堆文档到网络服务。这将节省Http请求/响应开销,并专注于文档本身。在python中你可以这样做:r=requests.post('https://stream.twitter.com/1/statuses/filter.json',data={'track':'requests'},auth=('username','password'),stream=True)forlineinr.iter_lines():ifline:#filteroutkeep-alivenewlinesprintjson.loads(line)我正在寻找某人将请求流式传输到Jerseyres

java - 如何使用 spring security 为特定端点添加 HTTP 基本身份验证?

我有一个带有SpringSecurity的SpringBoot应用程序。一个新的端点/health将被配置,因此它可以通过基本的HTTP身份验证访问。当前的HttpSecurity配置如下:@Overrideprotectedvoidconfigure(HttpSecurityhttp)throwsException{http.requestMatchers().antMatchers(HttpMethod.OPTIONS,"/**").and().csrf().disable().authorizeRequests().anyRequest().permitAll().and().s

java - 如何让两个不同的端点具有不同的命名空间和相同的 JAXB 类?

我用的是springsoapws.我有以下JAXB域类对应于复杂类型@XmlAccessorType(XmlAccessType.FIELD)@XmlType(name="",propOrder={"reference","reason"})@XmlRootElement(name="request-message")publicclassRequestMessageType{@XmlElement(name="reference",required=true)protectedStringreference;@XmlElement(name="reason")protectedStr