<< Back to previous view

[JERSEY-1526] Response#bufferEntity closes stream & readEntity throws exception : Entity input stream has already been closed. Created: 23/Oct/12  Updated: 29/Oct/12  Resolved: 29/Oct/12

Status: Closed
Project: jersey
Component/s: core
Affects Version/s: 2.0-m09
Fix Version/s: 2.0-m09

Type: Bug Priority: Blocker
Reporter: jan.supol Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags:
Participants: jan.supol and Pavel Bucek

 Description   

buffer entity closes stream:

Annotation[] annotations = AnnotatedClass.class.getAnnotations();

Client client = ClientFactory.newClient();
client.configuration().register(filter);
WebTarget target = client.target(responseurl);
Response response = target.request().buildGet().invoke();
response.bufferEntity(); //Closes the stream!!!!

and this:

response.readEntity(new GenericType<String>(String.class), annotations);

throws :

java.lang.IllegalStateException: Entity input stream has already been closed.
at org.glassfish.jersey.message.internal.InboundMessageContext$ContentStream.isEmpty(InboundMessageContext.java:170)
at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:854)
at org.glassfish.jersey.client.InboundJaxrsResponse.readEntity(InboundJaxrsResponse.java:114)
at org.glassfish.jersey.client.ScopedJaxrsResponse.access$301(ScopedJaxrsResponse.java:56)
at org.glassfish.jersey.client.ScopedJaxrsResponse$4.call(ScopedJaxrsResponse.java:107)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:395)
at org.glassfish.jersey.client.ScopedJaxrsResponse.readEntity(ScopedJaxrsResponse.java:104)



 Comments   
Comment by Pavel Bucek [ 28/Oct/12 12:08 PM ]

seems to be already fixed (most likely by other recent fixes related to bufferEntity and Response.close). Can you please try latest trunk version?

Comment by jan.supol [ 29/Oct/12 02:44 PM ]

Cannot reproduce in trunk. Has been fixed.





[JERSEY-1476] Support @ConstrainTo annotation from JAX-RS Created: 12/Oct/12  Updated: 12/Oct/12  Resolved: 12/Oct/12

Status: Resolved
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0-m09

Type: New Feature Priority: Blocker
Reporter: Martin Matula Assignee: Unassigned
Resolution: Duplicate Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates JERSEY-1425 Implement support for javax.ws.rs.Con... Resolved
Tags:
Participants: Martin Matula




[JERSEY-1467] Switch to latest JAX-RS 2.0 PR API version (2.0-m12). Created: 11/Oct/12  Updated: 15/Oct/12  Resolved: 15/Oct/12

Status: Resolved
Project: jersey
Component/s: core
Affects Version/s: None
Fix Version/s: 2.0-m09, 2.0

Type: Task Priority: Major
Reporter: Marek Potociar Assignee: Marek Potociar
Resolution: Fixed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: 1 hour
Original Estimate: 1 hour

Tags:
Participants: Marek Potociar




[JERSEY-1465] SSE Twitter Message Aggregator Example Created: 10/Oct/12  Updated: 15/Oct/12  Resolved: 15/Oct/12

Status: Resolved
Project: jersey
Component/s: examples
Affects Version/s: None
Fix Version/s: 2.0-m09, 2.0

Type: Task Priority: Blocker
Reporter: Marek Potociar Assignee: Marek Potociar
Resolution: Fixed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: 18 hours
Original Estimate: 18 hours

Tags:
Participants: Marek Potociar




[JERSEY-1460] Application.getClasses() can return invalid classes but implementation have to handle that gracefully. Created: 10/Oct/12  Updated: 15/Oct/12  Resolved: 11/Oct/12

Status: Resolved
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0-m09, 2.0

Type: Bug Priority: Major
Reporter: Pavel Bucek Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: 3 hours
Original Estimate: Not Specified

Tags:
Participants: Pavel Bucek

 Description   

providing set which contains "null" ends in

Exception in thread "main" java.lang.NullPointerException
	at org.glassfish.jersey.server.model.Resource.isAcceptable(Resource.java:487)
	at org.glassfish.jersey.server.model.IntrospectionModeller.createResourceBuilder(IntrospectionModeller.java:118)
	at org.glassfish.jersey.server.model.Resource.from(Resource.java:445)
	at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:271)
	at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:234)
	at org.glassfish.jersey.server.ContainerFactory.createContainer(ContainerFactory.java:79)
	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory.createHttpServer(GrizzlyHttpServerFactory.java:105)
	at org.glassfish.jersey.examples.helloworld.App.main(App.java:65)
	...

when only warning should be logged and application started (according to javax.ws.rs.core.Application.getClasses() javadoc).






[JERSEY-1452] provide build identifier (server) and user agent (client) Created: 08/Oct/12  Updated: 11/Mar/14  Resolved: 11/Oct/12

Status: Resolved
Project: jersey
Component/s: core
Affects Version/s: None
Fix Version/s: 2.0-m09, 2.0

Type: Improvement Priority: Major
Reporter: Jakub Podlesak Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: 8 hours
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by JERSEY-1427 Implement support for automatic User-... Resolved
Tags:
Participants: Jakub Podlesak and Pavel Bucek

 Description   

Jersey 1 runtime uses to log information on a concrete Jersey build used when a Jersey application gets started.
The log output looks like follows:

INFO: Initiating Jersey application, version 'Jersey: 1.15-SNAPSHOT 09/13/2012 01:58 PM'

We should have a similar feature implemented in Jersey 2 as well to help us diagnose issues.






[JERSEY-1446] refactor WADL implementation, migrate tests from Jersey 1.x Created: 03/Oct/12  Updated: 15/Oct/12  Resolved: 11/Oct/12

Status: Resolved
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0-m09, 2.0

Type: Task Priority: Major
Reporter: Pavel Bucek Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: 8 hours
Original Estimate: Not Specified

Tags:
Participants: Pavel Bucek




[JERSEY-1443] WebTarget#resolveTemplateFromEncoded does not encode % followed by % Created: 02/Oct/12  Updated: 10/Oct/12  Resolved: 10/Oct/12

Status: Resolved
Project: jersey
Component/s: core
Affects Version/s: 2.0-m08
Fix Version/s: 2.0-m09

