Questions tagged [grizzly]
The Grizzly NIO and Web framework leverage Java™ NIO API capabilities. Grizzly's helps developers to build scalable and robust servers using NIO and we are also offering extended framework components: Web Framework (HTTP/S), Bayeux Protocol, Servlet, HttpService OSGi and Comet.
grizzly
484
questions
125
votes
9
answers
523k
views
Can not deserialize instance of java.lang.String out of START_OBJECT token
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-...
30
votes
3
answers
40k
views
How to find out incoming RESTful request's IP using JAX-RS on Heroku?
I'm writing a Java RESTful service hosted on Heroku based on an example -> https://api.heroku.com/myapps/template-java-jaxrs/clone
My sample service is:
package com.example.services;
import com....
23
votes
4
answers
15k
views
Which NIO library (Netty, Grizzly, kryonet, ...) for simple backend server implementation in Java?
Our frontend is simple Jetty (might be replaced with Tomcat later on) server. Through servlets, we are providing a public HTTP API (more or less RESTful) to expose our product functionality.
In the ...
19
votes
1
answer
19k
views
Set Query Parameters on a Jersey Test Call
I have a Jersey based Java servlet:
@Path("foo")
class Foo {
@GET
@Path("bar")
public Response bar(@QueryParam("key") String value) {
// ...
}
}
I can call it in Tomcat just fine as:
...
17
votes
4
answers
7k
views
jersey 2: How to create custom HTTP param binding
I am trying to create a custom http param binding for my restful service. Please see the example below.
@POST
@Path("/user/{userId}/orders")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType....
14
votes
4
answers
7k
views
grizzly http server should keep running
Below is the code to start Grizzly Http Server. If I press any key the server stops. Is there any way to keep it alive.
Jetty has join() method, which will not exit the main program. Is there ...
14
votes
1
answer
546
views
Tyrus WebSockets (Java) - how to set client local ip address
Is there a way to specify the local ip-address and port when using WebSockets (Tyrus)?
I'm looking for the same thing you can do with the full 4 parameters constructor of Socket
EDIT:
I have found ...
13
votes
3
answers
21k
views
How to enable CDI inject in web service (jaxrs/jersey) on java se running grizzly?
How do I allow CDI injection of resources into restful web service resources? I am running on standard java using weld 2 (cdi), jersey (jaxrs), and grizzly (web server). Here is my simple web ...
13
votes
3
answers
23k
views
How to get instance of javax.ws.rs.core.UriInfo
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 ...
12
votes
1
answer
7k
views
Grizzly Server with static content and REST resource
I have a Jersey REST 2.5.1 service which is served through a Grizzly server. Everything works fine so far. I want to add some static content, which is also served through Grizzly and provided from my ...
12
votes
2
answers
6k
views
Using filters with Grizzly server running a Jersey REST service
I'm trying to use Grizzly to create a server to run a REST service that I've developed using Jersey. I'm creating the Grizzly server using:
final String baseUri = "http://localhost:9998/";
final Map&...
12
votes
1
answer
3k
views
Configuring Grizzly with a web.xml
I can start grizzly and deploy Jersey webservices on it with the following lines.
protected HttpServer create() throws Throwable {
ResourceConfig rc = new PackagesResourceConfig("com.resource", "...
11
votes
4
answers
16k
views
GRIZZLY0023 Glassfish warning
I have deployed 2 web application in java on GlassFish server. I am using Glassfish Server 3.1.2.2. They both have java servlet pages from where they receive http requests, also the code is identical, ...
11
votes
4
answers
12k
views
Node.js vs Java for Comet application [closed]
We look to build a high-performance, scalable Comet server, and thought first about using Java Grizzly with GlassFish.
But after some research, we see that Node.JS is taking rapidly as the preferred ...
11
votes
5
answers
13k
views
SSL with Grizzly and Jersey
I'm trying to get grizzly to use SSL encryption and still work fine with Jersey. I've looked all over the Internet, and I find all kinds of different attempts at SSL with Grizzly and Jersey. Seems ...
11
votes
2
answers
3k
views
Java NIO2 AsynchronousSocketChannel/AsynchronousServerSocketChannel and TLS/SSL
All the sources/samples on the INTERNET that available on NIO2 are without TLS/SSL support,
java.nio.channels.AsynchronousSocketChannel
java.nio.channels.AsynchronousServerSocketChannel
As I ...
10
votes
4
answers
5k
views
Jersey throws NPE for each call after using ContainerRequestContext.abortWith()
I have a RESTful endpoint which I secured with a simple authorization check via a custom ContainerRequestFilter. The filter checks if all the information contained in the HTTP session is correct and ...
10
votes
3
answers
28k
views
java.lang.NoSuchMethodError: org.glassfish.jersey.server.ApplicationHandler.<init>
I've been trying to debug this issue for a bit now, and searching SO and other websites I haven't been able to find a solution. I've checked all versions of the dependencies in my pom.xml and made ...
10
votes
3
answers
10k
views
Grizzly Standalone Logging
i have setup a standalone grizzly/jersey server using maven and referencing the following dependencies
<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>...
10
votes
3
answers
14k
views
Basic HTTP authentication with Jersey / Grizzly
I've written a simple REST server using JAX-RS, Jersey and Grizzly. This is how I start the server:
URI baseUri = UriBuilder.fromUri("http://localhost/api")
.port(8081)
...
10
votes
3
answers
13k
views
jersey and jax-rs RI2 - missing HttpServerFactory
I have a simple project to test JAX-RS services. Yesterday I downloaded jersey-1.7.1 and used com.sun.jersey.api.container.httpserver.HttpServerFactory and com.sun.net.httpserver.HttpServer to create ...
10
votes
2
answers
7k
views
Jersey Client non-blocking
Spawning lots of threads is never a good idea (and when you create too many, you may run out of memory anyway).
Usually, Jersey needs to create one thread per request. And this seems to be the case, ...
9
votes
2
answers
4k
views
GZIP encoding in Jersey 2 / Grizzly
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....
9
votes
2
answers
7k
views
Grizzly + Jersey Listening ONLY on Localhost
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:
...
9
votes
2
answers
4k
views
jersey + grizzly + hk2: Dependency injection, but not into resource
Following up on Jersey + HK2 + Grizzly: Proper way to inject EntityManager?, I would like to understand how it is possible use dependency injection in classes which are not jersey resources.
As an ...
9
votes
3
answers
11k
views
Grizzly and Jersey standalone jar
I am trying to package Grizzly with Jersey as a single jar using Maven shade plugin. But I always get the message No container provider supports the type class org.glassfish.grizzly.http.server....
8
votes
2
answers
8k
views
Grizzly Jersey swallowing exceptions
I'm building a Jersey Moxy service using the quickstart archetype at the end. My code works fine and I can get some JSON returned. However as I'm developing, if I make a mistake, say the request ...
8
votes
4
answers
13k
views
Grizzly and ServletContainerContext
I'm trying to get hold of some injected context (for example Session or HttpServletRequest) in a Servlet I've written, running on Grizzly, but nothing I do seems to work. The whole process seems to ...
8
votes
1
answer
850
views
request-response synchronization/matching in nio context
I have a server client application (Java EE & Android), communication via websockets. Communication works and also the protocol itself for sending objects as json, which will be correctly wrapped, ...
7
votes
2
answers
15k
views
jersey 2.2: ContainerResponseFilter and ContainerRequestFilter never get executed
Following the getting started guide on the Jersey website:
I executed the following build command:
$ mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-grizzly2 \
-DarchetypeGroupId=org....
7
votes
1
answer
9k
views
Running code before and after all tests in a surefire execution
I have a Grizzly HttpServer that I want to run for the entire duration of a test group execution. Additionally, I want to interact with the global HttpServer instance from a @Rule inside the tests ...
7
votes
2
answers
4k
views
How to use jersey 2.0 guice on grizzly
I want to use Guice + Jersey 2.0 on Grizzly. According to this How to use guice-servlet with Jersey 2.0? discussion there is no direct Guice integration for Jersey2 at present but it can be achieved ...
7
votes
1
answer
5k
views
Serving static content with grizzly's StaticHttpHandler from within a .jar
I want Grizzly to serve static files from within a .jar, which contains a JAX-RS application, Grizzly and all other libs. I'm using org.glassfish.grizzly.http.server.StaticHttpHandler to serve the ...
7
votes
2
answers
1k
views
Grizzly pipe leak - what am i doing wrong?
I've written the following test code:
@Test
public void testLeakWithGrizzly() throws Throwable {
ExecutorService executor = Executors.newFixedThreadPool(N_THREADS);
Set<Future<Void>&...
7
votes
1
answer
3k
views
Jersey + HK2 + Grizzly: Proper way to inject EntityManager?
I've managed to set up injection (into resource classes) of my own service classes in Jersey, HK2 and a plain GrizzlyServer. (Basically followed this example.)
I'm now curious what the best is to ...
7
votes
3
answers
11k
views
Websocket SSL handshake failure
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, ...
7
votes
6
answers
13k
views
Grizzly - java.lang.NoSuchMethodError: javax.xml.ws.WebFault.messageName
I have a wsdl file for the Web service. I want to test the interaction between the client and the server. To do this, I run the mock server with embedded grizzly.
The question about of implementing ...
7
votes
1
answer
679
views
Is it possible to setup Grizzly for graceful shutdown?
I have a Jersey application running on embedded Grizzly, that is initialized like the following:
HttpServer httpServer = GrizzlyServerFactory.createHttpServer(BASE_URI, rc);
What i want to achieve ...
7
votes
3
answers
7k
views
Running Jersey on Grizzly on Linux and Windows
I come from a Windows .NET background, but am trying to expand my expertise, and so have picked up a few Java projects. Currently, I'm trying to create a REST API, and so I decided to go through the ...
7
votes
0
answers
130
views
Adding Filter to Grizzly FilterChain in Glassfish
Is it possible to add a filter to the Glassfish 4.1 (Payara) internal FilterChain instance? My intent is unified logging at the network level.
6
votes
2
answers
8k
views
How does Grizzly fit in with Glassfish?
I know Glassfish uses a component called Grizzly but I am unsure of to exactly what role Grizzly performs. I have read that it is a 'front-end' for Glassfish. Is this correct? What exactly does ...
6
votes
2
answers
6k
views
how do I enable POJO-mapping programatically in Jersey using Grizzly2?
Following the instructions here I have this code:
private static URI getBaseURI() {
return UriBuilder.fromUri("http://localhost/").port(9998).build();
}
public static final URI BASE_URI = ...
6
votes
3
answers
2k
views
can't get started with jersey user guide
Help me please. I tried for a long time to start rest app example, but I can't do this.
Using jersey user guide I'm get stuck with it.Here is example:
package com.example;
import javax.ws.rs.client....
6
votes
1
answer
3k
views
Difference between GrizzlyServerFactory.createHttpServer and new GrizzlyWebServer WebServer
I am creating RESTful web services using Jersey and an embedded Grizzly web server.
I see that there are two ways to create an embedded Grizzly web server. Can anyone tell me the difference between ...
6
votes
1
answer
4k
views
Glassfish 4 Grizzly Threads Heavy CPU usage
I have a Jersey application running on Glassfish 4 (4.1 build 13), JDK 1.7 update 67 and AWS Linux AMI and I'm noticing that after some hours running it, CPU usage goes up and stays up even though ...
6
votes
1
answer
2k
views
Combine Jersey with Tyrus
I have a Jersey JAX-RS application which runs on a Grizzly instance:
public class Application {
public static final String BASE_URI = "http://127.0.0.1:8080/rest";
public static void main(...
6
votes
0
answers
1k
views
How to Periodically Send a HTTP Status Code 102 Processing Response through Grizzly
I have a Java application which runs on top of Grizzly web server. I already call Response.suspend() and run the request in a background thread. This much works great. Here's some example code of ...
5
votes
2
answers
2k
views
Bean Validation 400 errors are returning default error page (html) instead of Response entity (json)
I have a JUnit testsuite: GrizzlyHttpServerFactory + Jersey + Bean Validation
(jersey-container-grizzly2-servlet/jersey-bean-validation ver 2.12, grizzly-http-server ver 2.3.16,
hibernate-validator ...
5
votes
1
answer
4k
views
Get client ip in Jersey 2.22.2
I am trying to access the clients IP that are calling my rest server but I only get null as a response. The web-server is running and I can access it from the web browser.
I have tried with
@...
5
votes
1
answer
2k
views
How to setup template base path for Jersey in Grizzly http server?
With Apache Jersey and Grizzly http server, how do I setup base template path ?
Since I'm not using Servlet container, I assign template base path with absolute file path. But Jersey response a 404.
...