grizzly

Grizzly Standalone Logging

一曲冷凌霜 提交于 2019-11-29 10:45:57
i have setup a standalone grizzly/jersey server using maven and referencing the following dependencies <dependency> <groupId>org.glassfish.grizzly</groupId> <artifactId>grizzly-http-server</artifactId> <version>2.3.10</version> </dependency> <dependency> <groupId>org.glassfish.jersey.containers</groupId> <artifactId>jersey-container-grizzly2-http</artifactId> <version>2.5.1</version> </dependency> <dependency> <groupId>org.glassfish.jersey.core</groupId> <artifactId>jersey-server</artifactId> <version>2.5.1</version> </dependency> I already implemented a client using the jersey client api to

How to get instance of javax.ws.rs.core.UriInfo

寵の児 提交于 2019-11-29 09:32:31
Is there any implementation of javax.ws.rs.core.UriInfo which I can use to create an instance quickly for testing. This interface is long, I just need to test something. I don't want to waste time on whole implementation of this interface. UPDATE: I want to write a unit test for a function similar to this: @GET @Path("/my_path") @Produces(MediaType.TEXT_XML) public String webserviceRequest(@Context UriInfo uriInfo); Paul Samsotha You simply inject it with the @Context annotation, as a field or method parameter. @Path("resource") public class Resource { @Context UriInfo uriInfo; public Response

GZIP encoding in Jersey 2 / Grizzly

一曲冷凌霜 提交于 2019-11-29 04:02:42
I can't activate gzip-encoding in my Jersey service. This is what I've tried: Started out with the jersey-quickstart-grizzly2 archetype from the Getting Started Guide . Added rc.register(org.glassfish.grizzly.http.GZipContentEncoding.class); (have also tried rc.register(org.glassfish.jersey.message.GZipEncoder.class); ) Started with mvn exec:java Tested with curl --compressed -v -o - http://localhost:8080/myapp/myresource The result is the following: > GET /myapp/myresource HTTP/1.1 > User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 zlib/1.2.3.4 ... > Host: localhost:8080 > Accept:

Websocket SSL handshake failure

爷,独闯天下 提交于 2019-11-28 13:36:00
I have spring-boot Tomcat server for secure websocket connections. The server accepts Android 4.4, iOS, Firefox, and Chrome clients without failure with an authority-signed certificate. Android 5.0, however, fails the SSL handshake. Caused by: javax.net.ssl.SSLHandshakeException: Handshake failed at com.android.org.conscrypt.OpenSSLEngineImpl.unwrap(OpenSSLEngineImpl.java:436) at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:1006) at org.glassfish.grizzly.ssl.SSLConnectionContext.unwrap(SSLConnectionContext.java:172) at org.glassfish.grizzly.ssl.SSLUtils.handshakeUnwrap(SSLUtils.java:263) at

How can I get the stack trace when 500 server error happens in Jersey?

半城伤御伤魂 提交于 2019-11-28 12:07:01
问题 When in jersey server I have server 500 error: In server response don´t have stack trace or some info. In Eclipse console don´t have exception stack trace I try to catch exception in server and print trace in console, but nothing happens How can I get the stack trace when 500 server error happens? 回答1: Most of the time, a generic ExceptionMapper will do the trick. @Provider public class DebugMapper implements ExceptionMapper<Throwable> { @Override public Response toResponse(Throwable t) { t

Can not deserialize instance of java.lang.String out of START_OBJECT token

拜拜、爱过 提交于 2019-11-28 07:55:09
I'm running into an issue where my deployable jar hits an exception that doesn't happen when I run this locally in IntelliJ. Exception: Receiving an event {id=2, socket=0c317829-69bf-43d6-b598-7c0c550635bb, type=getDashboard, data={workstationUuid=ddec1caa-a97f-4922-833f-632da07ffc11}, reply=true} Firing getDashboard event to Socket#0c317829-69bf-43d6-b598-7c0c550635bb Failed invoking AtmosphereFramework.doCometSupport() java.lang.IllegalArgumentException: Can not deserialize instance of java.lang.String out of START_OBJECT token at [Source: N/A; line: -1, column: -1] at org.codehaus.jackson

Grizzly Standalone Logging

北城以北 提交于 2019-11-28 03:58:50
问题 i have setup a standalone grizzly/jersey server using maven and referencing the following dependencies <dependency> <groupId>org.glassfish.grizzly</groupId> <artifactId>grizzly-http-server</artifactId> <version>2.3.10</version> </dependency> <dependency> <groupId>org.glassfish.jersey.containers</groupId> <artifactId>jersey-container-grizzly2-http</artifactId> <version>2.5.1</version> </dependency> <dependency> <groupId>org.glassfish.jersey.core</groupId> <artifactId>jersey-server</artifactId>

Tyrus websocket: IllegalStateException cannot set WriteListener for non-async request

Deadly 提交于 2019-11-28 02:17:52
I have a standard websocket endpoint based on Tyrus implementation which times to times triggers the java.lang.IllegalStateException: Cannot set WriteListener for non-async or non-upgrade request . We are running on Payara 4.1. My standard implementation @ServerEndpoint(value = "...", decoders=MessageDecoder.class, encoders=MessageEncoder.class) public class EndpointImpl extends AbstractEndpoint{ // onOpen, onClose, onMessage, onError methods } Where the abstract class is public abstract class AbstractEndpoint{ // irrelevant onOpen, onOpen handling method 117 protected void sendMessage(Session

GZIP encoding in Jersey 2 / Grizzly

浪子不回头ぞ 提交于 2019-11-27 18:00:45
问题 I can't activate gzip-encoding in my Jersey service. This is what I've tried: Started out with the jersey-quickstart-grizzly2 archetype from the Getting Started Guide. Added rc.register(org.glassfish.grizzly.http.GZipContentEncoding.class); (have also tried rc.register(org.glassfish.jersey.message.GZipEncoder.class); ) Started with mvn exec:java Tested with curl --compressed -v -o - http://localhost:8080/myapp/myresource The result is the following: > GET /myapp/myresource HTTP/1.1 > User

Swagger documentation with JAX-RS Jersey 2 and Grizzly

假如想象 提交于 2019-11-27 16:17:19
I have implementated a Rest web service (the function is not relevant) using JAX-RS. Now I want to generate its documentation using Swagger. I have followed these steps: 1) In build.gradle I get all the dependencies I need: compile 'org.glassfish.jersey.media:jersey-media-moxy:2.13' 2) I documentate my code with Swagger annotations 3) I hook up Swagger in my Application subclass: public class ApplicationConfig extends ResourceConfig { /** * Main constructor * @param addressBook a provided address book */ public ApplicationConfig(final AddressBook addressBook) { register(AddressBookService