Type: Bug Priority: Major
Reporter: jan.supol Assignee: Martin Matula
Resolution: Invalid Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags:
Participants: jan.supol and Martin Matula

 Description   

javadoc says:

All % characters in the stringified values that are not followed by two hexadecimal numbers will be encoded.

However, "%42%5A%61%7a%2F%%21" gets encoded as it is, not "%42%5A%61%7a%2F%25%21"



 Comments   
Comment by jan.supol [ 02/Oct/12 12:14 PM ]

It does, my bad.

Comment by Martin Matula [ 10/Oct/12 01:55 PM ]

What do you mean? Does it work? If so, then why don't you close this?

Comment by jan.supol [ 10/Oct/12 02:05 PM ]

Yes, it does work. I'd love to close it if I can.





[JERSEY-1437] WADL generation does not work in GlassFish Created: 26/Sep/12  Updated: 27/Sep/12  Resolved: 27/Sep/12

Status: Resolved
Project: jersey
Component/s: core
Affects Version/s: 2.0-m08
Fix Version/s: 2.0-m09

Type: Bug Priority: Blocker
Reporter: Martin Matula Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to JERSEY-1438 When reloading an application using J... Resolved
Tags:
Participants: Jakub Podlesak, Martin Matula and Pavel Bucek

 Description   

When I try to get WADL for a resource, I get 500. E.g. try with localhost:4848/monitoring/application.wadl. The following exception is logged:

INFO: REST00001: Listening to REST requests at context: /monitoring/domain
WARNING: Could not marshal wadl Application.
java.lang.NullPointerException
at org.glassfish.jersey.server.wadl.internal.WadlResource.getWadl(WadlResource.java:101)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.glassfish.jersey.server.model.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:80)
at org.glassfish.jersey.server.model.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:107)
at org.glassfish.jersey.server.model.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:146)
at org.glassfish.jersey.server.model.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:80)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:304)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:299)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:90)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:198)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:316)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:174)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:747)
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:306)
at org.glassfish.admin.rest.adapter.RestAdapter$1.service(RestAdapter.java:327)
at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:189)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispatch(HK2Dispatcher.java:113)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:236)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:175)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:265)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:825)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:578)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:558)
at java.lang.Thread.run(Thread.java:722)

I am guessing this is because WadlApplicationContextImpl line 92 results in exception which is not logged(!?!?!?!!) and jaxbContext is set to null. With this, the WADL functionality is totally unusable. This is blocking the EM team - needs to be fixed ASAP!



 Comments   
Comment by Jakub Podlesak [ 27/Sep/12 02:56 AM ]

same exception, different use case

Comment by Pavel Bucek [ 27/Sep/12 10:04 AM ]

reason:

[#|2012-09-27T11:57:15.427+0200|SEVERE|44.0|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=12;_ThreadName=admin-listener(1);|javax.xml.bind.JAXBException: "com.sun.research.ws.wadl" doesnt contain ObjectFactory.class or jaxb.index
	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:281)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:186)
	at javax.xml.bind.ContextFinder.find(ContextFinder.java:332)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:446)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:409)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:313)
	at org.glassfish.jersey.server.wadl.internal.WadlApplicationContextImpl.<init>(WadlApplicationContextImpl.java:92)
	at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:350)
	at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:234)
	at org.glassfish.jersey.server.ContainerFactory.createContainer(ContainerFactory.java:79)
	at org.glassfish.admin.rest.adapter.RestAdapter.getJerseyContainer(RestAdapter.java:323)
	at org.glassfish.admin.rest.adapter.RestAdapter.exposeContext(RestAdapter.java:316)
	at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:184)
	at com.sun.enterprise.v3.server.HK2Dispatcher.dispatch(HK2Dispatcher.java:113)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:236)
	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:175)
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:265)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:825)
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:578)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:558)
	at java.lang.Thread.run(Thread.java:680)
|#]

fix (tested only in gf):

--- a/core-server/pom.xml
+++ b/core-server/pom.xml
@@ -76,7 +76,7 @@
                 <configuration>
                     <instructions>
                         <!-- Note: When you're changing these properties change them also in bundles/jax-rs-ri/bundle/pom.xml. -->
-                        <Export-Package>org.glassfish.jersey.server.*;version=${project.version}</Export-Package>
+                        <Export-Package>org.glassfish.jersey.server.*;version=${project.version},com.sun.research.ws.wadl.*;version=${project.version}</Export-Package>
                         <Import-Package>javax.annotation.*;resolution:=optional;version="${range;[==,+);${javax.annotation.version}}", *</Import-Package>
                     </instructions>
                     <unpackBundle>true</unpackBundle>




[JERSEY-1435] Trailing slash not optional in Jetty7.3.0.v20110203/Jetty8.0.0.M3 even FEATURE_REDIRECT does not solve Created: 25/Sep/12  Updated: 23/Oct/12  Resolved: 23/Oct/12

Status: Resolved
Project: jersey
Component/s: containers
Affects Version/s: 1.14
Fix Version/s: 2.0-m09

Type: Bug Priority: Major
Reporter: samarjitsamanta Assignee: Pavel Bucek
Resolution: Won't Fix Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Tested with jetty-webapp-8.0.0.M3.jar/Jetty7.3.0.v20110203 running embedded.
jersey-servlet-1.14.jar
jersey-server-1.14.jar
asm-3.1.jar
jersey-core-1.14.jar
jetty-webapp-8.0.0.M3.jar
servlet-api-3.0.20100224.jar


File Attachments: Zip Archive helloworld.zip    
Tags: jetty-deployment
Participants: Pavel Bucek and samarjitsamanta

 Description   

Server invocation happens like this.

JettyStart.java
Logger log = Logger.getLogger("");
log.setLevel(Level.FINE);
log.getHandlers()[0].setLevel(Level.FINEST);

Server server = new Server(8082);
ServletContextHandler root = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
PackagesResourceConfig rc = new PackagesResourceConfig("");

Map<String, Object> entries = new HashMap<String, Object>();
entries.put("com.sun.jersey.config.feature.Trace", "true");
entries.put(ResourceConfig.FEATURE_REDIRECT, "true");
rc.setPropertiesAndFeatures(entries);
ServletContainer servlt = new ServletContainer(rc);
root.addServlet(new ServletHolder(servlt), "/");
server.start();
HelloWorldResource.java
@Path("/")
public class HelloWorldResource {
	@Path("/helloworld")
    @GET 
    @Produces("application/json")
    public String getClichedMessage() {
        return new MyBean("Hello World 2",20).toString();
    }
}

