Re: RESTful URL with GWT

2009-01-20 Thread Fangzx

hi, Harald, why you don't just use RPC with Spring? Any goodies to add
Restlet and RESTful with GWT?

On 1月15日, 下午4时01分, Harald Pehl harald.p...@googlemail.com wrote:
 On 14 Jan., 02:44, zhouxing fang fangzhoux...@gmail.com wrote:

  hi,Harald,can you give more detail of your project? Is it possible to use
  RESTful service with Ext-GWT?

 We're using the following architecture / frameworks:
 1. Server: Restlet  Spring
 2. Client: Restlet-GWT module  GXT (http://extjs.com/products/gxt/)

 A typical request / response could be something like that (assuming
 that we're using XML):

 Client / UserService.java:
 public class UserService
 {
 public void getUsers()
 {
 new Client(Protocol.HTTP).get(http://server/users; new
 Callback()
 {
 public void onEvent(Request request, Response response)
 {
 XmlRepresentation xmlRepresentation =
 response.getEntityAsXml();
 Document doc = xmlRepresentation.getDocument();
 [parse XML]
 }
 });
 }

 }

 Server / UsersResource.java (registered to handle http://server/
 users):
 public class UsersResource extends Resource
 {
 public void UsersResource(Context context, Request request,
 Response response)
 {
 super(context, request, response);
 getVariants().add(new Variant(MediaType.TEXT_XML));
 }

 public Representation represent(Variant variant) throws
 ResourceException
 {
 Representation result = new DomRepresentation
 (diaType.TEXT_XML);
 Document doc = rep.getDocument();
 [Populate doc with users...]
 return result;

 }

 At the client side we parse the XML and turn it into ModelData
 instances so we can use them in the GXT widgets.
 In case of POST or PUT requests, we use forms at the client side and
 the Spring validation framework on the server side to validate and
 convert the form into POJOs.

 I'm not that familiar with GWT-EXT, but as they are very similiar in
 turn of classes / concepts, you should be able to use a similar
 approach.

 There's a preety good example of the Restlet-GWT module available 
 at:http://wiki.restlet.org/docs_1.1/13-restlet/144-restlet/188-restlet.html

 Hope that helps!

 Greetings
 Harald
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: RESTful URL with GWT

2009-01-20 Thread Harald Pehl

Hi Fangzx,

As the GWT client is not the only one for our server-side application,
we have to offer a common interface based on XML/HTTP. Therefore Rest
is IMHO the best solution.

Greetings Harald

On 20 Jan., 11:29, Fangzx fangzhoux...@gmail.com wrote:
 hi, Harald, why you don't just use RPC with Spring? Any goodies to add
 Restlet and RESTful with GWT?

 On 1月15日, 下午4时01分, Harald Pehl harald.p...@googlemail.com wrote:



  On 14 Jan., 02:44, zhouxing fang fangzhoux...@gmail.com wrote:

   hi,Harald,can you give more detail of your project? Is it possible to use
   RESTful service with Ext-GWT?

  We're using the following architecture / frameworks:
  1. Server: Restlet  Spring
  2. Client: Restlet-GWT module  GXT (http://extjs.com/products/gxt/)

  A typical request / response could be something like that (assuming
  that we're using XML):

  Client / UserService.java:
  public class UserService
  {
  public void getUsers()
  {
  new Client(Protocol.HTTP).get(http://server/users; new
  Callback()
  {
  public void onEvent(Request request, Response response)
  {
  XmlRepresentation xmlRepresentation =
  response.getEntityAsXml();
  Document doc = xmlRepresentation.getDocument();
  [parse XML]
  }
  });
  }

  }

  Server / UsersResource.java (registered to handle http://server/
  users):
  public class UsersResource extends Resource
  {
  public void UsersResource(Context context, Request request,
  Response response)
  {
  super(context, request, response);
  getVariants().add(new Variant(MediaType.TEXT_XML));
  }

  public Representation represent(Variant variant) throws
  ResourceException
  {
  Representation result = new DomRepresentation
  (diaType.TEXT_XML);
  Document doc = rep.getDocument();
  [Populate doc with users...]
  return result;

  }

  At the client side we parse the XML and turn it into ModelData
  instances so we can use them in the GXT widgets.
  In case of POST or PUT requests, we use forms at the client side and
  the Spring validation framework on the server side to validate and
  convert the form into POJOs.

  I'm not that familiar with GWT-EXT, but as they are very similiar in
  turn of classes / concepts, you should be able to use a similar
  approach.

  There's a preety good example of the Restlet-GWT module available 
  at:http://wiki.restlet.org/docs_1.1/13-restlet/144-restlet/188-restlet.html

  Hope that helps!

  Greetings
  Harald
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: RESTful URL with GWT

2009-01-15 Thread Harald Pehl

On 14 Jan., 02:44, zhouxing fang fangzhoux...@gmail.com wrote:
 hi,Harald,can you give more detail of your project? Is it possible to use
 RESTful service with Ext-GWT?

We're using the following architecture / frameworks:
1. Server: Restlet  Spring
2. Client: Restlet-GWT module  GXT (http://extjs.com/products/gxt/)


A typical request / response could be something like that (assuming
that we're using XML):

Client / UserService.java:
public class UserService
{
public void getUsers()
{
new Client(Protocol.HTTP).get(http://server/users; new
Callback()
{
public void onEvent(Request request, Response response)
{
XmlRepresentation xmlRepresentation =
response.getEntityAsXml();
Document doc = xmlRepresentation.getDocument();
[parse XML]
}
});
}
}

Server / UsersResource.java (registered to handle http://server/
users):
public class UsersResource extends Resource
{
public void UsersResource(Context context, Request request,
Response response)
{
super(context, request, response);
getVariants().add(new Variant(MediaType.TEXT_XML));
}

public Representation represent(Variant variant) throws
ResourceException
{
Representation result = new DomRepresentation
(diaType.TEXT_XML);
Document doc = rep.getDocument();
[Populate doc with users...]
return result;
}

At the client side we parse the XML and turn it into ModelData
instances so we can use them in the GXT widgets.
In case of POST or PUT requests, we use forms at the client side and
the Spring validation framework on the server side to validate and
convert the form into POJOs.

I'm not that familiar with GWT-EXT, but as they are very similiar in
turn of classes / concepts, you should be able to use a similar
approach.

There's a preety good example of the Restlet-GWT module available at:
http://wiki.restlet.org/docs_1.1/13-restlet/144-restlet/188-restlet.html

Hope that helps!

Greetings
Harald
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: RESTful URL with GWT

2009-01-14 Thread Gabor Szokoli

On Tue, Jan 13, 2009 at 12:38 PM, Joshua Partogi joshua.j...@gmail.com wrote:

 Dear all,

HI!

 Is it possible to have RESTful URL with GWT?

With GWT, you should only manipulate the fragment part of the URL (the
part after a #), otherwise the browser re-loads the page.
You can use your own convention in the fragment to identify the server
side resource the application is accessing, or make any other aspect
of client-side application state bookmarkable and back/forward button
compliant.
Here's now:
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5s=google-web-toolkit-doc-1-5t=DevGuideHistory
In fact the google document reader is a pretty good example itself :-)
http://code.google.com/docreader/#p=google-documentation-readers=google-documentation-readert=UrlFormat

Please note however that the fragment portion of the URL is not
normally processed by the server or intermediaries, in fact they only
see it when an URL is accessed from the bookmarks or is passed around.

Is this what you were after? We are somewhat unsure.


Gabor Szokoli

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: RESTful URL with GWT

2009-01-14 Thread zhouxing fang
hi,Harald,can you give more detail of your project? Is it possible to use
RESTful service with Ext-GWT?

2009/1/14 Harald Pehl harald.p...@googlemail.com


 Take a look at the RESTlet project: http://www.restlet.org/. They have
 also a GWT extension:
 http://wiki.restlet.org/docs_1.1/13-restlet/144-restlet.html
 I'm using it for my current project and found it very usefl!

 Greetings Harald

 On 13 Jan., 12:38, Joshua Partogi joshua.j...@gmail.com wrote:
  Dear all,
 
  Is it possible to have RESTful URL with GWT? I tried to find docs
  about setting RESTful URL with GWT but can not find it. Can anyone
  lead me to this?
 
  Thanks in advance
 
  --
  Not by might nor by power, but by His Spirit.
 
  Read my blog:http://joshuajava.wordpress.com/
  Follow me on twitter:http://twitter.com/jpartogi
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: RESTful URL with GWT

2009-01-13 Thread jake H

If u mean , if u can implement REST in GWT the answer is yes.
otherwise about playing with the urls and getting data , i m not sure
exactly but with some javascript u can parse the desire data i think.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: RESTful URL with GWT

2009-01-13 Thread Harald Pehl

Take a look at the RESTlet project: http://www.restlet.org/. They have
also a GWT extension: 
http://wiki.restlet.org/docs_1.1/13-restlet/144-restlet.html
I'm using it for my current project and found it very usefl!

Greetings Harald

On 13 Jan., 12:38, Joshua Partogi joshua.j...@gmail.com wrote:
 Dear all,

 Is it possible to have RESTful URL with GWT? I tried to find docs
 about setting RESTful URL with GWT but can not find it. Can anyone
 lead me to this?

 Thanks in advance

 --
 Not by might nor by power, but by His Spirit.

 Read my blog:http://joshuajava.wordpress.com/
 Follow me on twitter:http://twitter.com/jpartogi
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---