jax-rs

Can multiple projects have the same context-root?

廉价感情. 提交于 2019-12-24 06:33:52
问题 I am going to build a many web services using weblogic and JAX-RS. To keep things simple I was going to place each service in its own project. But the problem I seem to be having is with setting the context-root for each project. Can multiple projects that are deployed on the save weblogic server have the same context-root? 回答1: of course not. how do you expect weblogic knows which web application you are calling? edit: however, it is possible to give one web application a context root of

Can multiple projects have the same context-root?

帅比萌擦擦* 提交于 2019-12-24 06:32:14
问题 I am going to build a many web services using weblogic and JAX-RS. To keep things simple I was going to place each service in its own project. But the problem I seem to be having is with setting the context-root for each project. Can multiple projects that are deployed on the save weblogic server have the same context-root? 回答1: of course not. how do you expect weblogic knows which web application you are calling? edit: however, it is possible to give one web application a context root of

Combining @Context and @RolesAllowed in a JAX-RS resource?

ぐ巨炮叔叔 提交于 2019-12-24 05:19:05
问题 Is it possible to use Context annotation and RolesAllowed annotation in a JAX-RS resource with Apache CXF 2.4.6 and Spring Security 3.2.8? My CXF configuration: <jaxrs:server address="/example"> <jaxrs:serviceBeans> <ref bean="myResourceImpl"/> </jaxrs:serviceBeans> </jaxrs:server> My Java source code: @Path("/myresource") public interface MyResource { @GET @Produces(MediaType.TEXT_XML) String get(); } @Named public class MyResourceImpl implements MyResource { @Context private SecurityContext

Issues in JAXRS Rest service using jersey

大城市里の小女人 提交于 2019-12-24 05:11:15
问题 Deployed a demo Rest Service on tomcat 7 using jersey JAXRS API . Developed a resource class @Path("/supportdata") public class SupportDataService { public SupportDataService() { // TODO Auto-generated constructor stub } @GET @Produces(MediaType.APPLICATION_XML) public String getSupportData(){ String xmlSupport=null; xmlSupport="<SupportData><Support><key>path1</key><value>value1</value></Support><Support><key>path2</key><value>value2</value></Support></SupportData>"; return xmlSupport; } }

Max file size with resteasy and multipart/form-data request

隐身守侯 提交于 2019-12-24 04:23:45
问题 How can I control the max file size and/or the max request size when using resteasy to handle a multipart/form-data request ? My code looks like this: @POST @Path("/somerestresource") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response handleForm(@MultipartForm MyForm form) { ... } With a Servlet I can control stuff with the @MultipartConfig annotation. So I'm thinking about bypassing resteasy and using @Context to inject a HttpServletRequest and having my servlet configured inside the

Why doesn't UriInfo.getQueryParameters() decode '+'?

怎甘沉沦 提交于 2019-12-24 04:06:13
问题 I know I can work around this, but it seems very strange that the behaviour is different if you use an annotated query parameter, compared with pulling the parameter out of the parameter map (which should be decoded according to the javadoc). Is this a bug, or just a quirk? @GET @Path("/") @Produces(MediaType.APPLICATION_JSON) public Response getAssets(@Context UriInfo info, @QueryParam("q") String searchQuery) { // The request URI is http://myhost.com/appRoot?q=foo+bar%20baz // At this point

How to serve already gzipped content in JAX-RS?

余生长醉 提交于 2019-12-24 03:38:06
问题 I'm developing a small JAX-RS application with Resteasy. I wanted the application to serve some static content for Javascript and CSS files, etc. and I would like to take advantage of the already gzipped version of the resources packaged in the jars of webjars.org. Thus, I need to handle the Accept-Encoding header and check if the .gz is there (or not). So far, what I have is: @Path("res/{path:.*}") @GET public Response webjars(@PathParam("path") String path, @HeaderParam("Accept-Encoding")

JAX-RS + RESTEasy service return JSON String without double quote

喜你入骨 提交于 2019-12-24 02:16:06
问题 I'm new to JAX-RS + RESTEasy What is impeding me is that the service return the JSON String without double quotes. @Path("/hello") public class HelloService { @GET @Path("say") @Produces(MediaType.APPLICATION_JSON) public String say() { return "Hello"; } } When I call "/hello/say" it just returns Hello but what I'm expecting is "Hello" Googled for several days. I have a piece of Javascript using JQuery which calls the service like this: $(function(){ $.ajax({ url : "services/hello/say",

How to close an entitymanager when used with Jackson and Jax-rs

五迷三道 提交于 2019-12-24 02:13:30
问题 I am using JPA (hibernate), JAX-RS (Jersey) and Jackson. How can I close my entity manager after my packet is built and sent? The following does not work and gives me an error. It appears to be calling em.close() before the response is completed. @GET @Produces(MediaType.APPLICATION_JSON) public Response getNode( @QueryParam("nodeId") long nodeId ){ try { Node node = em.find(Node.class, nodeId); if (node == null) throw new WebApplicationException(Response.Status.NOT_FOUND); Response response

How to manage state in JAX-RS?

送分小仙女□ 提交于 2019-12-24 01:46:54
问题 How do I configure JAX-RS 2 implementation (RESTEasy 3) to send the state of the application to the client? In JSF I am able to do it using the STATE_SAVING_METHOD parameter. Is there a standard way of doing it using JAX-RS? <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> Just an example to illustrate my problem, I would like to configure the JAX-RS provider to return the cart variable state to the client, in that way