URL:
http://localhost:8082/helloworld or http://localhost:8082/helloworld/

Causes:

X-Jersey-Trace-000:accept root resource classes: "/helloworld/"
X-Jersey-Trace-001:match path "/helloworld/" -> "/application\.wadl(/.*)?", "(/.*)?"
X-Jersey-Trace-002:accept right hand path java.util.regex.Matcher[pattern=(/.*)? region=0,12 lastmatch=/helloworld/]: "/helloworld/" -> "" : "/helloworld/"
X-Jersey-Trace-003:accept resource: "" -> @Path("/") HelloWorldResource@9aba32
X-Jersey-Trace-004:match path "/helloworld/" -> "/helloworld(/)?", ""
X-Jersey-Trace-005:accept termination (matching failure): "/helloworld/"
X-Jersey-Trace-006:mapped exception to response: com.sun.jersey.api.NotFoundException@366573 -> 404 (Not Found)
log
FINE: Mapped exception to response: 404 (Not Found)
com.sun.jersey.api.NotFoundException: null for uri: http://localhost:8082/helloworld/
	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1481)

If used without redirect:

JettyStartWithoutRedirect.java
Logger log = Logger.getLogger("");
log.setLevel(Level.FINE);
log.getHandlers()[0].setLevel(Level.FINEST);

Server server = new Server(8082);
ServletContextHandler root = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
PackagesResourceConfig rc = new PackagesResourceConfig("");

Map<String, Object> entries = new HashMap<String, Object>();
entries.put("com.sun.jersey.config.feature.Trace", "true");
rc.setPropertiesAndFeatures(entries);
ServletContainer servlt = new ServletContainer(rc);
root.addServlet(new ServletHolder(servlt), "/");
server.start();

URL:http://localhost:8082/helloworld/
Return valid result:

MyBean[name = Hello World 2, age = 20]

URL:http://localhost:8082/helloworld
Gives Error:

X-Jersey-Trace-000:accept root resource classes: "/"
X-Jersey-Trace-001:match path "/" -> "/application\.wadl(/.*)?", "(/.*)?"
X-Jersey-Trace-002:accept right hand path java.util.regex.Matcher[pattern=(/.*)? region=0,1 lastmatch=/]: "/" -> "/" : ""
X-Jersey-Trace-003:accept resource: "" -> @Path("/") HelloWorldResource@569c60
X-Jersey-Trace-004:match path "" -> "/helloworld(/)?", ""
X-Jersey-Trace-005:accept resource methods: "", GET -> HelloWorldResource@569c60
X-Jersey-Trace-006:accept termination (matching failure): ""
X-Jersey-Trace-007:mapped exception to response: javax.ws.rs.WebApplicationException@3468f4 -> 405


 Comments   
Comment by Pavel Bucek [ 23/Oct/12 02:17 PM ]

verified in Jersey 1.14.

however, this is already fixed in Jersey 2 (tried on Jersey 2.0-m09, see attached archive) and additionally, fixing this could introduce braking change in Jersey 1, so I'll close it as "won't fix", since there is an easy workaround (don't use "/" as @Path value).

feel free to comment/convince me that this needs to be dealt with in Jersey 1.x workspace.

Comment by Pavel Bucek [ 23/Oct/12 02:18 PM ]

Jersey 2 testcase





[JERSEY-1427] Implement support for automatic User-Agent header inclusion in Jersey client. Created: 19/Sep/12  Updated: 11/Oct/12  Resolved: 11/Oct/12

Status: Resolved
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0-m09, 2.0

Type: New Feature Priority: Blocker
Reporter: Marek Potociar Assignee: Pavel Bucek
Resolution: Duplicate Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates JERSEY-1452 provide build identifier (server) and... Resolved
Tags:
Participants: Marek Potociar and Pavel Bucek




[JERSEY-1418] WebTarget#pathParams does not throw NPE when any of the names is null. Created: 10/Sep/12  Updated: 10/Oct/12  Resolved: 10/Oct/12

Status: Resolved
Project: jersey
Component/s: core
Affects Version/s: 2.0-m07
Fix Version/s: 2.0-m09

Type: Bug Priority: Major
Reporter: jan.supol Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: 30 minutes
Original Estimate: Not Specified

Tags:
Participants: jan.supol and Pavel Bucek

 Description   

javadoc says:

Throws:
NullPointerException - if the parameter map or any of the names is null.

The following does not throw an exception

WebTarget target = ...
Map<String, Object> map = new HashMap<String, Object>();
map.put(null, "value");
target.path("{path}").pathParams(map);


 Comments   
Comment by jan.supol [ 10/Sep/12 02:25 PM ]

pathParam, queryParam, and queryParams does not throw the Exception either.

Comment by jan.supol [ 01/Oct/12 05:01 PM ]

After a development on this class, path(null), queryParam, resolveTemplate(, ,boolean), resolveTemplateFromEncoded("path", null) throws IllegalArgumentException instead of NPE.

Comment by Pavel Bucek [ 10/Oct/12 12:08 PM ]

WebTarget#pathParams no longer exists, resolving as invalid.

Comment by Pavel Bucek [ 10/Oct/12 12:12 PM ]

overlooked comments, sorry.





[JERSEY-1417] WebTarget#pathParams( empty map ) does not return the same target instance in case the input parameter map is empty. Created: 10/Sep/12  Updated: 10/Oct/12  Resolved: 10/Oct/12

Status: Resolved
Project: jersey
Component/s: core
Affects Version/s: 2.0-m07
Fix Version/s: 2.0-m09, 2.0

Type: Bug Priority: Minor
Reporter: jan.supol Assignee: Pavel Bucek
Resolution: Invalid Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags:
Participants: jan.supol and Pavel Bucek

 Description   

pathParams javadoc says:

returns the same target instance in case the input parameter map is empty.

but

WebTarget target=...
WebTarget other = target.pathParams(new TreeMap<String, Object>());
assertEquals(other, target);

other != target.



 Comments   
Comment by Pavel Bucek [ 10/Oct/12 12:07 PM ]

WebTarget#pathParams no longer exists, resolving as invalid.





