问题标签 [apache-wink]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
rest - 如何在 REST 服务中定义自定义服务器端配置?
我正在使用 Apache Wink 编写 REST 服务。我的服务需要一些服务器端配置,例如定义一些系统属性等。其余服务的用户不需要知道这些并为这些提供任何价值。我想了解在 REST 服务中初始化此属性的理想/最佳方式是什么。我应该在 Resource 类的构造函数中进行此配置吗?还是别的地方?
谢谢。
rest - Websphere 转换 HTTP 标头
我对 websphere 上的 HTTP-Header 参数有疑问。我有一个 Apache Wink 客户端,我向服务器发送了一个 REST-POST。(Webspere 8.0.0.8 还有 Wink)
在这台服务器上,我有一个 GZIP 过滤器,它搜索内容编码参数“gzip”。我的问题是内容参数“Content-Encoding”在我的过滤器中有参数名“$WSZIP”和我的原始值“gzip”。
我找不到关于这个的东西。
PS。当我发送像“test”这样的参数时,参数不会改变。只有 Content-Encoding 在其中获得了另一个名称。
PS。在我使用 tomcat 和 glassfish 的测试项目上一切正常。
java - Websphere 应用程序服务器 Servlet 初始化错误
我们需要将在 Glassfish 上运行的应用程序迁移到 Websphere Application Server (WAS) 8.5.x 版本。
为了通过简单的设置查看一切是否正常,我创建了一个带有单个休息服务的示例项目。
我没有用自己的类扩展 javax.ws.rs.core.Application ,我只有一个带有路径注释的类。我在 web.xml 中定义了一个名为“javax.ws.rs.core.Application”的 servlet,以便扫描注释,并且可以从给定的 servlet url 映射访问服务。
当我尝试访问该服务时,我收到一条 404 消息。但真正的问题是标准 IBM Websphere 库附带的 Apache Wink。
在库源代码(类 DefaultLifecycleManager)中,有这样的部分:
isApplication (cls)方法应该返回 true,然后应该为其创建单例工厂。但是,它返回 false。该方法的主体如下:
我在那里放了一个断点并检查了值。cls 就是 javax.ws.rs.core.Application,就是第 77 行的同一个类。
这会导致 servlet 无法正确启动,并向映射到它的每个请求返回 404。
我不知道这个方法如何返回false,我需要你的帮助。
java - 为什么 UriInfo.getQueryParameters() 不解码“+”?
我知道我可以解决这个问题,但是与将参数拉出参数映射(应根据 javadoc 解码)相比,如果使用带注释的查询参数,行为会有所不同,这似乎很奇怪。这是一个错误,还是只是一个怪癖?
rest - error invoking RESTful webservice on WebSphere 8.5.5.2 server
I have deployed the RESTful application using Apache Wink packaged in EAR on WebSphere 8.5.5.2 ND. When the application starts it gives me the "Initialization successful" message:
But as soon as I hit the URL, server gives me below error:
Earlier I was deploying the same application on WebSphere 7 and it was working fine. I know that WebSphere 8.5 comes with Wink Jars so I removed those jars from EAR and then deployed it on the server. Also, I enabled verbose class loading on my server and found that class is loading when the server starts. Though, when I checked in Class Loader Viewer from console I couldn't found the class. Adding the jars to Shared Library also did not work for me. It would be great help if someone can point me to right direction to solve this error.
Edit
Following statement is giving error inside the handler:
java - Swagger UI Not Displaying Any Content On index.html Page
UPDATED with SOLUTION below!!!
//////////////////////////////////////////////////////////////
Thanks to the advice of Ron below I slightly modified my setup to use BeanConfig instead of SwaggerConfig and got this working. In order to do this I had to modify the servlet and also (and this is where I believe the missing piece was) add the BeanConfig entry into the spring application context file so that spring picks up the resources. I included the updates below with comments in my code showing the old and new/updated code. It's possible I could've continued with the SwaggerConfig (maybe I was just missing something in the spring application context file for that as well?) but the BeanConfig works so I'm going to leave it as is.
//////////////////////////////////////////////////////////////
I'm trying to get Swagger running with my local REST-based Java App and have made quite a bit of progress. However, I seem to be missing something easy when I'm trying to get the Swagger UI working.
Whenever I actually hit this address: http://localhost:9082/mbl/index.html I'm getting the little green swagger header at the top but a blank white body with no content underneath. Shouldn't I be seeing more than this in the body of the page?
My stack is this: Java 6 / Wink / Spring 3.1 / Jackson 2.5 / JAX-RS (JSR-311) and I'm using the following Swagger jars: swagger-annotations-1.3.10.jar / swagger-core_2.10-1.3.10.jar / swagger-jaxrs_2.10-1.3.10.jar.
Now I've managed to get some json displaying that looks like this when i hit http://localhost:9082/mbl/services/api-docs:
I can see that this is being generated from my SwaggerServlet.java which looks like this:
Also, I have the following in my spring application context xml file:
My web.xml looks like this:
Here's a snippet of my Resource class:
And, finally, the only important part of my index.html (that I can tell) looks like this:
I will gladly supply any more information as needed. Does anyone have any idea what I might be missing?
Thanks a lot!
java - 使用 apache wink 客户端上传 multipart/form-data 文件
当前不存在获取 JAX-RS 实体提供程序。当我尝试上传文件时出现异常。我如何注册任何错过的提供者?
使用 Apache Wink 客户端和媒体类型上传文件的最佳方法是 multipart/form-data。
线程“主”中的异常
org.apache.wink.client.ClientRuntimeException:java.lang.RuntimeException: java.lang.RuntimeException: 找不到类 org.apache.http.entity.mime.MultipartEntity 的 javax.ws.rs.ext.MessageBodyWriter 实现类型和多部分/表单数据媒体类型。验证所有实体提供者都已正确注册。如果当前不存在 JAX-RS 实体提供程序,请添加自定义 javax.ws.rs.ext.MessageBodyWriter 提供程序来处理类型和媒体类型。
rest - 使用注释扫描时为 JAX-RS 指定用户处理程序
使用注释扫描时如何为 JAX-RS 指定用户处理程序?
我正在关注此链接并创建了我的自定义处理程序。我已将我的 Application 子类注释为:
这样我就不必输入 web.xml 文件。我无法找到的是在哪里指定包含此条目的属性文件:
我正在使用具有jaxrs-1.1功能的Liberty Profile 8.5.5.2 。
java - Apache Wink JSONObject/JSONException 的替代方案
我被要求将代码库从 Websphere 7“升级”到 Websphere 8.5.5。
代码库中有对这些对象的引用:
代码库当前使用的是 Apache Wink 1.1.3,因此可以解析该导入语句。但是,IBM 的 Wink 实现似乎是基于 1.1.1(这是真的吗??),因此我不能再使用JSONObject
或JSONException
以上版本。我基本上被要求“降级”Apache Wink 版本,看起来如此。(不,我不能只在我的类路径中包含较新的 Wink jar。)
我的问题是......现在在 Apache Wink 1.1.3 中的 JSONObject/JSONException 的先前等效项是什么?我需要找到一些可以代替他们使用的东西。
谢谢!