I have created a standalone application using NettyJaxrsServer. In one
scenario I want to get the IP of the request coming to the server. How do
to do that.?
I have the pom here with dependency
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-netty</artifactId>
<version>3.0.10.Final</version></dependency>
I have created the NettyJaxrsServer using the following code.
public void createServer()
{
server = new NettyJaxrsServer();
server.setDeployment(getDeployment());
server.setPort(configuration.getPort());
server.setSecurityDomain(null);
server.setRootResourcePath(configuration.getResourceRootPath());
}
public ResteasyDeployment getDeployment() {
final ResteasyDeployment dp = new ResteasyDeployment();
final Collection<Object> controllers = new ArrayList<Object>();
controllers.add(ctx.getBean(TestIP.class));
dp.getResources().addAll(controllers);
return dp;}
and my webservice class
@Path("/test")@Componentpublic class TestIP {
@GET
@Path("/pingIp")
@Produces(MediaType.APPLICATION_JSON)
public String getAd( @Context HttpServletRequest servletRequest) {
return servletRequest.getRemoteAddr();
}
}
while Encountering servletRequest.getRemoteAddr(); it throws the
org.jboss.resteasy.spi.LoggableFailure Exception. Please some body healp me
to find out what I am doing wrong here. Thanks in advance..!
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users