[JERSEY-1415] WebTarget#matrixParam(name, null) removes too much Created: 07/Sep/12  Updated: 10/Oct/12  Resolved: 10/Oct/12

Status: Resolved
Project: jersey
Component/s: core
Affects Version/s: 2.0-m07
Fix Version/s: 2.0-m09, 2.0

Type: Bug Priority: Major
Reporter: jan.supol Assignee: Miroslav Fuksa
Resolution: Fixed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: 4 hours
Original Estimate: Not Specified

Tags:
Participants: jan.supol and Miroslav Fuksa

 Description   

Suppose this:

WebTarget createWebTarget() throws Fault {
	Client client = ClientFactory.newClient();
	WebTarget target = client.target(URL);
	return target;
}

WebTarget target = createWebTarget();
target = target.matrixParam("matrix1", "segment1");
target = target.path("path1");
target = target.matrixParam("matrix2", "segment1");
target = target.matrixParam("matrix2", new Object[] { null });
target = target.path("path2");
target = target.matrixParam("matrix1", "segment1");
target = target.matrixParam("matrix1", new Object[] { null });
target = target.path("path3");
URI uri = target.getUri();

Here, I'd assume uri shall be URL + ";matrix1=segment1/path1/path2/path3", but it is only URL + "path3".
It not only removed matrix params from different segments, it also removed the path.
The javadoc says:

In case a single null value is entered, all parameters with that name in the current final path segment are removed (if present) from the collection of last segment matrix parameters inherited from the current target.






[JERSEY-1406] ClientResponseContext#getAllowedMethods returns method in lower case Created: 04/Sep/12  Updated: 09/Oct/12  Resolved: 09/Oct/12

Status: Resolved
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0-m09, 2.0

Type: Bug Priority: Major
Reporter: jan.supol Assignee: Miroslav Fuksa
Resolution: Fixed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: 1 hour
Original Estimate: Not Specified

Tags:
Participants: jan.supol and Miroslav Fuksa

 Description   

javadoc says:

Returns:
the allowed HTTP methods, all methods will returned as upper case strings.



 Comments   
Comment by jan.supol [ 04/Sep/12 12:37 PM ]

maybe they are not lower case, rather they are the way put into as allow header value.





[JERSEY-1402] Relative URI are not working for WebTarget injection Created: 31/Aug/12  Updated: 29/May/13  Resolved: 11/Oct/12

Status: Resolved
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0-m09, 2.0

Type: Bug Priority: Minor
Reporter: arungupta Assignee: Pavel Bucek
Resolution: Works as designed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: Not Specified
Original Estimate: 0 minutes

Tags:
Participants: arungupta and Pavel Bucek

 Description   

Injecting a WebTarget in another JAX-RS resource as:

@Path("myresource2")
public class MyResource2 {
public static final String RESOURCE_ENDPOINT = "/Jersey2Sample/webresources/myresource";

@Uri(RESOURCE_ENDPOINT)
WebTarget resource;

@GET
public String get() { return resource.request().get(String.class) + "2"; }

When this resource is accessed using GET, then the following exception is thrown:

SEVERE: InvocationException{message=org.glassfish.jersey.client.InboundJaxrsResponse@50506ea2, response=org.glassfish.jersey.client.InboundJaxrsResponse@50506ea2}
org.glassfish.jersey.internal.MappableException: InvocationException{message=org.glassfish.jersey.client.InboundJaxrsResponse@50506ea2, response=org.glassfish.jersey.client.InboundJaxrsResponse@50506ea2}
at org.glassfish.jersey.server.model.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:122)
at org.glassfish.jersey.server.model.AbstractJavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(AbstractJavaResourceMethodDispatcherProvider.java:219)
at org.glassfish.jersey.server.model.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:262)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:82)
at org.glassfish.jersey.process.internal.RequestInvoker$AcceptingInvoker.apply(RequestInvoker.java:241)
at org.glassfish.jersey.process.internal.AsyncInflectorAdapter.apply(AsyncInflectorAdapter.java:156)
at org.glassfish.jersey.process.internal.RequestInvoker$2.run(RequestInvoker.java:188)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:283)
at org.glassfish.jersey.process.internal.RequestInvoker$3.run(RequestInvoker.java:201)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253)
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:44)
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:41)
at org.glassfish.jersey.process.internal.RequestInvoker.apply(RequestInvoker.java:197)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:752)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:309)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:346)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:312)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:195)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1593)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:285)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:660)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:600)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:337)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:240)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:172)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:175)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:265)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:78)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:815)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:567)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:547)
at java.lang.Thread.run(Thread.java:722)
Caused by: InvocationException{message=org.glassfish.jersey.client.InboundJaxrsResponse@50506ea2, response=org.glassfish.jersey.client.InboundJaxrsResponse@50506ea2}
at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:682)
at org.glassfish.jersey.client.JerseyInvocation.access$400(JerseyInvocation.java:72)
at org.glassfish.jersey.client.JerseyInvocation$2.completed(JerseyInvocation.java:605)
at org.glassfish.jersey.client.JerseyInvocation$2.completed(JerseyInvocation.java:587)
at org.glassfish.jersey.client.ClientConfig$State$4$1.result(ClientConfig.java:410)
at org.glassfish.jersey.client.ClientConfig$State$4$1.result(ClientConfig.java:405)
at org.glassfish.jersey.process.internal.ResponseProcessor.notifyCallback(ResponseProcessor.java:315)
at org.glassfish.jersey.process.internal.ResponseProcessor.setResult(ResponseProcessor.java:301)
at org.glassfish.jersey.process.internal.ResponseProcessor.access$600(ResponseProcessor.java:83)
at org.glassfish.jersey.process.internal.ResponseProcessor$1.run(ResponseProcessor.java:243)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:283)
at org.glassfish.jersey.process.internal.ResponseProcessor.run(ResponseProcessor.java:188)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
... 1 more

Changing the RESOURCE_ENDPOINT to an absolute URL returns the appropriate response. Changing the value to "myresource" works fine too.

Filing a bug as mentioned on the users list at: http://java.net/projects/jersey/lists/users/archive/2012-08/message/128



 Comments   
Comment by Pavel Bucek [ 10/Oct/12 12:16 PM ]

when relative Uri is provided, Jersey completes it by adding context path of deployed application. In your case it ends up with someting like:

