grizzly

SSL with Grizzly and Jersey

安稳与你 提交于 2019-12-03 06:17:14
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 like there are different ways of doing it depending on which version you are using, and how you decided to implement it. I haven't been able to get any examples to work with my code yet. Here's how I start up my server: static HttpServer startSecureServer() throws IOException{ ResourceConfig rc=new PackagesResourceConfig("server.grizzlyresources"); SSLContextConfigurator sslCon=new

html server grizzly+jersey (.html from .jar archive)

偶尔善良 提交于 2019-12-03 04:02:58
I want to serve my .html sites from a .jar archive and not from a folder. At the moment i use grizzly (with jersey) and serve static pages like: HttpServer webServer; .... .... webServer.getServerConfiguration().addHttpHandler(new StaticHttpHandler("varwww"), "/app"); webServer.start(); Is there a way to get the webserver not to retrieve .html from folder "varwww" and to get it from myhtml.jar? This feature is implemented in Grizzly 2.3.3+. Here is the correspondent issue . You can use special CLStaticHttpHandler and pass ClassLoader to be used to find static resources. For example: httpServer

Node.js vs Java for Comet application [closed]

放肆的年华 提交于 2019-12-03 02:27:30
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago . 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 choice due to extreme simplicity, and claimed performance: http://news

How to find out incoming RESTful request's IP using JAX-RS on Heroku?

北慕城南 提交于 2019-12-03 01:08:08
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.example.models.Time; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("/time") @Produces(MediaType.APPLICATION_JSON) public class TimeService { @GET public Time get() { return new Time(); } } My main is: public class Main { public static final String BASE_URI = getBaseURI(); /** * @param args */ public static void main(String[] args)

Node.js vs Java for Comet application [closed]

旧巷老猫 提交于 2019-12-02 16:00:49
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 choice due to extreme simplicity, and claimed performance: http://news.ycombinator.com/item?id=1088699 http://amix.dk/blog/post/19484 I will be happy to hear some real-life experience of using both, and what ultimately can be the best choice down the road. Thanks! If you would further read the blog posts by the same author, namely the post, Is node.js best for Comet , he explains why he again went

DELETE Request with Payload or Form Data causes Bad Request

牧云@^-^@ 提交于 2019-12-01 22:53:15
I am building a RESTful Web Service with Java Jersey 2.17. The Client for it. I am developing with ExtJS 5. My classes on the service Main.java public class Main { public static final String BASE_URI = "http://localhost:8080/app/rest/"; public static HttpServer startServer() { final ResourceConfig rc = new ResourceConfig(); rc.packages(true, "app"); rc.register(ResponseCorsFilter.class); return GrizzlyHttpServerFactory.createHttpServer(URI.create(Main.BASE_URI), rc); } public static void main(final String[] args) throws IOException { final HttpServer server = Main.startServer(); System.out

How to inject Grizzly Request into Jersey ContainerRequestFilter

只愿长相守 提交于 2019-12-01 11:56:28
I have Jersey being provided by Grizzly. I have a ContainerRequestFilter implementation class. However this class is created once for all incoming requests. Therefore doing this: public class EndpointRequestFilter implements ContainerRequestFilter { @Context private org.glassfish.grizzly.http.server.Request requestContext; public void filter( ContainerRequestContext req ) throws IOException { // remove for sake of example } } The requestContext is null. I can inject the context into the actual endpoint being called, but that is rather crude and ugly and really no use to me; as i wish to log

Grizzly with TLS - Handshaking issue

旧街凉风 提交于 2019-12-01 10:52:08
I'm currently trying to secure my Grizzly HTTP-Server with SSL (which should be quite easy according to tutorials and examples) - server side only. So first I've downloaded the UnlimitedJCEPolicy from Orcale in order to be able to support strong TLS algorithms. Then I've created a new keystore file with the keytool and the following command: keytool -keyalg rsa -keysize 2048 -genkey -keystore .\keystore_server.jks -alias server -dname "..." Finally I set up my Server with the following Java code: //Create Http Server HttpServer server = new HttpServer(); //Configure and register listener

Grizzly with TLS - Handshaking issue

落爺英雄遲暮 提交于 2019-12-01 08:27:50
问题 I'm currently trying to secure my Grizzly HTTP-Server with SSL (which should be quite easy according to tutorials and examples) - server side only. So first I've downloaded the UnlimitedJCEPolicy from Orcale in order to be able to support strong TLS algorithms. Then I've created a new keystore file with the keytool and the following command: keytool -keyalg rsa -keysize 2048 -genkey -keystore .\keystore_server.jks -alias server -dname "..." Finally I set up my Server with the following Java

jersey + grizzly + hk2: Dependency injection, but not into resource

送分小仙女□ 提交于 2019-12-01 04:33:43
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 example, I might have background tasks running in an ExecutorService, and they might need an EntityManager. If I attempt to @Inject the EntityManager into the class, nothing happens. Injecting it into a @Path -annotated jersey resource class, injecting works fine. The application is running as a standalone JVM, not on a Java EE application server. Update: I have created a test scenario to