Re: [Resteasy-users] Newbie question REST

2013-01-03 Thread Weinan Li


-- 
Weinan Li



On Wednesday, January 2, 2013 at 10:45 PM, Bill Burke wrote:

 
 
 On 12/21/2012 4:12 PM, Skriloff, Nicholas wrote:
  I have three questions
  
  1) I want to see all the restful urls available when I start up EAP6 in
  the server.log file. How do I configure standalone.xml logging to show
  the rest easy services that are exposed and their paths?
  
 
 
 Resteasy does not have that capability. It only specifies which 
 classes have been deployed at deploy time.
 
  2) Should I upgrade to latest RESTeasy eventhough I am presently running
  EAP6 unmodified to get the lastest and greatest?
  
 
 
 Weinan made a good suggestion. Read the release notes and see if its 
 worth upgrading. But, future 2.3.x releases will probably only be done 
 within EAP. We're fully focused on 3.x now.
 
 


Bill, does that mean I could just submit patches to trunk and no need to patch 
Branch_2_3 from now on?
 
 
  3)
  
  I develop a registrar system for students to enroll into classes. One
  of the war files is registrar-student.war. I am trying to expose my
  first RESTeasy webservice. I am running EAP6, which runs resteasy 2.3.3 .
  
  I have an ejb that does code table lookups and I figured that is as good
  as place as any to start.
  
  So, I put this class in the app
  
  import javax.ws.rs.ApplicationPath;
  
  import javax.ws.rs.core.Application;
  
  @ApplicationPath(/registrarWebservices)
  
  public class RegistrarWebServicesApplication extends Application {
  
  //public class RegistrarWebServicesApplication {
  
  }
  
  I first tried adding the code below to the interface. I got the below
  error. I added the same code directly to the ejb. I got the same below
  error.
  
  @Path(/codetables)
  
  public class UncheckedCodeTablesBean implements SessionBean,
  UncheckedCodeTablesMethods {
  
 
 
 The error is what it says. You can only apply JAX-RS @PATH and method 
 annotations (@GET, etc.) to a local interface or no-interface EJB class.
 
 So, move your @Path and @GET, @Produces annotatiosn to your 
 UncheckedCodeTablesMethods interface, or make the bean a no-interface 
 bean class.
 
 Also, your EJB is very old school :) Try EJB3.x annotations?
 
 @Stateless
 public class UncheckedCodeTablesBean implements 
 UncheckedCodeTablesMethods {}
 
 
 Or even, just remove the interface entirely and just write a class.
 
 And ditch your XML of course :)
 
 -- 
 Bill Burke
 JBoss, a division of Red Hat
 http://bill.burkecentral.com
 
 --
 Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
 and much more. Keep your Java skills current with LearnJavaNow -
 200+ hours of step-by-step video tutorials by Java experts.
 SALE $49.99 this month only -- learn more at:
 http://p.sf.net/sfu/learnmore_122612 
 ___
 Resteasy-users mailing list
 Resteasy-users@lists.sourceforge.net 
 (mailto:Resteasy-users@lists.sourceforge.net)
 https://lists.sourceforge.net/lists/listinfo/resteasy-users
 
 


--
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812___
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users


Re: [Resteasy-users] Newbie question REST

2012-12-27 Thread Weinan Li


--  
Weinan Li



On Saturday, December 22, 2012 at 5:12 AM, Skriloff, Nicholas wrote:

 I have three questions
 1) I want to see all the restful urls available when I start up EAP6 in the 
 server.log file.  How do I configure standalone.xml logging to show the rest 
 easy services that are exposed and their paths?
  
  
  


JBoss AS = 7.1.1 does not support per deployment logger yet:

http://stackoverflow.com/questions/9584787/using-log4j-with-jboss-7-1
https://issues.jboss.org/browse/AS7-514
https://docs.jboss.org/author/display/AS72/Logging+Configuration

From 7.1.2.Final it will be supported.

Before that, you could config logger in standalone.xml:

subsystem xmlns=urn:jboss:domain:logging:1.1
console-handler name=CONSOLE
level name=DEBUG/

…
/console-handler

root-logger
level name=DEBUG/

…
/root-logger

/subsystem


Switch the global setting to DEBUG and then you could get the RESTEasy debug 
output:

01:06:40,358 FINE  [org.jboss.resteasy.core.SynchronousDispatcher] 
(http--127.0.0.1-8080-1) PathInfo: /hello
  
  
 2) Should I upgrade to latest RESTeasy eventhough I am presently running EAP6 
 unmodified to get the lastest and greatest?
  
  
  

Newer version of 2.3.x has many bug fixes and big rewrite on multipart-provider 
with better UTF-8 encoding support, and also better RESTEasy JS-API. But unless 
you do need these features, I don't think there will be a hurry to do upgrade 
:-)

Here is the release note: 
https://issues.jboss.org/secure/ReleaseNote.jspa?version=12319570styleName=TextprojectId=12310560Create=Createatl_token=AQZJ-FV3A-N91S-UDEU%7C9456607655245d442065b6eec890daa6689d2992%7Clout