"/Jersey2Sample/webresources/Jersey2Sample/webresources/myresource"

so I don't really see what should be fixed or improved here, since other mentioned cases are ok.

Comment by Pavel Bucek [ 11/Oct/12 03:31 PM ]

works as designed. @Uri javadoc was adjusted to be more clear about resolving relative uris.





[JERSEY-1380] Add Support for @ManagedAsync. Created: 20/Aug/12  Updated: 19/Nov/12  Resolved: 19/Nov/12

Status: Resolved
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0-m09, 2.0

Type: New Feature Priority: Major
Reporter: Marek Potociar Assignee: Unassigned
Resolution: Fixed Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags:
Participants: Marek Potociar

 Description   

Custom Jersey annotation that enables resource method execution using Jersey-managed executors/threadpools.

DEMO: Rewrite existing managed async example to use the new API & run it.



 Comments   
Comment by Marek Potociar [ 19/Nov/12 12:56 PM ]

Has been fixed some time ago.





[JERSEY-1379] IllegalStateException is not thrown in case the method is invoked from a (post-matching) resource filter on ContainerRequestContext Created: 17/Aug/12  Updated: 05/Oct/12  Resolved: 05/Oct/12

Status: Resolved
Project: jersey
Component/s: core
Affects Version/s: 2.0-m06
Fix Version/s: 2.0-m09, 2.0

Type: Bug Priority: Major
Reporter: jan.supol Assignee: Miroslav Fuksa
Resolution: Fixed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: 5 hours
Original Estimate: 3 hours

Tags:
Participants: jan.supol and Miroslav Fuksa

 Description   

ContainerRequestContext#setMethod,setRequestUri,setRequestUri says:

Throws:
IllegalStateException - in case the method is invoked from a (post-matching) resource filter.

But on a following Resource and Filter the exception is not thrown:

@Provider
@BindingPriority(500)
public class ResponseFilter implements ContainerResponseFilter{
	@Override
	public void filter(ContainerRequestContext requestContext,
			ContainerResponseContext responseContext) throws IOException {
             requestContext.setMethod("OPTIONS");
        }
}

@Path("resource")
public class Resource {
        @GET
	@Path("setMethod")
	public Response setMethod() {
		Response response = Response.ok().build();
		return response;
	}
}


 Comments   
Comment by jan.supol [ 17/Aug/12 04:00 PM ]

There might be a confusion as @PostMatching was replaced by @PreMatching

Comment by jan.supol [ 02/Oct/12 03:07 PM ]

As of now, the thing is that when calling setMethod from not @PreMatching ContainerRequestFilter, it sets that value, it does not check whether the filter is @PreMatching or not, not throwing any exception. This is the same for the setRequestUri method





[JERSEY-1375] ContainerResponseContext#getEntityType throws exception Created: 16/Aug/12  Updated: 05/Oct/12  Resolved: 05/Oct/12

Status: Resolved
Project: jersey
Component/s: core
Affects Version/s: 2.0-m06
Fix Version/s: 2.0-m09, 2.0

Type: Bug Priority: Minor
Reporter: jan.supol Assignee: Miroslav Fuksa
Resolution: Fixed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: 2 hours
Original Estimate: 3 hours

Tags:
Participants: jan.supol and Miroslav Fuksa

 Description   

suppose a resource method

@GET
	@Path("getentitytype")
	public Response getEntityType() {
		String content = "ENTity";
		Response response = Response.ok().entity(content).build();
		return response;
	}

and a ContainerResponseFilter

@Provider
@BindingPriority(500)
public class ResponseFilter implements ContainerResponseFilter{
	@Override
	public void filter(ContainerRequestContext requestContext,
			ContainerResponseContext responseContext) throws IOException {
             Type type = responseContext.getEntityType();
        }
}

the following exception is thrown on getEntityType():

Caused by: java.lang.NullPointerException
at org.glassfish.jersey.message.internal.OutboundMessageContext.getEntityType(OutboundMessageContext.java:745)
at org.glassfish.jersey.server.ContainerResponse.getEntityType(ContainerResponse.java:311)



 Comments   
Comment by jan.supol [ 16/Aug/12 04:01 PM ]

Error on my side, the response looks like:

Response response = Response.ok().build();




[JERSEY-1372] NPE from org.glassfish.jersey.servlet.ServletContainer.destroy in embedded jax-rs test Created: 15/Aug/12  Updated: 15/Oct/12  Resolved: 15/Oct/12

Status: Resolved
Project: jersey
Component/s: containers
Affects Version/s: None
Fix Version/s: 2.0-m09, 2.0

Type: Bug Priority: Major
Reporter: marina vatkina Assignee: Marek Potociar
Resolution: Fixed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: 3 hours
Original Estimate: 3 hours

Issue Links:
Related
is related to GLASSFISH-19144 Embedded GlassFish does not seem to i... Open
Tags:
Participants: Marek Potociar and marina vatkina

 Description   

Embedded JAX-RS test reports this NPE on undeploy (plain 'ejbinwar' test is fine). To reproduce, do 'ant all' from v2/appserver-tests/devtests/ejb/ejb31/embedded/jaxrs

