Hi Bruce,

You must remove your @GET annotation from the method.
A @GET, @POST, @PUT etc. annotation is marking the method as returning the response to the client. In your case you want to delegate the request to another object - you don't want to rite directly to the client from this method. To delegate a request you must use the annotation @Path without any @GET, @POST or @PUT (or other HTTP method annotation) This way the request is redirected to the jax-rs sub resources and this resource can use @GET or @PUT or @POST if he want to end redirections and respond to client.

So:

1. @GET with @Path is handling the get request without redirection (the object returned by the method is serialized and sent to the client)
2. @GET without path is doing the same as 1. but on the current path.
3. @Path without @GET or other method annotation is redirecting the request to another object.

Bogdan



On 8 sept. 09, at 14:43, Bruce Grant wrote:

Hello,

Another webengine syntax question

I have a site called testapp (which maps to a Main module) and and a Document type called ChallengePost (which has an underlying webobject called ChallengeWebObject). The home page of this simple site renders using the default index.ftl. From this simple page I want to force creation of the ChallengePost document using the create.ftl in the views\ChallengePost directory. I don't want the @views/create to use the default views\Document which is the default.

If I use "http://localhost:8080/nuxeo/site/testapp/repository/@views/create " the default views\Document\create.ftl is rendered and I can create a document of the type ChallengePost. The "repository" path returns a document root.

What is the URL syntax to force re-direction to the views \ChallengePost\create.ftl?

Is there some syntax like "http://localhost:8080/nuxeo/site/testapp/@views/ChallengePost/create " or do i need to return a document context in order to have create mapped to the right create/ftl?

As an alternative, I have tried the following code snippet from my main module mapped to the path "challengepost"

  @GET
  @Path("challengepost")
  public Object createChallengePost() throws Exception {
PathRef pathRef = new PathRef("/default-domain/sections/ bruce/");
      DocumentModel doc = ctx.getCoreSession().getDocument(pathRef);
      return (ChallengeWebObject) ctx.newObject("ChallengePost", doc);
  }

And then used the URL "http://localhost:8080/nuxeo/site/testapp/challengepost ", but that generates an error

10:04:41,272 ERROR [SynchronousDispatcher] Failed executing GET / testapp/challengepost org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type: ca.metalogic.prototype.ChallengeWebObject of media type: text/ html;charset=UTF-8 at org .jboss .resteasy .core .DispatcherUtilities.resolveResponseInvoker(DispatcherUtilities.java: 114) at org .jboss .resteasy .core .SynchronousDispatcher.writeJaxrsResponse(SynchronousDispatcher.java: 401)

Do i have to create my own writer for my own objects?

Thanks,
Bruce._______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Reply via email to