grizzly

How to initialize Jersey with a a specific resource instance with specific MessgeBodyReaders/Writers??

I'm trying to start Jersey on a preconfigured port/url with a preconfigured resource instance. I can't quite figure out how to correctly do it. Here is a snippet of a code. Help me, please, fill in the blanks: @Component @PerRequest @Path("/svc") @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.AP...

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<String, String> initParams = new HashMap<String, String>(); initParams.put("com.sun.jersey.config.property.packages", "me.my.rest.package")...

How to Use Grizzly Embedded Server for Mule as Well as Jersey

I'm currently using JerseyTest w/ Grizzly embedded server to test some code. I do some very simple configuration to point it to the proper resources: Map<String, String> initParams = new HashMap<String, String>(); initParams.put("com.sun.jersey.config.property.packages", "com.sample.service"); ApplicationDescriptor appDescriptor = new A...

adding resource Grizzly server running

Hi, I have a problem. I wish to add resource dynamically to running grizzly server. my code is: public class Main { static public SelectorThread threadSelector; static public final String baseUri = "http://localhost:9998/"; public static void main(String[] args) throws IOException { final Map<String, String> initParams = ne...

Using JaaS with Jersey on Grizzly

I'm trying to find a simple, flexible way to add JaaS authentication to REST. I found a post that I think leads me in the right direction (See StevenC's answer). It sounds like the servlet container is responsible for security, not the Jersey code itself. I like this idea, but need a little guidance on implementation. Grizzly is my s...

Checking a local TCP port is not open in Java

Is there a simple way to make sure that a local port is not already open. Some TCP socket servers (eg Grizzly) don't seem to do this check by default. When this check is missing, the server appears to start and respond, but the client code is just connecting to an old server that wasn't shutdown. This can be very bad! Is there a simp...

Maximum URI length in Grizzly (GlassFish) and Tomcat

Is there a maximum length (not default value) for URIs in Tomcat and in Grizzly (GlassFish 3)? I want to create a RESTful API which should be able to receive big GET requests. ...

Setting Grizzly's keystore to use a jks in a jar

I'm trying to use com.sun.grizzly.SSLConfig.setKeyStoreFile() to set SSL for Grizzly. It only takes a String as input (not InputStream or File). I want to use a jks file that is within a JAR file. If I pass a string for a jar path (eg C:\dir\my.jar!\resources\my.jks), it fails. Other than just unzipping the file from the JAR, how can...

jersey restful + grizzly server + hibernate

I can bring jersey + grizzly server up. But some problem occur during "SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory;" error says "SEVERE: service exception: org.hibernate.HibernateException: /hibernate.cfg.xml not found .. anyone know how to make hibernate can access hibernate.cfg.xml location. ...

Enable Grizzly to perform JaaS simple HTTP AUTH

How can I make Grizzly HTTP server allow JaaS for simple HTTP AUTH? I can't see any code/sample out there: There's another post here in StackOverflow that directly assumes that jaaS is available in Grizzly, but doesn't explain how to add it. ...

Run webservice inside embedded grizzly webserver

HI all, I have written a web service which is running fine in java 6 embedded web server (com.sun.net.httpserver.HttpServer). I have now to switch to grizzly as the java server has a selection key bug, but I do not find any way how I can directly publish the webservice to grizzly. My code is now as following: final GrizzlyWebServer ws ...

Grizzly http server fails some request

Hi, I created a grizzly web server, to run my jersey application out of tomcat, to speed up tests. I'm a grizzly beginner, but looking through the net I put some code lines together, to make a grizzly web server up and running in less than a working day :) Unfortunately my class has some troubles on concurrent request, often one or mor...

unable to find com.sun.grizzly.tcp.http11.GrizzlyAdapter.setResourcesContextPath(String)

I trying to expose some groovy service with jersey and girzzly. but i got a wierd error when i'm launching my servlet container. Here is the snippet which lauch it: ServletAdapter adapter = new ServletAdapter(); Injector injector = Guice.createInjector(new GmediaModule()); GuiceContainer container = new GuiceContainer(injector); adapte...