[java] SEVERE: WebModule[/ejb-ejb31-embedded-jaxrs-web]PWC1410: Servlet javax.ws.rs.core.Application threw unload() exception
[java] javax.servlet.ServletException: PWC1386: Servlet.destroy() for servlet javax.ws.rs.core.Application threw exception
[java] at org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java:1826)
[java] at org.apache.catalina.core.StandardWrapper.stop(StandardWrapper.java:2110)
[java] at org.apache.catalina.core.StandardContext.stop(StandardContext.java:5679)
[java] at com.sun.enterprise.web.WebModule.stop(WebModule.java:538)
[java] at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1064)
[java] at com.sun.enterprise.web.WebContainer.unloadWebModule(WebContainer.java:2170)
[java] at com.sun.enterprise.web.WebContainer.unloadWebModule(WebContainer.java:2125)
[java] at com.sun.enterprise.web.WebApplication.stop(WebApplication.java:158)
[java] at org.glassfish.internal.data.EngineRef.stop(EngineRef.java:161)
[java] at org.glassfish.internal.data.ModuleInfo.stop(ModuleInfo.java:302)
[java] at org.glassfish.internal.data.ApplicationInfo.stop(ApplicationInfo.java:329)
[java] at com.sun.enterprise.v3.server.ApplicationLifecycle.unload(ApplicationLifecycle.java:1042)
[java] at com.sun.enterprise.v3.server.ApplicationLifecycle.undeploy(ApplicationLifecycle.java:1082)
[java] at org.glassfish.deployment.admin.UndeployCommand.execute(UndeployCommand.java:363)
[java] at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:498)
[java] at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:519)
[java] at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1399)
[java] at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:112)
[java] at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1669)
[java] at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1632)
[java] at com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl.executeCommand(CommandExecutorImpl.java:147)
[java] at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.undeploy(DeployerImpl.java:157)
[java] at org.glassfish.ejb.embedded.EJBContainerImpl.undeploy(EJBContainerImpl.java:265)
[java] at org.glassfish.ejb.embedded.EJBContainerImpl.forceClose(EJBContainerImpl.java:197)
[java] at org.glassfish.ejb.embedded.EJBContainerImpl.close(EJBContainerImpl.java:184)
[java] at com.acme.Client.testEJB(Client.java:107)
[java] at com.acme.Client.main(Client.java:66)
[java] Caused by: java.lang.NullPointerException
[java] at org.glassfish.jersey.servlet.ServletContainer.destroy(ServletContainer.java:316)
[java] at org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java:1813)
[java] ... 26 more
[java] ----- Root Cause -----
[java] java.lang.NullPointerException
[java] at org.glassfish.jersey.servlet.ServletContainer.destroy(ServletContainer.java:316)
[java] at org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java:1813)
[java] at org.apache.catalina.core.StandardWrapper.stop(StandardWrapper.java:2110)
[java] at org.apache.catalina.core.StandardContext.stop(StandardContext.java:5679)
[java] at com.sun.enterprise.web.WebModule.stop(WebModule.java:538)
[java] at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1064)
[java] at com.sun.enterprise.web.WebContainer.unloadWebModule(WebContainer.java:2170)
[java] at com.sun.enterprise.web.WebContainer.unloadWebModule(WebContainer.java:2125)
[java] at com.sun.enterprise.web.WebApplication.stop(WebApplication.java:158)
[java] at org.glassfish.internal.data.EngineRef.stop(EngineRef.java:161)
[java] at org.glassfish.internal.data.ModuleInfo.stop(ModuleInfo.java:302)
[java] at org.glassfish.internal.data.ApplicationInfo.stop(ApplicationInfo.java:329)
[java] at com.sun.enterprise.v3.server.ApplicationLifecycle.unload(ApplicationLifecycle.java:1042)
[java] at com.sun.enterprise.v3.server.ApplicationLifecycle.undeploy(ApplicationLifecycle.java:1082)
[java] at org.glassfish.deployment.admin.UndeployCommand.execute(UndeployCommand.java:363)
[java] at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:498)
[java] at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:519)
[java] at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1399)
[java] at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:112)
[java] at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1669)
[java] at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1632)
[java] at com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl.executeCommand(CommandExecutorImpl.java:147)
[java] at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.undeploy(DeployerImpl.java:157)
[java] at org.glassfish.ejb.embedded.EJBContainerImpl.undeploy(EJBContainerImpl.java:265)
[java] at org.glassfish.ejb.embedded.EJBContainerImpl.forceClose(EJBContainerImpl.java:197)
[java] at org.glassfish.ejb.embedded.EJBContainerImpl.close(EJBContainerImpl.java:184)
[java] at com.acme.Client.testEJB(Client.java:107)
[java] at com.acme.Client.main(Client.java:66)
[java]






[JERSEY-1369] UriBuilder doesn't deal with Matrix parameter properly when there is a path sub element Created: 14/Aug/12  Updated: 10/Oct/12  Resolved: 10/Oct/12

Status: Resolved
Project: jersey
Component/s: None
Affects Version/s: 1.13
Fix Version/s: 2.0-m09

Type: Bug Priority: Major
Reporter: gdavison Assignee: Miroslav Fuksa
Resolution: Fixed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: 20 minutes
Original Estimate: Not Specified

Tags:
Participants: gdavison, Martin Matula and Miroslav Fuksa

 Description   

Consider these two tests along with the current test failures, it seems like UriBuilder doesn't deal with matrix parameters at multiple levels of the URI properly.

package client2;

import javax.ws.rs.core.UriBuilder;

import org.junit.Assert;
import org.junit.Test;

public class UriBuilderMAtrix {


    @Test
    public  void sameName() {
        UriBuilder first = UriBuilder.fromUri("http://www.com/").replaceMatrixParam("example", "one", "two");
        first = first.path("/child");
        System.out.println(first.build());
        first = first.replaceMatrixParam("example", "another");
        
        Assert.assertEquals(
            "http://www.com/;example=one;example=two/child;example=another", first.build());
        // java.lang.AssertionError: expected:<http://www.com/;example=one;example=two/child;example=another> but was:<http://www.com/;example=another>
    }

    @Test
    public  void different() {
        UriBuilder first = UriBuilder.fromUri("http://www.com/").replaceMatrixParam("example", "one", "two");
        first = first.path("/child");
        System.out.println(first.build());
        first = first.replaceMatrixParam("other", "another");

        Assert.assertEquals(
            "http://www.com/;example=one;example=two/child;other=another", first.build());
        // java.lang.AssertionError: expected:<http://www.com/;example=one;example=two/child;other=another> but was:<http://www.com/;other=another;example=one;example=two/child>
    }
}

Note that the documentation for UriBuilder.replaceMatrix states:

"Note that the matrix parameters are tied to a particular path segment; subsequent addition of path segments will not affect their position in the URI path."

So it should be possible to modify matrix parameters at different levels of the path without affecting the others



 Comments   
Comment by Martin Matula [ 21/Aug/12 12:06 PM ]

Pavel, please look into this. You may want to sync up with Marek if any clarifications need to be added to the spec.

Comment by Miroslav Fuksa [ 10/Oct/12 09:25 AM ]

Fixed by JERSEY-1415.

Comment by Miroslav Fuksa [ 10/Oct/12 09:26 AM ]

Fixed by JERSEY-1415.





