jersey

How to consume a nested multipart/mixed mime type in jersey

会有一股神秘感。 提交于 2019-12-11 05:32:49
问题 I have googled for a long time, but no answer. I hope someone can help me. Say, I received a multipart/mixed package in jersey server side, its structure looks like this: multipart/mixed | |---Title: text/plain | |---Text content: text/plain | |---Image content: multipart/mixed | | | |--- Image name: text/plain | | | |--- Image body: image/jpeg | |......... The first two bodypart can be easily processed by using bodypart.getEntityAs(Class clazz) method. But for the nested multipart, i can

Using Jersey with Grizzly

≡放荡痞女 提交于 2019-12-11 05:31:47
问题 I want to create a simple REST service, and for that I am using Jersey and Grizzly. Here is my Service class: @Path("/service") class TestRESTService { @GET @Path("test") @Produces(Array(MediaType.APPLICATION_JSON)) public String test() { return "{ \"TestField\" : \"TestValue\" }"; } } And from what I understand here is how I supposed to start it: ResourceConfig config = new ResourceConfig(); config.registerClasses(TestRESTService.class); URI serverUri = UriBuilder.fromUri("http://localhost/"

Jersey 2.25.1 HTTP STATUS 500 Error when using MediaType.APPLICATION_XML

馋奶兔 提交于 2019-12-11 05:28:30
问题 Since 2 days I am stuck with this issue and it is not going away. A simple explanation what I want to do: 1) build a simple Restful web service using jersey 2.25.1 which displays XML as the output. 2) Deploy it on Tomcat Just for Info My JSON and plain text restful webservice is working fine. I am only getting errors for XML when using @RootElement. I am using java 1.8, Jersy 2.25.1, tomcat 8.5 I am getting the below error again and again and don't understand how to resolve it: I have tried

Can JCIFS be used with Jersey?

流过昼夜 提交于 2019-12-11 05:28:14
问题 I have trouble adding NTLM authentication to my existing application that uses Jersey and Apache HttpClient. I was only able to authenticate using JCIFS, the default NTLM authentication from HttpClient does not work (I get 401 ). The example from Apache HttpClient page shows how to use CloseableHttpClient: https://hc.apache.org/httpcomponents-client-4.5.x/ntlm.html Registry<AuthSchemeProvider> authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create() .register(AuthSchemes.NTLM, new

dropwizard and hive/hiverunner integration with maven

旧巷老猫 提交于 2019-12-11 05:04:32
问题 most of the dropwizard:0.9.2 maven dependencies use glassfish jersey 2 : org.glassfish.jersey.media:jersey-media-multipart:jar:2.22.1:compile org.apache.hive:hive-service:1.2.1 and com.klarna.hiverunner:3.1.0 both use com.sun.jersey 1 : com.sun.jersey:jersey-client:jar:1.9:runtime I keep getting the following error: java.lang.RuntimeException: javax.servlet.ServletException: io.dropwizard.jersey.setup.JerseyServletContainer-2acbc859@570b3305==io.dropwizard.jersey.setup.JerseyServletContainer

Redirect loop with CAS and Spring Security

ε祈祈猫儿з 提交于 2019-12-11 05:03:11
问题 I've set up a CAS 3.5.2 server on GlassFish 3.1.2.2 and now I am trying to protect a Jersey REST web service with CAS using Spring Security 3.2.0 by following the official documentation. My configuration: web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">

Actuator with Spring boot Jersey

旧时模样 提交于 2019-12-11 04:59:19
问题 I'm using Jersey starter in my web application. org.springframework.boot spring-boot-starter-jersey 1.4.2.RELEASE Trying to integrate the Actuator endpoints into my application.Used the following maven dependency org.springframework.boot spring-boot-starter-actuator 1.5.2.RELEASE org.springframework.boot spring-boot-starter-web 1.5.2.RELEASE When I access the health endpoint, it was giving me 404 error. http://localhost:8080/context/health Do I need to add any other configuration class to my

JAXB and Jersey - returning a list of objects extending an abstract class

不羁的心 提交于 2019-12-11 04:54:14
问题 I'm creating a REST service and I want to return a List of objects. So I got something like this: @GET @Produces(MediaType.APPLICATION_XML) @Path("items/") @XmlElementWrapper(name = "items") public List<AClass> getItems() { List<AClass> list = db.getItems(); return list; } where db.getItems() returns a list of objects that are a type of subclasses of AClass. AClass is an abstract class. Objects have more fields added. But these additional fields are not generated in an XML. How can I have

Best strategy to persist configuration variables of a JSP web aplication?

六月ゝ 毕业季﹏ 提交于 2019-12-11 04:49:57
问题 I'm implementing a web application using java (jsp). Now I'm adding some configuration buttons into the application, and i need to know which is the best strategy to persist them. For example, I need to add a switch which will tell if each 10 jobs with errors the main worker must be stopped. It is a boolean variable called "safeStop". For that i need to persist if that config value is activated. This persistent value must be there even if the server is reset so it is not enought to persist it

Jersey factory tries to create @Context variable twice

我的未来我决定 提交于 2019-12-11 04:49:52
问题 I have a problem with Jersey 2.26 and Spring Boot 2 . I added a factory to inject @Context variable into methods, but it does it twice, first before the method and then again after the method: @GET @Path("/user-entitlements") public Set<String> getUserEntitlements(@Context User user) { return service.getUserEntitlements(user); } I have a factory that creates those users: public class UserFactory implements Factory<User> { private final User user; @Inject public UserFactory(HttpServletRequest