If you do want to patch AS7 to do upgrade manually, in RESTEasy doc you will 
learn how to do it:

Resteasy is bundled with JBoss AS 7. You will likely have the need to upgrade 
Resteasy in AS7. The Resteasy distribution comes with a zip file called 
resteasy-jboss-modules-2.3.4.Final.zip. In the top level directory of JBoss AS 
7 (the one with the modules/ directory), unzip this file. You should be patched 
with the latest and greatest Resteasy after this.

 3)  
 I develop a registrar system for students to enroll into classes.  One of the 
 war files is registrar-student.war.   I am trying to expose my first RESTeasy 
 webservice.   I am running EAP6, which runs resteasy 2.3.3 .  
  
  
  


For this problem, could you please help to create a small demo app that could 
reproduce your problem? I could help to analyse it if there is a project to 
work on.  
  
 I have an ejb that does code table lookups and I figured that is as good as 
 place as any to start.  
   
 So, I put this class in the app
   
 import javax.ws.rs.ApplicationPath;
 import javax.ws.rs.core.Application;
   
 @ApplicationPath(/registrarWebservices)
 public class RegistrarWebServicesApplication extends Application {
 //public class RegistrarWebServicesApplication  {
 }
   
 I first tried adding the code below to the interface.  I got the below error. 
  I added the same code directly to the ejb.  I got the same below error.  
   
 @Path(/codetables)
 public class UncheckedCodeTablesBean implements SessionBean, 
 UncheckedCodeTablesMethods {
 ...
 @GET
 @Produces(application/xml)
   
 public ActionRolesData[] getActionRoles() throws SystemException {
   
 Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: 
 JBAS011234: JAX-RS resource edu.darden.regi
 strar.session.unchecked.UncheckedCodeTablesBean does not correspond to a view 
 on the EJB UncheckedCodeTables. @Path anno
 tations can only be placed on classes or interfaces that represent a local, 
 remote or no-interface view of an EJB.
 at 
 org.jboss.as.jaxrs.deployment.JaxrsComponentDeployer.deploy(JaxrsComponentDeployer.java:81)
   
 What am I doing wrong?  
   
   
 Sincerely,
 Nick Skriloff , ME , MCP, SCJP
 Information Technology Specialist
 Darden Information Services
 Voice 434 243 5025  Fax 434 243 2279
 skrilo...@darden.virginia.edu (mailto:skrilo...@darden.virginia.edu)
   
  
  
 --
 LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
 Remotely access PCs and mobile devices and provide instant support
 Improve your efficiency, and focus on delivering more value-add services
 Discover what IT Professionals Know. Rescue delivers
 http://p.sf.net/sfu/logmein_12329d2d
  
 ___
 Resteasy-users mailing list
 Resteasy-users@lists.sourceforge.net 
 (mailto:Resteasy-users@lists.sourceforge.net)
 https://lists.sourceforge.net/lists/listinfo/resteasy-users
  
  


--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 

[Resteasy-users] Newbie question REST

2012-12-21 Thread Skriloff, Nicholas
I have three questions

1) I want to see all the restful urls available when I start up EAP6 in the 
server.log file.  How do I configure standalone.xml logging to show the rest 
easy services that are exposed and their paths?

2) Should I upgrade to latest RESTeasy eventhough I am presently running EAP6 
unmodified to get the lastest and greatest?

3)

I develop a registrar system for students to enroll into classes.  One of the 
war files is registrar-student.war.   I am trying to expose my first RESTeasy 
webservice.   I am running EAP6, which runs resteasy 2.3.3 .

I have an ejb that does code table lookups and I figured that is as good as 
place as any to start.



So, I put this class in the app



import javax.ws.rs.ApplicationPath;

import javax.ws.rs.core.Application;



@ApplicationPath(/registrarWebservices)

public class RegistrarWebServicesApplication extends Application {

//public class RegistrarWebServicesApplication  {

}



I first tried adding the code below to the interface.  I got the below error.  
I added the same code directly to the ejb.  I got the same below error.



@Path(/codetables)

public class UncheckedCodeTablesBean implements SessionBean, 
UncheckedCodeTablesMethods {

...

@GET

@Produces(application/xml)



public ActionRolesData[] getActionRoles() throws SystemException {



Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: 
JBAS011234: JAX-RS resource edu.darden.regi

strar.session.unchecked.UncheckedCodeTablesBean does not correspond to a view 
on the EJB UncheckedCodeTables. @Path anno

tations can only be placed on classes or interfaces that represent a local, 
remote or no-interface view of an EJB.

at 
org.jboss.as.jaxrs.deployment.JaxrsComponentDeployer.deploy(JaxrsComponentDeployer.java:81)



What am I doing wrong?



Sincerely,
Nick Skriloff , ME , MCP, SCJP
Information Technology Specialist
Darden Information Services
Voice 434 243 5025  Fax 434 243 2279
skrilo...@darden.virginia.edu

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d___
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users