[JERSEY-1365] Evaluate async client issues observed when running in following client -> server configurations (100 concurrent requests): - {{HttpURLConnection}} transport -> Grizzly server - Grizzly async client -> Grizzly server Created: 13/Aug/12  Updated: 10/Oct/12  Resolved: 10/Oct/12

Status: Resolved
Project: jersey
Component/s: core
Affects Version/s: None
Fix Version/s: 2.0-m09, 2.0

Type: Task Priority: Blocker
Reporter: Marek Potociar Assignee: Marek Potociar
Resolution: Fixed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: 3 hours
Original Estimate: 6 hours

Tags:
Participants: Marek Potociar




[JERSEY-1323] UriBuilder#uri(String) works differently from #uri(URI) Created: 01/Aug/12  Updated: 04/Oct/12  Resolved: 04/Oct/12

Status: Resolved
Project: jersey
Component/s: core
Affects Version/s: 2.0-m05
Fix Version/s: 2.0-m09, 2.0

Type: Bug Priority: Major
Reporter: jan.supol Assignee: Miroslav Fuksa
Resolution: Fixed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: 1 hour
Original Estimate: 3 hours

Tags:
Participants: jan.supol and Miroslav Fuksa

 Description   
String uriOrig = "ftp://ftp.is.co.za/rfc/rfc1808.txt";
URI uriReplace = new URI(null, "ftp.is.co.za","/test/rfc1808.txt", null, null);
uri = UriBuilder.fromUri(new URI(uriOrig)).uri(uriReplace).build();
System.out.println(uri); // ftp://ftp.is.co.za/test/rfc1808.txt

However, protocol ftp is missing here:

uri = UriBuilder.fromUri(new URI(uriOrig)).uri(uriReplace.toASCIIString()).build();
System.out.println(uri); // /ftp.is.co.za/test/rfc1808.txt

The javadoc says the uri(String) checks the string to be a correct URI, hence one would assume these two uri(URI) and uri(String) would work similar.






[JERSEY-1269] Async examples and tests are failing intermittently. Created: 02/Jul/12  Updated: 10/Oct/12  Resolved: 10/Oct/12

Status: Resolved
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0-m09, 2.0

Type: Bug Priority: Blocker
Reporter: Marek Potociar Assignee: Marek Potociar
Resolution: Fixed Votes: 0
Remaining Estimate: 0 minutes
Time Spent: 6 hours
Original Estimate: 18 hours

Issue Links:
Related
is related to JERSEY-1264 AsyncServletResourceITCase fails on W... Resolved
Tags:
Participants: Marek Potociar

 Description   

After commit that implements support for Singleton resources (and providers) the async example tests started to fail intermittently.






Jersey switches mediaType */* to be application/octet-stream when cycling through MessageBodyWriters leaving some Writers not handled (JERSEY-1075)

[JERSEY-1076] MessageBodyWriter with @Produces("*/*") is not considered a candidate when resource method @Produces("application/xml") Created: 04/Apr/12  Updated: 16/Oct/12  Resolved: 16/Oct/12

Status: Closed
Project: jersey
Component/s: core
Affects Version/s: 1.12
Fix Version/s: 2.0-m09

Type: Sub-task Priority: Major
Reporter: jan.supol Assignee: Unassigned
Resolution: Fixed Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags:
Participants: jan.supol and Martin Matula

 Description   

Only AppAnyEntityWriter.isWriteable() is called in the resource method, not DefaultEntityWriter.isWritable(), nor AppXmlObjectWriter.isWritable()

@Path("resource")
public class Resource {
	@GET
	@Produces(MediaType.APPLICATION_XML)
	@Path("supportxml")
	public EntityForWriter supportxml() {
		 MessageBodyWriter<EntityForWriter>  mbr = providers.getMessageBodyWriter(EntityForWriter.class,
				EntityForWriter.class.getGenericSuperclass(),
				(Annotation[]) null, MediaType.APPLICATION_XML_TYPE);
                //mbr == null !
		return new EntityForWriter("supportxml");
	}
}

@Produces("application/*")
@Provider
public class AppAnyEntityWriter implements MessageBodyWriter<EntityForWriter> {...}

@Provider
@Produces(MediaType.WILDCARD)
public class DefaultEntityWriter implements MessageBodyWriter<EntityForWriter> {...}

@Provider
@Produces(MediaType.WILDCARD)
public class AppXmlObjectWriter implements MessageBodyWriter<Object> {...}


 Comments   
Comment by Martin Matula [ 11/Apr/12 11:31 AM ]

The spec says more specific media types take precedence.

Comment by Martin Matula [ 11/Apr/12 02:27 PM ]

Honza showed me his code. The issue is the more specific writer returns false from isWritable() so the next writer should be picked.


A little off-topic, orthogonal to this issue, while discussing this issue with Honza it occurred to me the spec may have an issue as well.
According to the spec, the media type of the response is determined independent of the result of isWritable(). This may be an issue. Consider the following case:

Writer that converts java.lang.Object to application/xml. But the isWritable() returns false if no @XmlRootElement annotation is attached. The writer is annotated with @Produces("application/xml")

Then there is a different writer that can write java.lang.Object to application/json. It is annotated with @Produces("application/json").

According to the spec it seems that the runtime should first determine the media type returned from the method. If the method itself is not annotated with @Produces, the media type is determined based on what writers for a given java class are annotated with. In this case there would be two writers - one producing "application/xml" and another one "application/json" - both are specific, so ordering is not clear, but let's say they get ordered in such a way that application/xml one comes first - according to section 3.8 bullet 9 it wins and "application/xml" is set as the content type. Later, following section 4.2.2 of the spec (bullet 3 and further) it finds the writer for "application/xml" and calls isWritable() but it returns false, because my class is not annotated with @XmlRootElement - processing fails.

I believe this should be revised in the spec. Sorry for writing this as part of this issue - probably a separate issue should be filed against the spec if agreed.

Comment by Martin Matula [ 11/Apr/12 02:31 PM ]

We should target this for 2.0 only as it is an edge case.

Comment by jan.supol [ 16/Oct/12 05:15 PM ]

Has been fixed.





[JERSEY-1004] Support resource interfaces by including implemented interfaces in ScanningResourceConfig's search for @Path annotations Created: 05/Mar/12  Updated: 13/Nov/13  Resolved: 16/Oct/12

