You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2010 |
Jan
(1) |
Feb
(2) |
Mar
(6) |
Apr
(5) |
May
(1) |
Jun
(2) |
Jul
(2) |
Aug
(8) |
Sep
(4) |
Oct
(2) |
Nov
(6) |
Dec
(4) |
| 2011 |
Jan
(4) |
Feb
(18) |
Mar
(9) |
Apr
(7) |
May
(6) |
Jun
(13) |
Jul
(11) |
Aug
(7) |
Sep
(12) |
Oct
(28) |
Nov
(12) |
Dec
(11) |
| 2012 |
Jan
(20) |
Feb
(21) |
Mar
(19) |
Apr
(12) |
May
(44) |
Jun
(23) |
Jul
(14) |
Aug
(26) |
Sep
(23) |
Oct
(7) |
Nov
(42) |
Dec
(15) |
| 2013 |
Jan
(62) |
Feb
(20) |
Mar
(14) |
Apr
(52) |
May
(29) |
Jun
(46) |
Jul
(20) |
Aug
(55) |
Sep
(27) |
Oct
(53) |
Nov
(29) |
Dec
(21) |
| 2014 |
Jan
(35) |
Feb
(44) |
Mar
(12) |
Apr
(37) |
May
(24) |
Jun
(17) |
Jul
(13) |
Aug
(1) |
Sep
(4) |
Oct
(13) |
Nov
(1) |
Dec
(1) |
| 2015 |
Jan
(11) |
Feb
(8) |
Mar
(10) |
Apr
(7) |
May
(17) |
Jun
(11) |
Jul
(13) |
Aug
(14) |
Sep
(6) |
Oct
(3) |
Nov
(7) |
Dec
(3) |
| 2016 |
Jan
(1) |
Feb
(4) |
Mar
(8) |
Apr
(2) |
May
(2) |
Jun
(10) |
Jul
|
Aug
|
Sep
(5) |
Oct
(1) |
Nov
|
Dec
|
|
From: Bill B. <bb...@re...> - 2014-01-23 18:22:54
|
Keycloak is an SSO auth server and appliance for web applications and RESTful web services. It can act as a Social Broker for Social Login via Google, Twitter, and Facebook. It has a nice admin console UI for managing a variety of security metadata and much much more... Please view my blog for more details on features, videos, downloads, and documentation: http://bill.burkecentral.com/2014/01/23/keycloak-sso-released-alpha-1/ -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Bill B. <bb...@re...> - 2014-01-23 14:13:42
|
Have you checked this out? http://docs.jboss.org/resteasy/docs/3.0.6.Final/userguide/html/Authentication.html#d4e1730 I've never used it, but it may help. On 1/23/2014 8:39 AM, andrew simpson wrote: > > I'd like to test rest services which implement oauth1.0a. > > What's the best way to generate the CLIENT oauth1.0a headers necessary > to do this? > > I've seen how to manually construct a client request with oauth headers > (https://github.com/ams10961/siwtjsf) but am not sure whether I can > manipulate all the headers correctly when making the client calls from a > rs client in an arquillian test... > > Has anyone managed to do this, or are there rs clients that will > generate the oauth headers that I could use from an arquillian test? > > Thanks.. > > Andrew > > https://github.com/ams10961/siwtjsf > > import javax.ws.rs.client.Client; > import javax.ws.rs.client.ClientBuilder; > import javax.ws.rs.client.Entity; > import javax.ws.rs.client.WebTarget; > import javax.ws.rs.core.MediaType; > import javax.ws.rs.core.Response; > > > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > > > > _______________________________________________ > Resteasy-users mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-users > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: andrew s. <and...@gm...> - 2014-01-23 13:40:05
|
I'd like to test rest services which implement oauth1.0a. What's the best way to generate the CLIENT oauth1.0a headers necessary to do this? I've seen how to manually construct a client request with oauth headers ( https://github.com/ams10961/siwtjsf) but am not sure whether I can manipulate all the headers correctly when making the client calls from a rs client in an arquillian test... Has anyone managed to do this, or are there rs clients that will generate the oauth headers that I could use from an arquillian test? Thanks.. Andrew https://github.com/ams10961/siwtjsf import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; |
|
From: John D. A. <joh...@gm...> - 2014-01-21 00:55:12
|
Bill, Definitely. I already sent you one on the CdiInjectorFactory bug I saw in Netty. ( https://issues.jboss.org/browse/RESTEASY-1009 ) Another thing to think about is how to get an external RequestDispatcher. Right now, you have a lot of duplicate code in Netty3 and Netty4 modules (it also looks like the netty4 module is new). Perhaps starting off with a Netty Base project and having each extend from there would help? The easiest way to handle RequestDispatcher is to have a setter, if it's not set use the default, otherwise use the provided one. - John On Mon, Jan 20, 2014 at 5:10 PM, Bill Burke <bb...@re...> wrote: > We would of course appreciate any PRs that could come out of this effort. > > On 1/19/2014 9:58 AM, John D. Ament wrote: >> Hi all, >> >> In case anyone's interested, I just put out a blog post on how you can >> use RestEasy and the Netty Embedded Server with Weld. >> >> http://john-ament.blogspot.com/2014/01/bridging-netty-resteasy-and-weld.html >> >> and if you'd like to see the code: >> https://github.com/johnament/resteasy-netty-cdi >> >> Please do let me know your thoughts. >> >> - John >> >> ------------------------------------------------------------------------------ >> CenturyLink Cloud: The Leader in Enterprise Cloud Services. >> Learn Why More Businesses Are Choosing CenturyLink Cloud For >> Critical Workloads, Development Environments & Everything In Between. >> Get a Quote or Start a Free Trial Today. >> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk >> _______________________________________________ >> Resteasy-users mailing list >> Res...@li... >> https://lists.sourceforge.net/lists/listinfo/resteasy-users >> > > -- > Bill Burke > JBoss, a division of Red Hat > http://bill.burkecentral.com > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > Resteasy-users mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-users |
|
From: Bill B. <bb...@re...> - 2014-01-20 22:11:02
|
We would of course appreciate any PRs that could come out of this effort. On 1/19/2014 9:58 AM, John D. Ament wrote: > Hi all, > > In case anyone's interested, I just put out a blog post on how you can > use RestEasy and the Netty Embedded Server with Weld. > > http://john-ament.blogspot.com/2014/01/bridging-netty-resteasy-and-weld.html > > and if you'd like to see the code: > https://github.com/johnament/resteasy-netty-cdi > > Please do let me know your thoughts. > > - John > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > Resteasy-users mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-users > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Weinan Li <l.w...@gm...> - 2014-01-20 04:59:51
|
Hi John, Nice article! I’ve forked your project to learn from it :-) -- Weinan Li On Sunday, January 19, 2014 at 10:58 PM, John D. Ament wrote: > Hi all, > > In case anyone's interested, I just put out a blog post on how you can > use RestEasy and the Netty Embedded Server with Weld. > > http://john-ament.blogspot.com/2014/01/bridging-netty-resteasy-and-weld.html > > and if you'd like to see the code: > https://github.com/johnament/resteasy-netty-cdi > > Please do let me know your thoughts. > > - John > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > Resteasy-users mailing list > Res...@li... (mailto:Res...@li...) > https://lists.sourceforge.net/lists/listinfo/resteasy-users |
|
From: John D. A. <joh...@gm...> - 2014-01-19 14:58:08
|
Hi all, In case anyone's interested, I just put out a blog post on how you can use RestEasy and the Netty Embedded Server with Weld. http://john-ament.blogspot.com/2014/01/bridging-netty-resteasy-and-weld.html and if you'd like to see the code: https://github.com/johnament/resteasy-netty-cdi Please do let me know your thoughts. - John |
|
From: John D. A. <joh...@gm...> - 2014-01-19 13:50:18
|
I've struggled with this before as well. Unfortunately, as far as I
can tell the resteasy client APIs have no logging. When I look at
CXF, you can reuse CXF's logging in/out filter to enable debug of
these messages. Personally, I use them to help mock out responses
from the server (though I also started persisting the response to
disk).
>From looking at the debug logs, you can technically turn on debug for
the underlying Apache HTTP client libs, and then you can get the raw
request/response. See below for some output:
1445 [main] DEBUG org.apache.http.wire - << "HTTP/1.1 200 OK[\r][\n]"
1447 [main] DEBUG org.apache.http.wire - << "Content-Type: text/plain[\r][\n]"
1447 [main] DEBUG org.apache.http.wire - << "Content-Length: 4[\r][\n]"
1447 [main] DEBUG org.apache.http.wire - << "Connection: keep-alive[\r][\n]"
1447 [main] DEBUG org.apache.http.wire - << "Content-Type: text/plain[\r][\n]"
1447 [main] DEBUG org.apache.http.wire - << "[\r][\n]"
1448 [main] DEBUG org.apache.http.impl.conn.DefaultClientConnection -
Receiving response: HTTP/1.1 200 OK
1448 [main] DEBUG org.apache.http.headers - << HTTP/1.1 200 OK
1448 [main] DEBUG org.apache.http.headers - << Content-Type: text/plain
1448 [main] DEBUG org.apache.http.headers - << Content-Length: 4
1448 [main] DEBUG org.apache.http.headers - << Connection: keep-alive
1448 [main] DEBUG org.apache.http.headers - << Content-Type: text/plain
1451 [main] DEBUG org.apache.http.impl.client.DefaultHttpClient -
Connection can be kept alive indefinitely
1456 [main] DEBUG org.apache.http.wire - << "pong"
- John
On Sun, Jan 19, 2014 at 2:54 AM, andrew simpson <and...@gm...> wrote:
>
> Hi, I'm using jboss as7.1.1 with arqullian with the following test client
> classes
>
> import javax.ws.rs.client.Client;
> import javax.ws.rs.client.ClientBuilder;
> import javax.ws.rs.client.Entity;
> import javax.ws.rs.client.WebTarget;
> import javax.ws.rs.core.MediaType;
> import javax.ws.rs.core.Response;
>
> I'd like to view the JSON requests and responses going back and forth
> between test client and service under test, ideally body and headers...
>
> I've tried to set up a servlet filter, but this didn't do what I needed.
>
> Can I enable logging directly on the rs client using log4j?
>
> Thanks!
>
> Andrew
>
>
>
>
> rest-easy version:
> <version.org.jboss.resteasy>3.0.4.Final</version.org.jboss.resteasy>
>
> rest-easy dependencies
>
> <!-- REST -->
> <dependency>
> <groupId>org.jboss.resteasy</groupId>
> <artifactId>resteasy-bom</artifactId>
> <version>${version.org.jboss.resteasy}</version>
> <type>pom</type>
> <scope>provided</scope>
> </dependency>
>
> <dependency>
> <groupId>org.jboss.resteasy</groupId>
> <artifactId>resteasy-client</artifactId>
> <version>${version.org.jboss.resteasy}</version>
> <scope>provided</scope>
> </dependency>
>
> <dependency>
> <groupId>org.jboss.resteasy</groupId>
> <artifactId>resteasy-jackson-provider</artifactId>
> <version>${version.org.jboss.resteasy}</version>
> <scope>provided</scope>
> </dependency>
>
> <dependency>
> <groupId>org.jboss.resteasy</groupId>
> <artifactId>jaxrs-api</artifactId>
> <version>${version.org.jboss.resteasy}</version>
> <scope>provided</scope>
> </dependency>
>
> <dependency>
> <groupId>org.jboss.resteasy</groupId>
> <artifactId>resteasy-jaxrs</artifactId>
> <version>${version.org.jboss.resteasy}</version>
> <scope>provided</scope>
> </dependency>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> Resteasy-users mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>
|
|
From: andrew s. <and...@gm...> - 2014-01-19 07:54:36
|
Hi, I'm using jboss as7.1.1 with arqullian with the following test client
classes
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
I'd like to view the JSON requests and responses going back and forth
between test client and service under test, ideally body and headers...
I've tried to set up a servlet filter, but this didn't do what I needed.
Can I enable logging directly on the rs client using log4j?
Thanks!
Andrew
rest-easy version:
<version.org.jboss.resteasy>3.0.4.Final</version.org.jboss.resteasy>
rest-easy dependencies
<!-- REST -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-bom</artifactId>
<version>${version.org.jboss.resteasy}</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>${version.org.jboss.resteasy}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>${version.org.jboss.resteasy}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jaxrs-api</artifactId>
<version>${version.org.jboss.resteasy}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>${version.org.jboss.resteasy}</version>
<scope>provided</scope>
</dependency>
|
|
From: Satyanarayana K <kri...@ya...> - 2014-01-19 03:01:14
|
Hi,
I am trying to use RESTeasy 3.0.6 with JBoss AS 7, on Windows. To the best of my knowledge, I have done the installation and configuration correctly. But when I start JBoss AS 7 with a .war file placed in the standalone/deployments folder, the Server starts, deployment starts but deployment fails on step 2 and is rolled back. The log message is appended at the end.
Now, the file ' C:\Program Files\JBoss7\modules\org\codehaus\jackson\jackson-jaxrs\main\module.xml' is as provided by RESTeasy. It is to be loaded implicitly. So, why should there be "unexpected content" and why should deployment fail?
As further information: I have included the following in web.xml
<context-param>
<param-name>javax.ws.rs.Application</param-name> <param-value>service.xxxApp</param-value>
</context-param>
Quick help is greatly appreciated.
Thanks,
Satya
********** LOG-MESSAGE ***********
19:44:56,271 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.unit."xxx.war".POST_MODULE:
ervice.StartException in service jboss.deployment.unit."xxx.war".POST_MODULE:
Failed to process phase POST_MODULE of deployment "xxx.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [:1.7.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [:1.7.0]
at java.lang.Thread.run(Thread.java:722) [:1.7.0]
Caused by: org.jboss.modules.ModuleLoadError: Error loading module from C:\Program Files\JBoss7\modules\org\codehaus\jackson\jackson-jaxrs\main\module.xml
at org.jboss.modules.ModuleLoadException.toError(ModuleLoadException.java:78)
at org.jboss.modules.Module.getPaths(Module.java:1104)
at org.jboss.modules.Module.getResources(Module.java:655)
at org.jboss.modules.ModuleClassLoader.findResources(ModuleClassLoader.java:502)
at org.jboss.modules.ConcurrentClassLoader.getResources(ConcurrentClassLoader.java:196)
at org.jboss.as.server.moduleservice.ModuleIndexBuilder.buildCompositeIndex(ModuleIndexBuilder.java:50)
at org.jboss.as.server.moduleservice.ModuleIndexService.getIndex(ModuleIndexService.java:68)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scan(JaxrsScanningProcessor.java:206)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:114)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)
... 5 more
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[24,80]
Message: Unexpected content of type 'element start' named '{urn:jboss:module:1.1}module'
at org.jboss.modules.ModuleXmlParser.unexpectedContent(ModuleXmlParser.java:312)
at org.jboss.modules.ModuleXmlParser.parseDocument(ModuleXmlParser.java:503)
at org.jboss.modules.ModuleXmlParser.parseModuleXml(ModuleXmlParser.java:244)
at org.jboss.modules.ModuleXmlParser.parseModuleXml(ModuleXmlParser.java:200)
at org.jboss.modules.LocalModuleLoader.parseModuleInfoFile(LocalModuleLoader.java:147)
at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:124)
at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:245)
at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:194)
at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:97)
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:176)
at org.jboss.modules.Module.linkImports(Module.java:1039)
at org.jboss.modules.Module.getPaths(Module.java:1101)
... 13 more
19:44:56,281 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployment of "xxx.war" was rolled back with failure message {"Faile
{"jboss.deployment.unit.\"xxx.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"xxx.war\".POST
to process phase POST_MODULE of deployment \"xxx.war\""}}
19:44:56,403 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) Stopped deployment xxx.war in 121ms
19:44:56,405 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation ste
d services" => {"jboss.deployment.unit.\"xxx.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"xxx..
******************************************* |
|
From: Frode A. <fro...@gm...> - 2014-01-18 21:01:36
|
What is the correct behavior when a JAX-RS method throws an exception that are not mapped by a ExceptionMapper and a ContainerResponseFilter is provided?
@Path("/") @Produces(value = { MediaType.TEXT_PLAIN })
public class ApiResources {
@GET
@Path("throwIllegalArgumentException")
public String getThrowIllegalArgumentException() {
throw new IllegalArgumentException( "HELLO from throwIllegalArgumentException" );
}
@Provider
public class MonitorFilter implements ContainerResponseFilter {
@Override
public void filter( ContainerRequestContext requestContext,
ContainerResponseContext responseContext ) throws IOException {
System.out.println(“Resource returned status=“ + responseContext.getStatus());
}
}
Tested the code in wildfly-8.0.0.Alpha4 and the ContainerResponseFilter#filter method was not called. It was only called after a ExceptionMapper for IllegalArgumentException was provided.
@Provider
public class IllegalStateExceptionExceptionMapper implements ExceptionMapper<IllegalStateException> {
@Override
public Response toResponse( IllegalStateException e ) {
return Response.status( Response.Status.INTERNAL_SERVER_ERROR ).entity( e.getMessage() )
.build();
}
}
|
|
From: Bill B. <bb...@re...> - 2014-01-16 13:24:08
|
The examples use Jetty. Its probably just a context path issue. On 1/16/2014 12:50 AM, Weinan Li wrote: > Hi Kapil, > > Are you using "oreilly-jaxrs-2.0-workbook/ex03_1” or "oreilly-workbook/ex03_1”? The former one can only be deployed in a JavaEE application server that supports JAX-RS 2.0 spec like WildFly, because it doesn’t have standalone settings in web.xml. Please add following settings you web.xml if you want to deploy it in tomcat: > > <servlet> > <servlet-name>Resteasy</servlet-name> > <servlet-class> > org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher > </servlet-class> > <init-param> > <param-name>javax.ws.rs.Application</param-name> > <param-value> > com.restfully.shop.services.ShoppingApplication > </param-value> > </init-param> > </servlet> > > <servlet-mapping> > <servlet-name>Resteasy</servlet-name> > <url-pattern>/*</url-pattern> > </servlet-mapping> > > > > In addition, if ex03_1.war is deployed into tomcat correctly you should see the following log in catalina.out: > > resteasy.spi.ResteasyDeployment. Deploying javax.ws.rs.core.Application: class com.restfully.shop.services.ShoppingApplication > 16-Jan-2014 13:37:17.219 INFO [localhost-startStop-2] org.jboss.resteasy.spi.ResteasyDeployment. Adding singleton resource com.restfully.shop.services.CustomerResource from Application class com.restfully.shop.services.ShoppingApplication > > > And then you can access it by http://127.0.0.1:8080/ex03_1/customers > > -- > Weinan Li > > > On Thursday, January 16, 2014 at 1:16 AM, Kapil Gambhir wrote: > >> am trying to run the samples from the O'Reilly book (by Bill Burke) on Tomcat. Tried both for Tomcat 7 and 8. The ShoppingApplication deploys fine but when i try to POST a customer resource to /services/customers it gives me 404. >> I built the war from the Maven for Chapter 3 example (ex03_1) and deployed that war on Tomcat and the deployment (Tomcat startup console) shows messages of ShoppingApplication being deployed. What am i missing, dont see any error message or any clue around what could be going wrong. >> >> Thanks in anticipation, >> Kapil. >> ------------------------------------------------------------------------------ >> CenturyLink Cloud: The Leader in Enterprise Cloud Services. >> Learn Why More Businesses Are Choosing CenturyLink Cloud For >> Critical Workloads, Development Environments & Everything In Between. >> Get a Quote or Start a Free Trial Today. >> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk >> >> _______________________________________________ >> Resteasy-users mailing list >> Res...@li... (mailto:Res...@li...) >> https://lists.sourceforge.net/lists/listinfo/resteasy-users > > > > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > Resteasy-users mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-users > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Weinan Li <l.w...@gm...> - 2014-01-16 12:01:28
|
-- Weinan Li On Thursday, January 16, 2014 at 7:00 PM, Kapil Gambhir wrote: > Hi, > thanks for a prompt response, am using the JAX-RS v2, so the "oreilly-jaxrs-2.0-workbook/ex03_1”. > I am able to run the example with the web.xml (http://web.xml) changes suggested by you, it made sense also but am wondering how the default example (shipped as a zip) worked on jetty (which is also a servlet container only, pretty much like Tomcat). The examples download has the Maven scripts which execute the test client using the Jetty and that works fine without the web.xml (http://web.xml) changes. Any idea on this one? > my objective is to use a lightweight container to keep things simple and fast. I haven’t looked into details of Jetty, but the reason could only be that Jetty supports JAX-RS2.0 spec out of box. > > > On Thu, Jan 16, 2014 at 11:20 AM, Weinan Li <l.w...@gm... (mailto:l.w...@gm...)> wrote: > > Hi Kapil, > > > > Are you using "oreilly-jaxrs-2.0-workbook/ex03_1” or "oreilly-workbook/ex03_1”? The former one can only be deployed in a JavaEE application server that supports JAX-RS 2.0 spec like WildFly, because it doesn’t have standalone settings in web.xml (http://web.xml). Please add following settings you web.xml (http://web.xml) if you want to deploy it in tomcat: > > > > <servlet> > > <servlet-name>Resteasy</servlet-name> > > <servlet-class> > > org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher > > </servlet-class> > > <init-param> > > <param-name>javax.ws.rs.Application</param-name> > > <param-value> > > com.restfully.shop.services.ShoppingApplication > > </param-value> > > </init-param> > > </servlet> > > > > <servlet-mapping> > > <servlet-name>Resteasy</servlet-name> > > <url-pattern>/*</url-pattern> > > </servlet-mapping> > > > > > > > > In addition, if ex03_1.war is deployed into tomcat correctly you should see the following log in catalina.out: > > > > resteasy.spi.ResteasyDeployment. Deploying javax.ws.rs.core.Application: class com.restfully.shop.services.ShoppingApplication > > 16-Jan-2014 13:37:17.219 INFO [localhost-startStop-2] org.jboss.resteasy.spi.ResteasyDeployment. Adding singleton resource com.restfully.shop.services.CustomerResource from Application class com.restfully.shop.services.ShoppingApplication > > > > > > And then you can access it by http://127.0.0.1:8080/ex03_1/customers > > > > -- > > Weinan Li > > > > > > On Thursday, January 16, 2014 at 1:16 AM, Kapil Gambhir wrote: > > > > > am trying to run the samples from the O'Reilly book (by Bill Burke) on Tomcat. Tried both for Tomcat 7 and 8. The ShoppingApplication deploys fine but when i try to POST a customer resource to /services/customers it gives me 404. > > > I built the war from the Maven for Chapter 3 example (ex03_1) and deployed that war on Tomcat and the deployment (Tomcat startup console) shows messages of ShoppingApplication being deployed. What am i missing, dont see any error message or any clue around what could be going wrong. > > > > > > Thanks in anticipation, > > > Kapil. > > > ------------------------------------------------------------------------------ > > > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > > > Learn Why More Businesses Are Choosing CenturyLink Cloud For > > > Critical Workloads, Development Environments & Everything In Between. > > > Get a Quote or Start a Free Trial Today. > > > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > > > > > > _______________________________________________ > > > Resteasy-users mailing list > > > Res...@li... (mailto:Res...@li...) (mailto:Res...@li...) > > > https://lists.sourceforge.net/lists/listinfo/resteasy-users > > > |
|
From: Kapil G. <kap...@gm...> - 2014-01-16 11:00:21
|
Hi, thanks for a prompt response, am using the JAX-RS v2, so the "oreilly-jaxrs-2.0-workbook/ex03_1”. I am able to run the example with the web.xml changes suggested by you, it made sense also but am wondering how the default example (shipped as a zip) worked on jetty (which is also a servlet container only, pretty much like Tomcat). The examples download has the Maven scripts which execute the test client using the Jetty and that works fine without the web.xml changes. Any idea on this one? my objective is to use a lightweight container to keep things simple and fast. On Thu, Jan 16, 2014 at 11:20 AM, Weinan Li <l.w...@gm...> wrote: > Hi Kapil, > > Are you using "oreilly-jaxrs-2.0-workbook/ex03_1” or > "oreilly-workbook/ex03_1”? The former one can only be deployed in a JavaEE > application server that supports JAX-RS 2.0 spec like WildFly, because it > doesn’t have standalone settings in web.xml. Please add following settings > you web.xml if you want to deploy it in tomcat: > > <servlet> > <servlet-name>Resteasy</servlet-name> > <servlet-class> > org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher > </servlet-class> > <init-param> > <param-name>javax.ws.rs.Application</param-name> > <param-value> > com.restfully.shop.services.ShoppingApplication > </param-value> > </init-param> > </servlet> > > <servlet-mapping> > <servlet-name>Resteasy</servlet-name> > <url-pattern>/*</url-pattern> > </servlet-mapping> > > > > In addition, if ex03_1.war is deployed into tomcat correctly you should > see the following log in catalina.out: > > resteasy.spi.ResteasyDeployment. Deploying javax.ws.rs.core.Application: > class com.restfully.shop.services.ShoppingApplication > 16-Jan-2014 13:37:17.219 INFO [localhost-startStop-2] > org.jboss.resteasy.spi.ResteasyDeployment. Adding singleton resource > com.restfully.shop.services.CustomerResource from Application class > com.restfully.shop.services.ShoppingApplication > > > And then you can access it by http://127.0.0.1:8080/ex03_1/customers > > -- > Weinan Li > > > On Thursday, January 16, 2014 at 1:16 AM, Kapil Gambhir wrote: > > > am trying to run the samples from the O'Reilly book (by Bill Burke) on > Tomcat. Tried both for Tomcat 7 and 8. The ShoppingApplication deploys fine > but when i try to POST a customer resource to /services/customers it gives > me 404. > > I built the war from the Maven for Chapter 3 example (ex03_1) and > deployed that war on Tomcat and the deployment (Tomcat startup console) > shows messages of ShoppingApplication being deployed. What am i missing, > dont see any error message or any clue around what could be going wrong. > > > > Thanks in anticipation, > > Kapil. > > > ------------------------------------------------------------------------------ > > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > > Learn Why More Businesses Are Choosing CenturyLink Cloud For > > Critical Workloads, Development Environments & Everything In Between. > > Get a Quote or Start a Free Trial Today. > > > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > > > > _______________________________________________ > > Resteasy-users mailing list > > Res...@li... (mailto: > Res...@li...) > > https://lists.sourceforge.net/lists/listinfo/resteasy-users > > > > |
|
From: Weinan Li <l.w...@gm...> - 2014-01-16 08:09:34
|
I’ve tested ex03_1 after set it up properly and deployed it on Tomcat8. And it works without any problem: $ curl -X POST -H "Content-Type: application/xml" -d "<customer><first-name>Bill</first-name><last-name>Burke</last-name><street>256 Clarendon Street</street><city>Boston</city><state>MA</state><zip>02115</zip><country>USA</country></customer>" http://127.0.0.1:8080/ex03_1/customers From catalina.out: Created customer 1 $ curl http://127.0.0.1:8080/ex03_1/customers/1 <customer id="1"> <first-name>Bill</first-name> <last-name>Burke</last-name> <street>256 Clarendon Street</street> <city>Boston</city> <state>MA</state> <zip>02115</zip> <country>USA</country> </customer> -- Weinan Li On Thursday, January 16, 2014 at 1:50 PM, Weinan Li wrote: > Hi Kapil, > > Are you using "oreilly-jaxrs-2.0-workbook/ex03_1” or "oreilly-workbook/ex03_1”? The former one can only be deployed in a JavaEE application server that supports JAX-RS 2.0 spec like WildFly, because it doesn’t have standalone settings in web.xml (http://web.xml). Please add following settings you web.xml (http://web.xml) if you want to deploy it in tomcat: > > <servlet> > <servlet-name>Resteasy</servlet-name> > <servlet-class> > org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher > </servlet-class> > <init-param> > <param-name>javax.ws.rs.Application</param-name> > <param-value> > com.restfully.shop.services.ShoppingApplication > </param-value> > </init-param> > </servlet> > > <servlet-mapping> > <servlet-name>Resteasy</servlet-name> > <url-pattern>/*</url-pattern> > </servlet-mapping> > > > > In addition, if ex03_1.war is deployed into tomcat correctly you should see the following log in catalina.out: > > resteasy.spi.ResteasyDeployment. Deploying javax.ws.rs.core.Application: class com.restfully.shop.services.ShoppingApplication > 16-Jan-2014 13:37:17.219 INFO [localhost-startStop-2] org.jboss.resteasy.spi.ResteasyDeployment. Adding singleton resource com.restfully.shop.services.CustomerResource from Application class com.restfully.shop.services.ShoppingApplication > > > And then you can access it by http://127.0.0.1:8080/ex03_1/customers > > -- > Weinan Li > > > On Thursday, January 16, 2014 at 1:16 AM, Kapil Gambhir wrote: > > > am trying to run the samples from the O'Reilly book (by Bill Burke) on Tomcat. Tried both for Tomcat 7 and 8. The ShoppingApplication deploys fine but when i try to POST a customer resource to /services/customers it gives me 404. > > I built the war from the Maven for Chapter 3 example (ex03_1) and deployed that war on Tomcat and the deployment (Tomcat startup console) shows messages of ShoppingApplication being deployed. What am i missing, dont see any error message or any clue around what could be going wrong. > > > > Thanks in anticipation, > > Kapil. > > ------------------------------------------------------------------------------ > > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > > Learn Why More Businesses Are Choosing CenturyLink Cloud For > > Critical Workloads, Development Environments & Everything In Between. > > Get a Quote or Start a Free Trial Today. > > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > > > > _______________________________________________ > > Resteasy-users mailing list > > Res...@li... (mailto:Res...@li...) > > https://lists.sourceforge.net/lists/listinfo/resteasy-users > |
|
From: Weinan Li <l.w...@gm...> - 2014-01-16 05:50:35
|
Hi Kapil, Are you using "oreilly-jaxrs-2.0-workbook/ex03_1” or "oreilly-workbook/ex03_1”? The former one can only be deployed in a JavaEE application server that supports JAX-RS 2.0 spec like WildFly, because it doesn’t have standalone settings in web.xml. Please add following settings you web.xml if you want to deploy it in tomcat: <servlet> <servlet-name>Resteasy</servlet-name> <servlet-class> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher </servlet-class> <init-param> <param-name>javax.ws.rs.Application</param-name> <param-value> com.restfully.shop.services.ShoppingApplication </param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>Resteasy</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> In addition, if ex03_1.war is deployed into tomcat correctly you should see the following log in catalina.out: resteasy.spi.ResteasyDeployment. Deploying javax.ws.rs.core.Application: class com.restfully.shop.services.ShoppingApplication 16-Jan-2014 13:37:17.219 INFO [localhost-startStop-2] org.jboss.resteasy.spi.ResteasyDeployment. Adding singleton resource com.restfully.shop.services.CustomerResource from Application class com.restfully.shop.services.ShoppingApplication And then you can access it by http://127.0.0.1:8080/ex03_1/customers -- Weinan Li On Thursday, January 16, 2014 at 1:16 AM, Kapil Gambhir wrote: > am trying to run the samples from the O'Reilly book (by Bill Burke) on Tomcat. Tried both for Tomcat 7 and 8. The ShoppingApplication deploys fine but when i try to POST a customer resource to /services/customers it gives me 404. > I built the war from the Maven for Chapter 3 example (ex03_1) and deployed that war on Tomcat and the deployment (Tomcat startup console) shows messages of ShoppingApplication being deployed. What am i missing, dont see any error message or any clue around what could be going wrong. > > Thanks in anticipation, > Kapil. > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > > _______________________________________________ > Resteasy-users mailing list > Res...@li... (mailto:Res...@li...) > https://lists.sourceforge.net/lists/listinfo/resteasy-users |
|
From: Kapil G. <kap...@gm...> - 2014-01-15 17:16:35
|
am trying to run the samples from the O'Reilly book (by Bill Burke) on Tomcat. Tried both for Tomcat 7 and 8. The ShoppingApplication deploys fine but when i try to POST a customer resource to /services/customers it gives me 404. I built the war from the Maven for Chapter 3 example (ex03_1) and deployed that war on Tomcat and the deployment (Tomcat startup console) shows messages of ShoppingApplication being deployed. What am i missing, dont see any error message or any clue around what could be going wrong. Thanks in anticipation, Kapil. |
|
From: Asaf S. <as...@gm...> - 2014-01-10 16:19:36
|
Hey,
I have REST resource defined as:
@POST
@Formatted
@Consumes({MediaType.MULTIPART_FORM_DATA, MediaType.APPLICATION_JSON})
MyEntity add(MultipartFormDataInput input) throws IOException;
I'd like to create a CLIENT side proxy and supply an MultipartFormDataInput,
I'm not sure whether this is possible to create a MultipartFormDataInput on
the client side easily though,
Without proxy it is simply possible to create a MultipartFormDataOutput
such:
MultipartFormDataOutput mdo = new MultipartFormDataOutput();
GenericEntity<MultipartFormDataOutput> entity = new
GenericEntity<MultipartFormDataOutput>(mdo) {};
WebTarget target = client.target(...)
target.request(MediaType.APPLICATION_JSON).post(Entity.entity(entity,
MediaType.MULTIPART_FORM_DATA_TYPE));
But I rather use the API via proxy instead if possible,
Thanks.
|
|
From: Bill B. <bb...@re...> - 2014-01-09 13:34:01
|
Unfortunately, when using EJBs, if you override the SecurityContext,
this context does not propagate to the EJB security logic.
On 1/9/2014 5:15 AM, Adr...@ti... wrote:
> What I want to do is to configure a REST service with basic
> authentication and roles authorization using RESTEasy.
> Currently, I am confused with the security configuration and I hope
> someone can help me.
>
> REST service : http://localhost:8080/xedu-web/rest/course/{1}
> ---------------------------------------------------------------
>
> @Stateless
> *@Path("/course")*
> @PermitAll
> public class *CourseRestService *{
> @EJB
> private CourseServices service;
>
> @Inject
> private ServiceContextServices serviceContextServices;
>
> @GET
> *@Path("{id}")*
> // @RolesAllowed("users")
>
> @Consumes({"application/vnd.ch.xpertline.xedu.data.interfaces+json",
> "application/json", "application/xml"})
>
> @Produces({"application/vnd.ch.xpertline.xedu.data.interfaces+json",
> "application/json", "application/xml"})
> public XEDUEICourseSingleResponse *find*(@PathParam("id") Integer
> id, @QueryParam("serviceContext") EIServiceContext serviceContext) {
> try {
> serviceContextServices.setContext(serviceContext);
> EISingleResponse<XEDUEICourse> ei = service.findEI(id);
> return new XEDUEICourseSingleResponse(ei);
> } catch (ConversionException ce) {
> throw new BadRequestRestException(ce);
> } catch (Exception e) {
> throw new ComponentRestException(e);
> }
> }
> }
>
> web.xml
> ---------------------------------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app version="3.0"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
>
> <display-name>xedu-web</display-name>
>
> <context-param>
> <param-name>resteasy.scan</param-name>
> <param-value>true</param-value>
> </context-param>
>
> <context-param>
> <param-name>resteasy.role.based.security</param-name>
> <param-value>true</param-value>
> </context-param>
>
> <context-param>
> <param-name>resteasy.servlet.mapping.prefix</param-name>
> <param-value>/rest</param-value>
> </context-param>
>
> <listener>
>
> <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
>
> </listener>
>
> <servlet>
> <servlet-name>Resteasy</servlet-name>
>
> <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>Resteasy</servlet-name>
> <url-pattern>/rest/*</url-pattern>
> </servlet-mapping>
> </web-app>
>
>
> Request filter:
> ---------------------------------------------------------------
>
> @Provider
> public class *AuthenticationRequestFilter *implements
> ContainerRequestFilter {
> @Override
> public void *filter*(ContainerRequestContext ctx) throws IOException {
> User user = null;
>
> try {
> String[] credentials = readCredentials(ctx);
> String username = credentials[0];
> String password = credentials[1];
> user = authenticate(username, password);
> } catch (AuthenticationException e) {
> switch (e.getErrorCode()) {
> case 401:
>
> ctx.abortWith(Response.status(Response.Status.UNAUTHORIZED).build());
> break;
> case 403:
>
> ctx.abortWith(Response.status(Response.Status.FORBIDDEN).build());
> break;
> }
> }
>
> // Set the custom security context
> if (user != null)
> ctx.*setSecurityContext*(new AppSecurityContext(user,
> ctx.getUriInfo()));
> }
>
> ...
> }
>
> The current (correct) behavior is the following:
> - when I send a request with a valid credential (user1), the request
> filter authenticates the user and the service returns the resource data.
> - when I send a request without credentials, my request filter returns a
> 401 code.
> - when I send a request with an unknown user, my filter returns a 403 code.
>
> My question is : how to set up authorization on methods based on roles?
> Users and roles are stored in an application database, not on JBoss.
>
> Here's what I did and that did not work:
> - I added the annotation @RolesAllowed("users") on my service method.
> - I set a custom SecurityContext in my request filter that associates
> the role "users" to the user "user1"
> - I added and set the context-param "resteasy.role.based.security" to
> true in web.xml.
>
> The resulting behavior is that my filter is never called, and all
> requests result in a 403 code.
> It seems that the role is checked before calling my request filter, so
> that the custom SecurityContext is not yet created.
>
> Lately, I read in the documentation that we must not enable
> "resteasy.role.based.security" if we use EJBs, and that is my case.
> However, I didn't found any example or description about what to do in
> that case.
>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Resteasy-users mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: <Adr...@ti...> - 2014-01-09 10:47:11
|
What I want to do is to configure a REST service with basic authentication
and roles authorization using RESTEasy.
Currently, I am confused with the security configuration and I hope
someone can help me.
REST service : http://localhost:8080/xedu-web/rest/course/{1}
---------------------------------------------------------------
@Stateless
@Path("/course")
@PermitAll
public class CourseRestService {
@EJB
private CourseServices service;
@Inject
private ServiceContextServices serviceContextServices;
@GET
@Path("{id}")
// @RolesAllowed("users")
@Consumes({"application/vnd.ch.xpertline.xedu.data.interfaces+json",
"application/json", "application/xml"})
@Produces({"application/vnd.ch.xpertline.xedu.data.interfaces+json",
"application/json", "application/xml"})
public XEDUEICourseSingleResponse find(@PathParam("id") Integer id,
@QueryParam("serviceContext") EIServiceContext serviceContext) {
try {
serviceContextServices.setContext(serviceContext);
EISingleResponse<XEDUEICourse> ei = service.findEI(id);
return new XEDUEICourseSingleResponse(ei);
} catch (ConversionException ce) {
throw new BadRequestRestException(ce);
} catch (Exception e) {
throw new ComponentRestException(e);
}
}
}
web.xml
---------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>xedu-web</display-name>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>resteasy.role.based.security</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</context-param>
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
Request filter:
---------------------------------------------------------------
@Provider
public class AuthenticationRequestFilter implements ContainerRequestFilter
{
@Override
public void filter(ContainerRequestContext ctx) throws IOException {
User user = null;
try {
String[] credentials = readCredentials(ctx);
String username = credentials[0];
String password = credentials[1];
user = authenticate(username, password);
} catch (AuthenticationException e) {
switch (e.getErrorCode()) {
case 401:
ctx.abortWith(Response.status(Response.Status.UNAUTHORIZED).build());
break;
case 403:
ctx.abortWith(Response.status(Response.Status.FORBIDDEN).build());
break;
}
}
// Set the custom security context
if (user != null)
ctx.setSecurityContext(new AppSecurityContext(user,
ctx.getUriInfo()));
}
...
}
The current (correct) behavior is the following:
- when I send a request with a valid credential (user1), the request
filter authenticates the user and the service returns the resource data.
- when I send a request without credentials, my request filter returns a
401 code.
- when I send a request with an unknown user, my filter returns a 403
code.
My question is : how to set up authorization on methods based on roles?
Users and roles are stored in an application database, not on JBoss.
Here's what I did and that did not work:
- I added the annotation @RolesAllowed("users") on my service method.
- I set a custom SecurityContext in my request filter that associates the
role "users" to the user "user1"
- I added and set the context-param "resteasy.role.based.security" to true
in web.xml.
The resulting behavior is that my filter is never called, and all requests
result in a 403 code.
It seems that the role is checked before calling my request filter, so
that the custom SecurityContext is not yet created.
Lately, I read in the documentation that we must not enable "
resteasy.role.based.security" if we use EJBs, and that is my case.
However, I didn't found any example or description about what to do in
that case.
|
|
From: Jim S. <ji...@ji...> - 2013-12-25 21:12:09
|
http://stackoverflow.com/questions/20776696/resteasy-loses-object-during-serialization Very interested in your answers. |
|
From: Eric H. <eh...@ae...> - 2013-12-24 00:20:42
|
Is there any way to prevent the resteasy framework from throwing an "UnhandledException: Response is committed, can't handle exception" when a client requests a page and disconnects mid-transfer of the file? My use case is that I'm sending firmware to phones based on some database lookups, and the firmware can be up to 200MB in size. If the phone already has the firmware, it drops the connection after a couple of MB have been transferred. Resteasy throws an exception since the client dropped the session, with the root cause being a ClientAbortException due to a Connection Reset. Is it possible to ignore that specific exception, or should I just deal with the stack traces in the log files? Thanks, Eric -- ------------------------------ This document may contain unclassified technical data whose export, transfer and/or disclosure is restricted by United States law. Dissemination to non-US persons, whether in the United States or abroad may require an export license or other authorization. The information contained herein, including any attached documents or files, is confidential, may be legally privileged and is solely for the intended recipient(s). If you received this information in error, please destroy it and notify us immediately by reply e-mail, letter, fax or phone. Any unauthorized use, dissemination, disclosure, copying or printing is strictly prohibited. http://www.aeromach.com |
|
From: John F. <jjf...@gm...> - 2013-12-23 13:26:20
|
Gunnar, Thanks for your response and your aid. John Ament had given a resolution out-of-band: the Seam validation extension is at the root of the problem. On Sat, Dec 21, 2013 at 12:31 PM, John D. Ament <joh...@gm...> wrote: > John, > > I think I found your issue.. > > So in the Seam Validation extension, they did this: > > https://github.com/seam/validation/blob/develop/impl/src/main/java/org/jboss/seam/validation/ValidationExtension.java#L56 > Basically, they try to see if a ValidatorFactory is available, and > Validator is available. The problem is ordering. In this scenario, > the validator isn't available yet (in CDI 1.1 they clarified that you > cannot attempt to get a reference to an object), so the extension will > in fact attempt to install a custom bean, which if I had to guess is > messing with the default implementation and causing bad things to > happen. > > I would normally tell you to disable the extension, but that won't > work here since they're loading the extension in the framework (here: > > https://github.com/seam/validation/blob/develop/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension > ). You do have a couple of other solutions: > > 1. Create your own org.jboss.seam.validation.ValidationExtension class > that does not do this. This will trick the classloader into loading > yours first (assuming you're packaging a WAR or EAR). If you're using > an EAR, make sure the module that has this comes before validation. > 2. Create a shaded JAR that only includes what you need (if you're not > using the method validator, based on the code example you sent out, > you can safely just pull in the constraint validator, but you'll need > to manually install). > 3. Switch to DeltaSpike. I know 0.5 doesn't look final, but in its > current behavior Seam3 is also not very compatible with the AS7 line. > Our compatibility is a bit better, now that Arquillian has in fact > grown to a more robust testing framework. > > In order of my preference, I would go 2 then 3 then 1. 1 is the > hackier solution, and requires classloading witchcraft. 2 is a robust > solution with minimal impact (build time only). 3 is a more robust > solution for longevity, but higher impact potentially on code. On Sat, Dec 21, 2013 at 2:52 PM, Gunnar Morling <gu...@hi...>wrote: > Hi, > > Can you give some more details about the environment and project versions > you're using? > > Are you by any chance declaring a producer method for j.v.Validator? The > Validator bean contributed by Seam Validation (which you seem to be using) > is application scoped, so the validator should only be bootstrapped once. I > don't think it's an issue with Hibernate Validator itself but with the > integration into CDI and how it is configured. > > --Gunnar > > > > 2013/12/21 John D. Ament <joh...@gm...> > > John, >> >> Hibernate Validator should only be creating a validator factory once >> for the deployment. Hence, it should only be reading validation.xml >> at deployment time. The fact that you are seeing it multiple times is >> why I'm thinking its a validator issue (I don't reproduce this on >> mine, I'm on AS 7.1.1 w/ Validator 4.3.1). Hence why I'm curious what >> version you're on. Hibernate Validator is responsible for the >> instantiation of the validator factory. >> >> Also, I assumed (possibly foolishly) that your rest endpoint is >> annotated with a CDI or EJB qualifying annotation. Is that the case? >> >> Just as a heads up as well, the InjectingConstraintValidator was >> recently ported from Seam3 to DeltaSpike. The code is almost >> verbatim. >> >> On Sat, Dec 21, 2013 at 11:02 AM, John Franey <jjf...@gm...> wrote: >> > John, >> > >> > I'm excellent....thanks. You? >> > >> > Yes, this seems more like a question for weld/hibernate, than >> resteasy...but >> > I thought to start at the top :) >> > >> > Maybe I misunderstand injection, within the jax-rs environment, or in >> > general. I'm not sure which component drives the initialization of the >> > validator, I guess its weld. On the other hand, if I have a faulty >> > understanding of jax-rs integration with cdi, I could be inadvertently >> > causing multiple initializations. >> > >> > Thanks for the response. I posted a similar question to weld after you >> > implicitly confirmed my code is not at fault. >> > >> > John >> > >> > >> > >> > >> > >> > On Fri, Dec 20, 2013 at 6:50 PM, John D. Ament <joh...@gm...> >> > wrote: >> >> >> >> Hey John, >> >> >> >> How are you? >> >> >> >> It seems like your issue is more Hibernate Validator related. What >> >> version are you using? I don't see that message on the 4.3 branch or >> >> the 4.1 branch. >> >> >> >> - John >> >> >> >> On Fri, Dec 20, 2013 at 5:53 PM, John Franey <jjf...@gm...> >> wrote: >> >> > Hi, >> >> > >> >> > I have a resource that injects the validator, and the rest method >> >> > invokes >> >> > the validator. On every request, I see these entries in the log. >> That >> >> > is >> >> > 'Parsing XML based configuration by 4 on every request. Is that >> >> > reasonable? >> >> > If not, how do I workaround? >> >> > >> >> > 17:38:14,022 INFO >> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser] >> >> > (http-localhost/127.0.0.1:8080-1) HV000007: META-INF/validation.xml >> >> > found. >> >> > Parsing XML based configurati >> >> > on. >> >> > 17:38:14,027 INFO >> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser] >> >> > (http-localhost/127.0.0.1:8080-1) HV000003: Using >> >> > org.jboss.seam.validation.InjectingConstraintValidator >> >> > Factory as constraint factory. >> >> > 17:38:14,046 INFO >> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser] >> >> > (http-localhost/127.0.0.1:8080-1) HV000007: META-INF/validation.xml >> >> > found. >> >> > Parsing XML based configurati >> >> > on. >> >> > 17:38:14,051 INFO >> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser] >> >> > (http-localhost/127.0.0.1:8080-1) HV000003: Using >> >> > org.jboss.seam.validation.InjectingConstraintValidator >> >> > Factory as constraint factory. >> >> > 17:38:14,068 INFO >> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser] >> >> > (http-localhost/127.0.0.1:8080-1) HV000007: META-INF/validation.xml >> >> > found. >> >> > Parsing XML based configurati >> >> > on. >> >> > 17:38:14,073 INFO >> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser] >> >> > (http-localhost/127.0.0.1:8080-1) HV000003: Using >> >> > org.jboss.seam.validation.InjectingConstraintValidator >> >> > Factory as constraint factory. >> >> > 17:38:14,093 INFO >> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser] >> >> > (http-localhost/127.0.0.1:8080-1) HV000007: META-INF/validation.xml >> >> > found. >> >> > Parsing XML based configuration. >> >> > 17:38:14,099 INFO >> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser] >> >> > (http-localhost/127.0.0.1:8080-1) HV000003: Using >> >> > org.jboss.seam.validation.InjectingConstraintValidatorFactory as >> >> > constraint >> >> > factory. >> >> > >> >> > >> >> > >> >> > This is a simplification of my code: >> >> > >> >> > @Path(....) >> >> > public class MyResource { >> >> > >> >> > @Inject >> >> > private Validator validator; >> >> > >> >> > @PUT >> >> > public create(MyObject myObject) { >> >> > validator.validate(myObject); >> >> > } >> >> > } >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> ------------------------------------------------------------------------------ >> >> > Rapidly troubleshoot problems before they affect your business. Most >> IT >> >> > organizations don't have a clear picture of how application >> performance >> >> > affects their revenue. With AppDynamics, you get 100% visibility into >> >> > your >> >> > Java,.NET, & PHP application. Start your 15-day FREE TRIAL of >> >> > AppDynamics >> >> > Pro! >> >> > >> >> > >> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk >> >> > _______________________________________________ >> >> > Resteasy-users mailing list >> >> > Res...@li... >> >> > https://lists.sourceforge.net/lists/listinfo/resteasy-users >> >> > >> > >> > >> >> >> ------------------------------------------------------------------------------ >> Rapidly troubleshoot problems before they affect your business. Most IT >> organizations don't have a clear picture of how application performance >> affects their revenue. With AppDynamics, you get 100% visibility into your >> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics >> Pro! >> >> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk >> _______________________________________________ >> Resteasy-users mailing list >> Res...@li... >> https://lists.sourceforge.net/lists/listinfo/resteasy-users >> > > |
|
From: Gunnar M. <gu...@hi...> - 2013-12-21 19:52:55
|
Hi,
Can you give some more details about the environment and project versions
you're using?
Are you by any chance declaring a producer method for j.v.Validator? The
Validator bean contributed by Seam Validation (which you seem to be using)
is application scoped, so the validator should only be bootstrapped once. I
don't think it's an issue with Hibernate Validator itself but with the
integration into CDI and how it is configured.
--Gunnar
2013/12/21 John D. Ament <joh...@gm...>
> John,
>
> Hibernate Validator should only be creating a validator factory once
> for the deployment. Hence, it should only be reading validation.xml
> at deployment time. The fact that you are seeing it multiple times is
> why I'm thinking its a validator issue (I don't reproduce this on
> mine, I'm on AS 7.1.1 w/ Validator 4.3.1). Hence why I'm curious what
> version you're on. Hibernate Validator is responsible for the
> instantiation of the validator factory.
>
> Also, I assumed (possibly foolishly) that your rest endpoint is
> annotated with a CDI or EJB qualifying annotation. Is that the case?
>
> Just as a heads up as well, the InjectingConstraintValidator was
> recently ported from Seam3 to DeltaSpike. The code is almost
> verbatim.
>
> On Sat, Dec 21, 2013 at 11:02 AM, John Franey <jjf...@gm...> wrote:
> > John,
> >
> > I'm excellent....thanks. You?
> >
> > Yes, this seems more like a question for weld/hibernate, than
> resteasy...but
> > I thought to start at the top :)
> >
> > Maybe I misunderstand injection, within the jax-rs environment, or in
> > general. I'm not sure which component drives the initialization of the
> > validator, I guess its weld. On the other hand, if I have a faulty
> > understanding of jax-rs integration with cdi, I could be inadvertently
> > causing multiple initializations.
> >
> > Thanks for the response. I posted a similar question to weld after you
> > implicitly confirmed my code is not at fault.
> >
> > John
> >
> >
> >
> >
> >
> > On Fri, Dec 20, 2013 at 6:50 PM, John D. Ament <joh...@gm...>
> > wrote:
> >>
> >> Hey John,
> >>
> >> How are you?
> >>
> >> It seems like your issue is more Hibernate Validator related. What
> >> version are you using? I don't see that message on the 4.3 branch or
> >> the 4.1 branch.
> >>
> >> - John
> >>
> >> On Fri, Dec 20, 2013 at 5:53 PM, John Franey <jjf...@gm...>
> wrote:
> >> > Hi,
> >> >
> >> > I have a resource that injects the validator, and the rest method
> >> > invokes
> >> > the validator. On every request, I see these entries in the log.
> That
> >> > is
> >> > 'Parsing XML based configuration by 4 on every request. Is that
> >> > reasonable?
> >> > If not, how do I workaround?
> >> >
> >> > 17:38:14,022 INFO
> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
> >> > (http-localhost/127.0.0.1:8080-1) HV000007: META-INF/validation.xml
> >> > found.
> >> > Parsing XML based configurati
> >> > on.
> >> > 17:38:14,027 INFO
> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
> >> > (http-localhost/127.0.0.1:8080-1) HV000003: Using
> >> > org.jboss.seam.validation.InjectingConstraintValidator
> >> > Factory as constraint factory.
> >> > 17:38:14,046 INFO
> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
> >> > (http-localhost/127.0.0.1:8080-1) HV000007: META-INF/validation.xml
> >> > found.
> >> > Parsing XML based configurati
> >> > on.
> >> > 17:38:14,051 INFO
> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
> >> > (http-localhost/127.0.0.1:8080-1) HV000003: Using
> >> > org.jboss.seam.validation.InjectingConstraintValidator
> >> > Factory as constraint factory.
> >> > 17:38:14,068 INFO
> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
> >> > (http-localhost/127.0.0.1:8080-1) HV000007: META-INF/validation.xml
> >> > found.
> >> > Parsing XML based configurati
> >> > on.
> >> > 17:38:14,073 INFO
> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
> >> > (http-localhost/127.0.0.1:8080-1) HV000003: Using
> >> > org.jboss.seam.validation.InjectingConstraintValidator
> >> > Factory as constraint factory.
> >> > 17:38:14,093 INFO
> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
> >> > (http-localhost/127.0.0.1:8080-1) HV000007: META-INF/validation.xml
> >> > found.
> >> > Parsing XML based configuration.
> >> > 17:38:14,099 INFO
> >> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
> >> > (http-localhost/127.0.0.1:8080-1) HV000003: Using
> >> > org.jboss.seam.validation.InjectingConstraintValidatorFactory as
> >> > constraint
> >> > factory.
> >> >
> >> >
> >> >
> >> > This is a simplification of my code:
> >> >
> >> > @Path(....)
> >> > public class MyResource {
> >> >
> >> > @Inject
> >> > private Validator validator;
> >> >
> >> > @PUT
> >> > public create(MyObject myObject) {
> >> > validator.validate(myObject);
> >> > }
> >> > }
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> ------------------------------------------------------------------------------
> >> > Rapidly troubleshoot problems before they affect your business. Most
> IT
> >> > organizations don't have a clear picture of how application
> performance
> >> > affects their revenue. With AppDynamics, you get 100% visibility into
> >> > your
> >> > Java,.NET, & PHP application. Start your 15-day FREE TRIAL of
> >> > AppDynamics
> >> > Pro!
> >> >
> >> >
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> >> > _______________________________________________
> >> > Resteasy-users mailing list
> >> > Res...@li...
> >> > https://lists.sourceforge.net/lists/listinfo/resteasy-users
> >> >
> >
> >
>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
> Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> _______________________________________________
> Resteasy-users mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>
|
|
From: John D. A. <joh...@gm...> - 2013-12-21 16:14:52
|
John,
Hibernate Validator should only be creating a validator factory once
for the deployment. Hence, it should only be reading validation.xml
at deployment time. The fact that you are seeing it multiple times is
why I'm thinking its a validator issue (I don't reproduce this on
mine, I'm on AS 7.1.1 w/ Validator 4.3.1). Hence why I'm curious what
version you're on. Hibernate Validator is responsible for the
instantiation of the validator factory.
Also, I assumed (possibly foolishly) that your rest endpoint is
annotated with a CDI or EJB qualifying annotation. Is that the case?
Just as a heads up as well, the InjectingConstraintValidator was
recently ported from Seam3 to DeltaSpike. The code is almost
verbatim.
On Sat, Dec 21, 2013 at 11:02 AM, John Franey <jjf...@gm...> wrote:
> John,
>
> I'm excellent....thanks. You?
>
> Yes, this seems more like a question for weld/hibernate, than resteasy...but
> I thought to start at the top :)
>
> Maybe I misunderstand injection, within the jax-rs environment, or in
> general. I'm not sure which component drives the initialization of the
> validator, I guess its weld. On the other hand, if I have a faulty
> understanding of jax-rs integration with cdi, I could be inadvertently
> causing multiple initializations.
>
> Thanks for the response. I posted a similar question to weld after you
> implicitly confirmed my code is not at fault.
>
> John
>
>
>
>
>
> On Fri, Dec 20, 2013 at 6:50 PM, John D. Ament <joh...@gm...>
> wrote:
>>
>> Hey John,
>>
>> How are you?
>>
>> It seems like your issue is more Hibernate Validator related. What
>> version are you using? I don't see that message on the 4.3 branch or
>> the 4.1 branch.
>>
>> - John
>>
>> On Fri, Dec 20, 2013 at 5:53 PM, John Franey <jjf...@gm...> wrote:
>> > Hi,
>> >
>> > I have a resource that injects the validator, and the rest method
>> > invokes
>> > the validator. On every request, I see these entries in the log. That
>> > is
>> > 'Parsing XML based configuration by 4 on every request. Is that
>> > reasonable?
>> > If not, how do I workaround?
>> >
>> > 17:38:14,022 INFO
>> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
>> > (http-localhost/127.0.0.1:8080-1) HV000007: META-INF/validation.xml
>> > found.
>> > Parsing XML based configurati
>> > on.
>> > 17:38:14,027 INFO
>> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
>> > (http-localhost/127.0.0.1:8080-1) HV000003: Using
>> > org.jboss.seam.validation.InjectingConstraintValidator
>> > Factory as constraint factory.
>> > 17:38:14,046 INFO
>> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
>> > (http-localhost/127.0.0.1:8080-1) HV000007: META-INF/validation.xml
>> > found.
>> > Parsing XML based configurati
>> > on.
>> > 17:38:14,051 INFO
>> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
>> > (http-localhost/127.0.0.1:8080-1) HV000003: Using
>> > org.jboss.seam.validation.InjectingConstraintValidator
>> > Factory as constraint factory.
>> > 17:38:14,068 INFO
>> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
>> > (http-localhost/127.0.0.1:8080-1) HV000007: META-INF/validation.xml
>> > found.
>> > Parsing XML based configurati
>> > on.
>> > 17:38:14,073 INFO
>> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
>> > (http-localhost/127.0.0.1:8080-1) HV000003: Using
>> > org.jboss.seam.validation.InjectingConstraintValidator
>> > Factory as constraint factory.
>> > 17:38:14,093 INFO
>> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
>> > (http-localhost/127.0.0.1:8080-1) HV000007: META-INF/validation.xml
>> > found.
>> > Parsing XML based configuration.
>> > 17:38:14,099 INFO
>> > [org.hibernate.validator.internal.xml.ValidationXmlParser]
>> > (http-localhost/127.0.0.1:8080-1) HV000003: Using
>> > org.jboss.seam.validation.InjectingConstraintValidatorFactory as
>> > constraint
>> > factory.
>> >
>> >
>> >
>> > This is a simplification of my code:
>> >
>> > @Path(....)
>> > public class MyResource {
>> >
>> > @Inject
>> > private Validator validator;
>> >
>> > @PUT
>> > public create(MyObject myObject) {
>> > validator.validate(myObject);
>> > }
>> > }
>> >
>> >
>> >
>> >
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Rapidly troubleshoot problems before they affect your business. Most IT
>> > organizations don't have a clear picture of how application performance
>> > affects their revenue. With AppDynamics, you get 100% visibility into
>> > your
>> > Java,.NET, & PHP application. Start your 15-day FREE TRIAL of
>> > AppDynamics
>> > Pro!
>> >
>> > http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
>> > _______________________________________________
>> > Resteasy-users mailing list
>> > Res...@li...
>> > https://lists.sourceforge.net/lists/listinfo/resteasy-users
>> >
>
>
|