grizzly

How do I programmatically configure Jersey to use Jackson for JSON (de)serialization?

谁都会走 提交于 2019-12-11 03:38:53
问题 I'm using Jersey together with Grizzly to create a JSON web service. I initialize it as follows: final ResourceConfig rc = new PackagesResourceConfig("amplify.api.resources"); rc.getProperties().put(JSONConfiguration.FEATURE_POJO_MAPPING, true); return GrizzlyServerFactory.createHttpServer(BASE_URI, rc); I have no web.xml file. I noticed that Jersey was mapping single element lists to be "element" rather than "[element]" as I would expect. It seems that apparently this is because Jersey uses

NoSuchMethodError: com.sun.jersey.core.reflection.ReflectionHelper.getOsgiRegistryInstance()Lcom/sun/jersey/core/osgi/OsgiRegistry;

陌路散爱 提交于 2019-12-11 02:17:26
问题 It seems I have a dependency conflict that I'm unsure how to resolve. I'm attempting to implement Swagger into my application. I've included my pom as well as the stack trace. If I can include anything else to better describe the problem, please let me know. I'm unsure how to begin debugging this... Exception in thread "main" java.lang.NoSuchMethodError: com.sun.jersey.core.reflection.ReflectionHelper.getOsgiRegistryInstance()Lcom/sun/jersey/core/osgi/OsgiRegistry; at com.sun.jersey.spi

how to configure Grizzly Server's maxPostSize

夙愿已清 提交于 2019-12-11 00:25:38
问题 I am hitting an error on Grizzly Server : org.glassfish.grizzly.http.HttpCodecFilter handleRead FINE: Error parsing HTTP header java.lang.IllegalStateException: HTTP packet header is too large at org.glassfish.grizzly.http.HttpCodecFilter$HeaderParsingState.checkOverflow(HttpCodecFilter.java:1904) at org.glassfish.grizzly.http.HttpCodecFilter.decodeHttpPacketFromBytes(HttpCodecFilter.java:662) After a little debugging using the above message HTTP packet header is too large was the reason for

grizzly logs to stderr, annoying in eclipse

时间秒杀一切 提交于 2019-12-10 19:54:52
问题 When i run my junit jersey service tests using the grizzly framework in eclipse, the log is directed to stderr. As a result the console window grabs focus, and the log appears red. I can't figure out the proper configuration steps. From my reading it looks like i need to add the slf4j.jar to my pom.xml and add a logging properties file somewhere? But i'm unsure which slf4j jars to add (there are many) or where to place the logging properties file. Or, frankly, if this is the right approach in

GF4 incorrect timeout exception thrown in Servlet when multiple large responses are returned (requested)

房东的猫 提交于 2019-12-10 10:27:03
问题 The issue occurs when multiple requests (in this example, for images) are handled by GF. For some reason, the response outputstream blocks (for larger writes) and I get a timeout after a few seconds. I downloaded the latest (2/12/2013) promoted built from glassfish repo and replaced nucleus-grizzly-all.jar but I still get the same issue. Any ideas of what causes this issue and how I can resolve it? Thanks. Exception java.io.IOException: java.util.concurrent.TimeoutException at org.glassfish

Getting MessageBodyWriter not found for media type=application/json

馋奶兔 提交于 2019-12-10 10:03:21
问题 I've tried everything...can't figure out why I'm getting this exception. What's interesting is that in my IDE (Intellij) everything works without a hitch. Can't figure this out...giving up. Do any of you have any suggestions? dependencies { compile group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.10.27' compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.7' compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.2' compile group: 'ch.qos.logback', name:

Grizzly + Jersey Listening ONLY on Localhost

久未见 提交于 2019-12-08 18:46:52
问题 I'm using Jersey with an embedded version of Grizzly and I'd like to bind/listen on localhost ONLY. I'm creating the ThreadSelector using the GrizzlyWebContainerFactory with the create call: threadSelector = GrizzlyWebContainerFactory.create("http://127.0.0.1:8080/", initParams); This works, but I'm still able to hit the server from an external machine. How can I get it to bind to/listen on ONLY localhost? This is for configuration stuff, so I don't want anything off box to be able to connect

WebSockets, GlassFish, Grizzly — can't connect

天大地大妈咪最大 提交于 2019-12-08 14:37:35
I am trying to get started with WebSockets, and trying to write a simple application to send messages back and forth via a websoket. However, it looks like the socket that I am trying to create never gets connected. Why can that be? Below is the code of my WebSockets class. When .onConnect() is called, it logs: I am socket, I was connected. Am i connected? - false Update: in JavaScript, where I create the socket in question, the readyState is 1 , which means "socket open, communication is possble". import a.b.Misc; //writes logs. import com.sun.grizzly.websockets.BaseServerWebSocket; import

JAX-RS Jersey/Grizzly Define an interface resource

让人想犯罪 __ 提交于 2019-12-08 04:44:39
问题 Following the example here On deploying a sample resource using the Grizzly container. It uses a resource that is defined as a class, instead I would like to define an interface with the annotations and have the resource class implements that interface. The problem now is that Grizzly complains that it can't find the resource: com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes. On Main class, where "com.mycompany.pack" is

WebSockets, GlassFish, Grizzly — can't connect

不打扰是莪最后的温柔 提交于 2019-12-08 04:19:53
问题 I am trying to get started with WebSockets, and trying to write a simple application to send messages back and forth via a websoket. However, it looks like the socket that I am trying to create never gets connected. Why can that be? Below is the code of my WebSockets class. When .onConnect() is called, it logs: I am socket, I was connected. Am i connected? - false Update: in JavaScript, where I create the socket in question, the readyState is 1 , which means "socket open, communication is