Status: Resolved
Project: jersey
Component/s: core
Affects Version/s: 1.12
Fix Version/s: 2.0-m09

Type: Bug Priority: Major
Reporter: Andreas Klein Assignee: Marek Potociar
Resolution: Fixed Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by JERSEY-1050 Moving JAX-RS annotations to an inter... Resolved
Tags:
Participants: Andreas Klein, Marek Potociar, Martin Matula and mumrah

 Description   

It's sometimes quite handy to be able to split resources into an interface annotated as root resource and a concrete implementing class.
As an example:

package com.foo;

import javax.ws.rs.GET;
import javax.ws.rs.Path;


@Path("/hello")
public interface IHelloResource {

  @GET
  public String sayHello();

}

and

package com.bar;

public class HelloResourceImpl implements IHelloResource {

  @Override
  public String sayHello() {
	return "Hello Jersey";
  }
}

This is working fine so long as you manually configure HelloResourceImpl as a root resource class, but using Jersey's otherwise so convenient PackagesResourceConfig to automatically scan in specific packages (say in this case com.bar) for resources will ignore HelloResourceImpl.
ScanningResourceConfig only looks for @Path or @Provider annotations inside the actual classes themselves. While it is possible to overload the @Path annotation (or any other JAX RS annotation) in the concrete implementation, it kind of beats the purpose, scattering the resource configuration across multiple locations.

It would be great if ScanningResourceConfig were to either look for some new type targeting annotation, such as @Resource, that could be used to manually annotate root resource classes even if they do not themselves have the @Path annotation. Better yet of course, would be to inspect all classes found in the specified resource packages more thoroughly and see not only if they implement @Path directly but whether they implement any interfaces which in turn are annotated with @Path.



 Comments   
Comment by Marek Potociar [ 09/Mar/12 01:24 PM ]

Package scanning needs to be fixed to find also these resources, or the javadoc should be updated.

Comment by Martin Matula [ 28/Mar/12 05:34 PM ]

I think we need to implement the following:
1) scanning should never add a class that is not a resource (i.e. non-instantiable class) - this definitely needs to be fixed
2) if feasible (from perf. perspective), scanning should look at inherited annotations (if no annotations declared directly on the inspected type)

If we implement this, I think it should not matter where the superclass/interface that defines the annotation resides (only the location of the resource class itself should matter). I.e. I can put the interface into a package that is not scanned, and just have the resource class implementing the interface in the scanned package and it should work IMO. If I do include the interface in the same package, the scanning must not include the interface (based on bullet 1)) in the set of resources, just the class should be included. (e.g. in the current Jersey 2.0 snapshot even if I put annotations on the class itself, it fails, because the scanning still includes the interface as well, which is wrong).

Comment by Marek Potociar [ 16/Oct/12 09:22 AM ]

We decided for performance reasons that during scanning the interfaces will be ignored. Also we fixed that Jersey will not try to instantiate interfaces.

Comment by mumrah [ 13/Nov/13 03:19 PM ]

Any chance of this getting back ported to 1.x?





[JERSEY-999] Jersey package scanning does not work whenjersey server endpoint deployed in a app launched via JNLP / java webstart Created: 01/Mar/12  Updated: 29/May/13  Resolved: 29/May/13

Status: Resolved
Project: jersey
Component/s: core
Affects Version/s: 2.0
Fix Version/s: 2.0-m09, 2.0

Type: Bug Priority: Minor
Reporter: najmi Assignee: Marek Potociar
Resolution: Incomplete Votes: 0
Remaining Estimate: 0 minutes
Time Spent: Not Specified
Original Estimate: 0 minutes

Tags:
Participants: Marek Potociar, najmi and Pavel Bucek

 Description   

For details see:

http://java.net/projects/jersey/lists/users/archive/2012-02/message/162
http://java.net/projects/jersey/lists/users/archive/2012-02/message/190
http://java.net/projects/jersey/lists/users/archive/2012-03/message/7



 Comments   
Comment by Pavel Bucek [ 13/Mar/12 05:33 PM ]

adjusting priority.

can you please attach reproducible testcase? It would help a lot. JNLP environment is severely limited in non-secure operations and package scanning might be one of them. You always have the alternative in specifying resource/provider classes directly.

Comment by najmi [ 13/Mar/12 05:51 PM ]

I was unable to create a reproducable test case by in the past. The problem is complicated by classloaders involved. Sorry I cannot be more help at present.

Comment by Marek Potociar [ 10/Oct/12 03:44 PM ]

Reproducible test not available. Closing as incomplete.





[JERSEY-683] samples/jersey-ejb - Add a resource class that produces a textual response to an HTTP GET Created: 20/Mar/11  Updated: 16/Oct/12  Resolved: 16/Oct/12

Status: Resolved
Project: jersey
Component/s: examples
Affects Version/s: 1.6
Fix Version/s: 2.0-m09

Type: Improvement Priority: Minor
Reporter: jbenoit Assignee: Marek Potociar
Resolution: Won't Fix Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags:
Participants: jbenoit and Marek Potociar

 Description   

Need to add to jersey-ejb sample a resource class that produces a textual response to an HTTP GET and update jersey/samples/jersey-ejb/README.html appropriately to reference this newly added resource class.

Change jersey-ejb/README.html to not display: "TODO A resource class that produces a textual response to an HTTP GET" (see http://java.net/jira/browse/JERSEY-665) Need to add this resource class



 Comments   
Comment by jbenoit [ 01/Jun/11 02:14 PM ]

We have helloworld, helloworld-webapp, and scala-helloworld-webapp - all fullfill this requirement via HelloworldResource defined similar to this:

package com.sun.jersey.samples.helloworld.resources;

import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.ws.rs.Path;

// The Java class will be hosted at the URI path "/helloworld"
@Path("/helloworld")
public class HelloWorldResource {

// The Java method will process HTTP GET requests
@GET
// The Java method will produce content identified by the MIME Media
// type "text/plain"
@Produces("text/plain")
public String getClichedMessage() { // Return some cliched textual content return "Hello World"; }
}

Comment by Marek Potociar [ 16/Oct/12 09:19 AM ]

We're tracking TODOs in the code. Does not make sense to track them also in Jira.





Generated at Thu Apr 24 02:45:33 UTC 2014 using JIRA 4.0.2#472.