can't access jax-rs resource in gae

7 messages Options
Embed this post
Permalink
Michael Mogley

can't access jax-rs resource in gae

Reply Threaded More More options
Print post
Permalink
I've followed the example in "First Steps" for GAE and can't seem to access the resource from the browser.

I'm running:
- latest snapshot build for gae (as of 10/25/09)
- AppEngine 1.2.6
- Eclipse 3.5

I've attached the relevant files.

Any help greatly appreciated!

Michael
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        version="2.5"
>
        <display-name>TestApp</display-name>
        <!-- Application class name -->
        <context-param>
                <param-name>org.restlet.application</param-name>
                <param-value>testapp.rest.DefaultApplication</param-value>
        </context-param>

        <!-- Restlet adapter -->
        <servlet>
                <servlet-name>RestletServlet</servlet-name>
                <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
        </servlet>

        <!-- Catch all requests -->
        <servlet-mapping>
                <servlet-name>RestletServlet</servlet-name>
                <url-pattern>/rest/*</url-pattern>
        </servlet-mapping>
</web-app>

package testapp.rest;

import javax.ws.rs.Path;

import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;

@Path("test")
public class TestResource extends ServerResource
{
  @Get @Path("hello")
  public String represent()
  {
    return "hello";
  }
}

package testapp.rest;

import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.core.Application;

public class RestConfig extends Application
{
  public Set<Class<?>> getClasses()
  {
    Set<Class<?>> restResources = new HashSet<Class<?>>();
    restResources.add(TestResource.class);

    return restResources;
  }
}

package testapp.rest;

import org.restlet.Context;
import org.restlet.ext.jaxrs.JaxRsApplication;

public class DefaultApplication extends JaxRsApplication
{
  public DefaultApplication(Context context)
  {
    super(context);
    this.add(new RestConfig());
  }

}
StephanKoo

Re: can't access jax-rs resource in gae

Reply Threaded More More options
Print post
Permalink
what URI do you called?

best regards
  Stephan

Michael Mogley schrieb:

> I've followed the example in "First Steps" for GAE and can't seem to access the resource from the browser.
>
> I'm running:
> - latest snapshot build for gae (as of 10/25/09)
> - AppEngine 1.2.6
> - Eclipse 3.5
>
> I've attached the relevant files.
>
> Any help greatly appreciated!
>
> Michael

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412216
Michael Mogley

Re: can't access jax-rs resource in gae

Reply Threaded More More options
Print post
Permalink
I'm just testing locally for now (using the Google Eclipse plugin's Web-App.  My URI is http://localhost:8080/rest/test/hello.  In the console, I get back:

Oct 28, 2009 7:01:32 PM org.restlet.engine.http.HttpServerAdapter commit
WARNING: A response with an unavailable entity was returned. Ignoring the entity for resource "http://localhost:8080/rest/test/hello".

On Wed, Oct 28, 2009 at 11:54 AM, Stephan Koops <[hidden email]> wrote:
what URI do you called?

best regards
 Stephan

Michael Mogley schrieb:
> I've followed the example in "First Steps" for GAE and can't seem to access the resource from the browser.
>
> I'm running:
> - latest snapshot build for gae (as of 10/25/09)
> - AppEngine 1.2.6
> - Eclipse 3.5
>
> I've attached the relevant files.
>
> Any help greatly appreciated!
>
> Michael

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412216



--
Michael Mogley, Software Architect
Wirefree Thought LLC
310-756-7074
StephanKoo

Re: can't access jax-rs resource in gae

Reply Threaded More More options
Print post
Permalink
Hi Michael,

ok, than you accessed the resource, but no entity is available in the
Response.
Now I've seen that you mixed the API of JAX-RS and annotation based
Restlet. For JAX-RS you shouldn't inherit from class ServerResource. And
you must use the @GET from JAX-RS, not the @Get from Restlet.

best regards
   Stephan

Michael Mogley schrieb:

> I'm just testing locally for now (using the Google Eclipse plugin's
> Web-App.  My URI is http://localhost:8080/rest/test/hello.  In the
> console, I get back:
>
> Oct 28, 2009 7:01:32 PM org.restlet.engine.http.HttpServerAdapter commit
> WARNING: A response with an unavailable entity was returned. Ignoring
> the entity for resource "http://localhost:8080/rest/test/hello".
>
> On Wed, Oct 28, 2009 at 11:54 AM, Stephan Koops <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     what URI do you called?
>
>     best regards
>      Stephan
>
>     Michael Mogley schrieb:
>     > I've followed the example in "First Steps" for GAE and can't
>     seem to access the resource from the browser.
>     >
>     > I'm running:
>     > - latest snapshot build for gae (as of 10/25/09)
>     > - AppEngine 1.2.6
>     > - Eclipse 3.5
>     >
>     > I've attached the relevant files.
>     >
>     > Any help greatly appreciated!
>     >
>     > Michael
>
>     ------------------------------------------------------
>     http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412216
>     <http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412216>
>
>
>
>
> --
> Michael Mogley, Software Architect
> Wirefree Thought LLC
> 310-756-7074

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412234
Michael Mogley

Re: can't access jax-rs resource in gae

Reply Threaded More More options
Print post
Permalink
Ah. Thank you thank you. I'll try it out with the correct annotation  
classes!

Sent from my iPhone

On Oct 28, 2009, at 12:41 PM, Stephan Koops <[hidden email]>  
wrote:

> Hi Michael,
>
> ok, than you accessed the resource, but no entity is available in the
> Response.
> Now I've seen that you mixed the API of JAX-RS and annotation based
> Restlet. For JAX-RS you shouldn't inherit from class ServerResource.  
> And
> you must use the @GET from JAX-RS, not the @Get from Restlet.
>
> best regards
>   Stephan
>
> Michael Mogley schrieb:
>> I'm just testing locally for now (using the Google Eclipse plugin's
>> Web-App.  My URI is http://localhost:8080/rest/test/hello.  In the
>> console, I get back:
>>
>> Oct 28, 2009 7:01:32 PM org.restlet.engine.http.HttpServerAdapter  
>> commit
>> WARNING: A response with an unavailable entity was returned. Ignoring
>> the entity for resource "http://localhost:8080/rest/test/hello".
>>
>> On Wed, Oct 28, 2009 at 11:54 AM, Stephan Koops <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>>    what URI do you called?
>>
>>    best regards
>>     Stephan
>>
>>    Michael Mogley schrieb:
>>> I've followed the example in "First Steps" for GAE and can't
>>    seem to access the resource from the browser.
>>>
>>> I'm running:
>>> - latest snapshot build for gae (as of 10/25/09)
>>> - AppEngine 1.2.6
>>> - Eclipse 3.5
>>>
>>> I've attached the relevant files.
>>>
>>> Any help greatly appreciated!
>>>
>>> Michael
>>
>>    ------------------------------------------------------
>>    http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412216
>>    <http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412216 
>> >
>>
>>
>>
>>
>> --
>> Michael Mogley, Software Architect
>> Wirefree Thought LLC
>> 310-756-7074
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412234

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412237
jlouvel

RE: can't access jax-rs resource in gae

Reply Threaded More More options
Print post
Permalink
Hi Michael,

In addition, I've also updated our documentation on Restlet edition for GAE
in the wiki as it was referring to some outdated materials. For example you
can leverage a simpler way to configure the ServerServlet:
http://wiki.restlet.org/docs_2.0/13-restlet/275-restlet/252-restlet.html

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com



-----Message d'origine-----
De : Michael Mogley [mailto:[hidden email]]
Envoyé : mercredi 28 octobre 2009 20:52
À : [hidden email]
Objet : Re: can't access jax-rs resource in gae

Ah. Thank you thank you. I'll try it out with the correct annotation  
classes!

Sent from my iPhone

On Oct 28, 2009, at 12:41 PM, Stephan Koops <[hidden email]>  
wrote:

> Hi Michael,
>
> ok, than you accessed the resource, but no entity is available in the
> Response.
> Now I've seen that you mixed the API of JAX-RS and annotation based
> Restlet. For JAX-RS you shouldn't inherit from class ServerResource.  
> And
> you must use the @GET from JAX-RS, not the @Get from Restlet.
>
> best regards
>   Stephan
>
> Michael Mogley schrieb:
>> I'm just testing locally for now (using the Google Eclipse plugin's
>> Web-App.  My URI is http://localhost:8080/rest/test/hello.  In the
>> console, I get back:
>>
>> Oct 28, 2009 7:01:32 PM org.restlet.engine.http.HttpServerAdapter  
>> commit
>> WARNING: A response with an unavailable entity was returned. Ignoring
>> the entity for resource "http://localhost:8080/rest/test/hello".
>>
>> On Wed, Oct 28, 2009 at 11:54 AM, Stephan Koops <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>>    what URI do you called?
>>
>>    best regards
>>     Stephan
>>
>>    Michael Mogley schrieb:
>>> I've followed the example in "First Steps" for GAE and can't
>>    seem to access the resource from the browser.
>>>
>>> I'm running:
>>> - latest snapshot build for gae (as of 10/25/09)
>>> - AppEngine 1.2.6
>>> - Eclipse 3.5
>>>
>>> I've attached the relevant files.
>>>
>>> Any help greatly appreciated!
>>>
>>> Michael
>>
>>    ------------------------------------------------------
>>
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=24122
16
>>
<http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412
216

>> >
>>
>>
>>
>>
>> --
>> Michael Mogley, Software Architect
>> Wirefree Thought LLC
>> 310-756-7074
>
> ------------------------------------------------------
>
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=24122
34

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=24122
37

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412481
Michael Mogley

Re: can't access jax-rs resource in gae

Reply Threaded More More options
Print post
Permalink
In reply to this post by Michael Mogley
Thanks, Jerome.

On Thu, Oct 29, 2009 at 1:56 AM, Jerome Louvel <[hidden email]> wrote:
Hi Michael,

In addition, I've also updated our documentation on Restlet edition for GAE
in the wiki as it was referring to some outdated materials. For example you
can leverage a simpler way to configure the ServerServlet:
http://wiki.restlet.org/docs_2.0/13-restlet/275-restlet/252-restlet.html

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com



-----Message d'origine-----
De : Michael Mogley [mailto:[hidden email]]
Envoyé : mercredi 28 octobre 2009 20:52
À : [hidden email]
Objet : Re: can't access jax-rs resource in gae

Ah. Thank you thank you. I'll try it out with the correct annotation
classes!

Sent from my iPhone

On Oct 28, 2009, at 12:41 PM, Stephan Koops <[hidden email]>
wrote:

> Hi Michael,
>
> ok, than you accessed the resource, but no entity is available in the
> Response.
> Now I've seen that you mixed the API of JAX-RS and annotation based
> Restlet. For JAX-RS you shouldn't inherit from class ServerResource.
> And
> you must use the @GET from JAX-RS, not the @Get from Restlet.
>
> best regards
>   Stephan
>
> Michael Mogley schrieb:
>> I'm just testing locally for now (using the Google Eclipse plugin's
>> Web-App.  My URI is http://localhost:8080/rest/test/hello.  In the
>> console, I get back:
>>
>> Oct 28, 2009 7:01:32 PM org.restlet.engine.http.HttpServerAdapter
>> commit
>> WARNING: A response with an unavailable entity was returned. Ignoring
>> the entity for resource "http://localhost:8080/rest/test/hello".
>>
>> On Wed, Oct 28, 2009 at 11:54 AM, Stephan Koops <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>>    what URI do you called?
>>
>>    best regards
>>     Stephan
>>
>>    Michael Mogley schrieb:
>>> I've followed the example in "First Steps" for GAE and can't
>>    seem to access the resource from the browser.
>>>
>>> I'm running:
>>> - latest snapshot build for gae (as of 10/25/09)
>>> - AppEngine 1.2.6
>>> - Eclipse 3.5
>>>
>>> I've attached the relevant files.
>>>
>>> Any help greatly appreciated!
>>>
>>> Michael
>>
>>    ------------------------------------------------------
>>
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=24122
16
>>
<http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412
216
>> >
>>
>>
>>
>>
>> --
>> Michael Mogley, Software Architect
>> Wirefree Thought LLC
>> 310-756-7074
>
> ------------------------------------------------------
>
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=24122
34

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=24122
37

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412481



--
Michael Mogley, Software Architect
Wirefree Thought LLC