[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3965) @Providers not working - ResteasyDispatcher registers components and providers in wrong order
by Balazs Pataki (JIRA)
@Providers not working - ResteasyDispatcher registers components and providers in wrong order
---------------------------------------------------------------------------------------------
Key: JBSEAM-3965
URL: https://jira.jboss.org/jira/browse/JBSEAM-3965
Project: Seam
Issue Type: Bug
Components: WS
Affects Versions: 2.1.1.CR1
Reporter: Balazs Pataki
While using the latest nightly build (from 2009.02.19) I found that my @Provider annotated class is not used by Seam+RESTEasy. It seemed to be loaded but not used by injection mechanism. By debugging the code I found out that it is not used because org.jboss.seam.resteasy.ResteasyDispatcher#onStartup() first registers the resources and after that the providers. However, as part of the resource registration the injection mechanism including the converters are set up, however at this point the converters (providers) have not been loaded.
It seems to first load the providers and then the resources.
This is my patch that worked in my setup:
> diff -c ResteasyDispatcher.java ResteasyDispatcher_orig.java
*** ResteasyDispatcher.java 2009-02-20 11:10:35.000000000 +0100
--- ResteasyDispatcher_orig.java 2009-02-19 00:18:26.000000000 +0100
***************
*** 56,91 ****
getDispatcher().setLanguageMappings(application.getLanguageMappings());
getDispatcher().setMediaTypeMappings(application.getMediaTypeMappings());
- // Provider registration
- if (application.isUseBuiltinProviders())
- {
- log.info("registering built-in RESTEasy providers");
- RegisterBuiltin.register(providerFactory);
- }
- for (Class providerClass : application.getProviderClasses())
- {
- Component seamComponent = application.getProviderClassComponent(providerClass);
- if (seamComponent != null)
- {
- if (ScopeType.STATELESS.equals(seamComponent.getScope()))
- {
- throw new RuntimeException(
- "Registration of STATELESS Seam components as RESTEasy providers not implemented!"
- );
- }
- else if (ScopeType.APPLICATION.equals(seamComponent.getScope()))
- {
- Object providerInstance = Component.getInstance(seamComponent.getName());
- providerFactory.registerProviderInstance(providerInstance);
- }
- }
- else
- {
- // Just plain RESTEasy, no Seam component lookup or lifecycle
- providerFactory.registerProvider(providerClass);
- }
- }
-
// Resource registration
Registry registry = getDispatcher().getRegistry();
for (final Class resourceClass : application.getClasses())
--- 56,61 ----
***************
*** 133,137 ****
--- 103,138 ----
registry.addResourceFactory(new POJOResourceFactory(resourceClass));
}
}
+
+ // Provider registration
+ if (application.isUseBuiltinProviders())
+ {
+ log.info("registering built-in RESTEasy providers");
+ RegisterBuiltin.register(providerFactory);
+ }
+ for (Class providerClass : application.getProviderClasses())
+ {
+ Component seamComponent = application.getProviderClassComponent(providerClass);
+ if (seamComponent != null)
+ {
+ if (ScopeType.STATELESS.equals(seamComponent.getScope()))
+ {
+ throw new RuntimeException(
+ "Registration of STATELESS Seam components as RESTEasy providers not implemented!"
+ );
+ }
+ else if (ScopeType.APPLICATION.equals(seamComponent.getScope()))
+ {
+ Object providerInstance = Component.getInstance(seamComponent.getName());
+ providerFactory.registerProviderInstance(providerInstance);
+ }
+ }
+ else
+ {
+ // Just plain RESTEasy, no Seam component lookup or lifecycle
+ providerFactory.registerProvider(providerClass);
+ }
+ }
+
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3992) SEAM RestEasy library throws exception if an encoded url is entered/
by John Sublette (JIRA)
SEAM RestEasy library throws exception if an encoded url is entered/
--------------------------------------------------------------------
Key: JBSEAM-3992
URL: https://jira.jboss.org/jira/browse/JBSEAM-3992
Project: Seam
Issue Type: Bug
Components: WS
Affects Versions: 2.1.1.GA
Environment: Tomcat with SEAM 2.1.1.GA and resteasy
Reporter: John Sublette
Priority: Minor
Call from org.jboss.seam.resteasy.ResteasyResourceAdapter.??.process() to UriInfoImpl(URI absolutePath, String encodedPath, String queryString, List<PathSegment> encodedPathSegments) requires an encodedPath passed in, which is not being done. A StringIndexOutOfBoundsException is thrown due to the "encodedPath" not being found in the absolute path.
Code that sets "path" can be moved after the setup of absolutePath and changed to:
String path = PathHelper.getEncodedPathInfo(absolutePath.getRawPath(), request.getContextPath());
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years
[jbossseam-issues] [JBoss JIRA] Closed: (JBSEAM-3265) RESTEasy exception handling
by Christian Bauer (JIRA)
[ https://jira.jboss.org/jira/browse/JBSEAM-3265?page=com.atlassian.jira.pl... ]
Christian Bauer closed JBSEAM-3265.
-----------------------------------
Fix Version/s: 2.1.2.CR1
Resolution: Done
Tested and documented
> RESTEasy exception handling
> ---------------------------
>
> Key: JBSEAM-3265
> URL: https://jira.jboss.org/jira/browse/JBSEAM-3265
> Project: Seam
> Issue Type: Task
> Components: WS
> Reporter: Christian Bauer
> Assignee: Christian Bauer
> Fix For: 2.1.2.CR1
>
>
> JAX-RS specifies the ExceptionMapper providers: The job of an ExceptionMapper is to convert an Exception instance to an HttpResponse.
> Two issues with that:
> RESTEasy does all that internally, that means once we dispatch a request to RESTEasy, we'll never get an exception out of the dispatcher call, only an HttpResponse. So we can't do internal cleanup of Seam contexts after an exception occurs.
> Second problem is that Seam has exactly the same functionality built-in, with ExceptionHandler and pages.xml declarations of mappings. So we definitely should give users the option to use that instead of writing a dozen ExceptionMapper classes. To get this working we need to get the exception out of the dispatcher invocation, to either call RESTEasy ExceptionMappers from outside of the dispatcher or to let it bubble up to the Seam ExceptionHandler so pages.xml can be used.
> This requires a rewrite of the exception handling in RESTEasy, the issue has been brought up on their dev mailing list.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3932) org.jboss.el.util.ReflectionUtil/org.jboss.el.util.ReferenceCache causes thread and memory leak
by Alexander Schwartz (JIRA)
org.jboss.el.util.ReflectionUtil/org.jboss.el.util.ReferenceCache causes thread and memory leak
-----------------------------------------------------------------------------------------------
Key: JBSEAM-3932
URL: https://jira.jboss.org/jira/browse/JBSEAM-3932
Project: Seam
Issue Type: Bug
Affects Versions: 2.1.1.GA
Environment: Tomcat w/ Seam on Windows
Reporter: Alexander Schwartz
org.jboss.el.util.ReflectionUtil (from jboss-el) uses a
private static ReferenceCache methodCache
and this ReferenceCache is leaking a thread that is used for cleanup. You can't call a cleanup method from the outside.
But the methodCache could be removed from the code as it is not used anyway: it is read in findMethod(), but nothing is stored (the code is commented out in version 1.0_02.CR2, and not present in all other souces (2.0.2.CR1, 2.0.1.GA).
Every redeployment of an application will leak one thread due to this bug. And it causes a memory leak as the web application class loader can't be unloaded due to this bug.
The pom.xml of jboss-el states "JBoss EL is a extended EL implementation, distributed with Seam", therefore I report this bug against Seam.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years
[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-3265) RESTEasy exception handling
by Jozef Hartinger (JIRA)
[ https://jira.jboss.org/jira/browse/JBSEAM-3265?page=com.atlassian.jira.pl... ]
Jozef Hartinger commented on JBSEAM-3265:
-----------------------------------------
Looks like in the meantime code changes in RESTEasy solved this issue. If exception appears, RESTEasy's SynchronousDispatcher now throws UnhandledException if there is no ExceptionMapper to take care of the primary exception. Exception bubbles out of the invoke() call and can be handled by pages.xml ExceptionHandler like this:
<exception class="org.jboss.seam.framework.EntityNotFoundException">
<http-error error-code="404" />
</exception>
> RESTEasy exception handling
> ---------------------------
>
> Key: JBSEAM-3265
> URL: https://jira.jboss.org/jira/browse/JBSEAM-3265
> Project: Seam
> Issue Type: Task
> Components: WS
> Reporter: Christian Bauer
> Assignee: Christian Bauer
>
> JAX-RS specifies the ExceptionMapper providers: The job of an ExceptionMapper is to convert an Exception instance to an HttpResponse.
> Two issues with that:
> RESTEasy does all that internally, that means once we dispatch a request to RESTEasy, we'll never get an exception out of the dispatcher call, only an HttpResponse. So we can't do internal cleanup of Seam contexts after an exception occurs.
> Second problem is that Seam has exactly the same functionality built-in, with ExceptionHandler and pages.xml declarations of mappings. So we definitely should give users the option to use that instead of writing a dozen ExceptionMapper classes. To get this working we need to get the exception out of the dispatcher invocation, to either call RESTEasy ExceptionMappers from outside of the dispatcher or to let it bubble up to the Seam ExceptionHandler so pages.xml can be used.
> This requires a rewrite of the exception handling in RESTEasy, the issue has been brought up on their dev mailing list.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years