I was wondering if there is in any way possible to package and deploy
GWT-RPC servlet as a stand-alone WAR application, without client side
JS & resources?
Basically what I want to do is have a client-side JS & resurces
deployable separately from the servlet, so the servlet application
wouldn't be redeployed every time I compile and deploy generated JS.
Uros,
If you are using GWT style RPC you won't be able to decouple the
client/server relationship as the GWT compiler needs to know about (and
compile) both sides in order for the application to be built. You may want
to take a look at GWT's RequestBuilder class (link below) that allows you to
build GWT based client apps that communicate with a server that may or may
not be GWT based and are ultimately compiled and deployed without having to
do the same with the server.
On Wed, Oct 7, 2009 at 1:23 PM, Uros Trebec <uros.tre...@gmail.com> wrote:
> Hi there!
> I was wondering if there is in any way possible to package and deploy
> GWT-RPC servlet as a stand-alone WAR application, without client side
> JS & resources?
> Basically what I want to do is have a client-side JS & resurces
> deployable separately from the servlet, so the servlet application
> wouldn't be redeployed every time I compile and deploy generated JS.
1. Split your code into three logical packages - client, server and
shared.
- client package has all UI code
- shared has the RemoteService and corresponding Async Interfaces,
plus any Serializable classes needed for the communication
between client
and server
- server has the RPC Servlets, plus any other code needed for server
components.
2. Run GWT on client and shared packages. You may want to include a
<source path='shared'/> and <source path='client'/> lines to your
module.gwt.xml. Also, during compilation of gwtc, you don't need
gwt-servlet.jar in your claspath.
3. When you are compiling server side code, make sure to include java
files from shared folder. Your classpath should include gwt-server.jar, but
it doesn't need the client side jar files.
4. When you bundle your war, gwt-serlvet.jar needs to be present in the
lib folder.
> Uros,
> If you are using GWT style RPC you won't be able to decouple the
> client/server relationship as the GWT compiler needs to know about (and
> compile) both sides in order for the application to be built. You may want
> to take a look at GWT's RequestBuilder class (link below) that allows you to
> build GWT based client apps that communicate with a server that may or may
> not be GWT based and are ultimately compiled and deployed without having to
> do the same with the server.
> On Wed, Oct 7, 2009 at 1:23 PM, Uros Trebec <uros.tre...@gmail.com> wrote:
>> Hi there!
>> I was wondering if there is in any way possible to package and deploy
>> GWT-RPC servlet as a stand-alone WAR application, without client side
>> JS & resources?
>> Basically what I want to do is have a client-side JS & resurces
>> deployable separately from the servlet, so the servlet application
>> wouldn't be redeployed every time I compile and deploy generated JS.
Even if the RPC Servlets are separate from the UI code, how would you
let your Async service code know the URL of the RPC servlets which may
be deployed in a different tomcat container all together?
On Oct 11, 6:35 pm, Sripathi Krishnan <sripathi.krish...@gmail.com>
wrote:
> 1. Split your code into three logical packages - client, server and
> shared.
> - client package has all UI code
> - shared has the RemoteService and corresponding Async Interfaces,
> plus any Serializable classes needed for the communication
> between client
> and server
> - server has the RPC Servlets, plus any other code needed for server
> components.
> 2. Run GWT on client and shared packages. You may want to include a
> <source path='shared'/> and <source path='client'/> lines to your
> module.gwt.xml. Also, during compilation of gwtc, you don't need
> gwt-servlet.jar in your claspath.
> 3. When you are compiling server side code, make sure to include java
> files from shared folder. Your classpath should include gwt-server.jar, but
> it doesn't need the client side jar files.
> 4. When you bundle your war, gwt-serlvet.jar needs to be present in the
> lib folder.
> > Uros,
> > If you are using GWT style RPC you won't be able to decouple the
> > client/server relationship as the GWT compiler needs to know about (and
> > compile) both sides in order for the application to be built. You may want
> > to take a look at GWT's RequestBuilder class (link below) that allows you to
> > build GWT based client apps that communicate with a server that may or may
> > not be GWT based and are ultimately compiled and deployed without having to
> > do the same with the server.
> > On Wed, Oct 7, 2009 at 1:23 PM, Uros Trebec <uros.tre...@gmail.com> wrote:
> >> Hi there!
> >> I was wondering if there is in any way possible to package and deploy
> >> GWT-RPC servlet as a stand-alone WAR application, without client side
> >> JS & resources?
> >> Basically what I want to do is have a client-side JS & resurces
> >> deployable separately from the servlet, so the servlet application
> >> wouldn't be redeployed every time I compile and deploy generated JS.
You just put a @RemoteServiceRelativePath("/path/to/servlet") annotation in
your RPC interface. It just needs the url, not the actual servlet class that
is implementing it - so you are still separating the ui code and the server
code.
> Even if the RPC Servlets are separate from the UI code, how would you
> let your Async service code know the URL of the RPC servlets which may
> be deployed in a different tomcat container all together?
> On Oct 11, 6:35 pm, Sripathi Krishnan <sripathi.krish...@gmail.com>
> wrote:
> > You should be able to decouple.
> > 1. Split your code into three logical packages - client, server and
> > shared.
> > - client package has all UI code
> > - shared has the RemoteService and corresponding Async Interfaces,
> > plus any Serializable classes needed for the communication
> > between client
> > and server
> > - server has the RPC Servlets, plus any other code needed for
> server
> > components.
> > 2. Run GWT on client and shared packages. You may want to include a
> > <source path='shared'/> and <source path='client'/> lines to your
> > module.gwt.xml. Also, during compilation of gwtc, you don't need
> > gwt-servlet.jar in your claspath.
> > 3. When you are compiling server side code, make sure to include java
> > files from shared folder. Your classpath should include
> gwt-server.jar, but
> > it doesn't need the client side jar files.
> > 4. When you bundle your war, gwt-serlvet.jar needs to be present in
> the
> > lib folder.
> > --Sri
> > 2009/10/9 Chris Ramsdale <cramsd...@google.com>
> > > Uros,
> > > If you are using GWT style RPC you won't be able to decouple the
> > > client/server relationship as the GWT compiler needs to know about (and
> > > compile) both sides in order for the application to be built. You may
> want
> > > to take a look at GWT's RequestBuilder class (link below) that allows
> you to
> > > build GWT based client apps that communicate with a server that may or
> may
> > > not be GWT based and are ultimately compiled and deployed without
> having to
> > > do the same with the server.
> > > On Wed, Oct 7, 2009 at 1:23 PM, Uros Trebec <uros.tre...@gmail.com>
> wrote:
> > >> Hi there!
> > >> I was wondering if there is in any way possible to package and deploy
> > >> GWT-RPC servlet as a stand-alone WAR application, without client side
> > >> JS & resources?
> > >> Basically what I want to do is have a client-side JS & resurces
> > >> deployable separately from the servlet, so the servlet application
> > >> wouldn't be redeployed every time I compile and deploy generated JS.
Sri
So consider the scenario where I have two WAR files: First WAR file
contains the RPC service and the contextpath is /allservices and
Second WAR file contains all the generated module code+a-whole-lot-of-
other-stuff. Second WAR file has a context /mycontent The GWT
generated JS is being served from the second WAR file.
The problem that I am facing is that when I get the service using
GWT.create and then modify the ServiceDef using
ServiceDefTarget.setEntry...
I then run into seriliazation issues. Root cause of this issue is that
when an RPC call is being made from WAR2 to WAR1 RPC service, the
moduelBaseURL is different from the contextPath. There is line in
RemoteServiceServlet that goes like this:
if (modulePath == null || !modulePath.startsWith(contextPath))
This check ensures that RPC WAR cannot be separate from rest of the
module. modulePath which is moduleBaseURL passed in the RPC request is
not the same as contextPath. That is always going to be the case,
unless there is an explict way to configure moduleBaseURL for RPC
request.
-Saurabh
On Nov 5, 7:15 pm, Sripathi Krishnan <sripathi.krish...@gmail.com>
wrote:
> You just put a @RemoteServiceRelativePath("/path/to/servlet") annotation in
> your RPC interface. It just needs the url, not the actual servlet class that
> is implementing it - so you are still separating the ui code and the server
> code.
> > Even if the RPC Servlets are separate from the UI code, how would you
> > let your Async service code know the URL of the RPC servlets which may
> > be deployed in a different tomcat container all together?
> > On Oct 11, 6:35 pm, Sripathi Krishnan <sripathi.krish...@gmail.com>
> > wrote:
> > > You should be able to decouple.
> > > 1. Split your code into three logical packages - client, server and
> > > shared.
> > > - client package has all UI code
> > > - shared has the RemoteService and corresponding Async Interfaces,
> > > plus any Serializable classes needed for the communication
> > > between client
> > > and server
> > > - server has the RPC Servlets, plus any other code needed for
> > server
> > > components.
> > > 2. Run GWT on client and shared packages. You may want to include a
> > > <source path='shared'/> and <source path='client'/> lines to your
> > > module.gwt.xml. Also, during compilation of gwtc, you don't need
> > > gwt-servlet.jar in your claspath.
> > > 3. When you are compiling server side code, make sure to include java
> > > files from shared folder. Your classpath should include
> > gwt-server.jar, but
> > > it doesn't need the client side jar files.
> > > 4. When you bundle your war, gwt-serlvet.jar needs to be present in
> > the
> > > lib folder.
> > > --Sri
> > > 2009/10/9 Chris Ramsdale <cramsd...@google.com>
> > > > Uros,
> > > > If you are using GWT style RPC you won't be able to decouple the
> > > > client/server relationship as the GWT compiler needs to know about (and
> > > > compile) both sides in order for the application to be built. You may
> > want
> > > > to take a look at GWT's RequestBuilder class (link below) that allows
> > you to
> > > > build GWT based client apps that communicate with a server that may or
> > may
> > > > not be GWT based and are ultimately compiled and deployed without
> > having to
> > > > do the same with the server.
> > > > On Wed, Oct 7, 2009 at 1:23 PM, Uros Trebec <uros.tre...@gmail.com>
> > wrote:
> > > >> Hi there!
> > > >> I was wondering if there is in any way possible to package and deploy
> > > >> GWT-RPC servlet as a stand-alone WAR application, without client side
> > > >> JS & resources?
> > > >> Basically what I want to do is have a client-side JS & resurces
> > > >> deployable separately from the servlet, so the servlet application
> > > >> wouldn't be redeployed every time I compile and deploy generated JS.
> Sri
> So consider the scenario where I have two WAR files: First WAR file
> contains the RPC service and the contextpath is /allservices and
> Second WAR file contains all the generated module code+a-whole-lot-of-
> other-stuff. Second WAR file has a context /mycontent The GWT
> generated JS is being served from the second WAR file.
> The problem that I am facing is that when I get the service using
> GWT.create and then modify the ServiceDef using
> ServiceDefTarget.setEntry...
> I then run into seriliazation issues. Root cause of this issue is that
> when an RPC call is being made from WAR2 to WAR1 RPC service, the
> moduelBaseURL is different from the contextPath. There is line in
> RemoteServiceServlet that goes like this:
> if (modulePath == null || !modulePath.startsWith(contextPath))
> This check ensures that RPC WAR cannot be separate from rest of the
> module. modulePath which is moduleBaseURL passed in the RPC request is
> not the same as contextPath. That is always going to be the case,
> unless there is an explict way to configure moduleBaseURL for RPC
> request.
> -Saurabh
> On Nov 5, 7:15 pm, Sripathi Krishnan <sripathi.krish...@gmail.com>
> wrote:
> > You just put a @RemoteServiceRelativePath("/path/to/servlet") annotation in
> > your RPC interface. It just needs the url, not the actual servlet class that
> > is implementing it - so you are still separating the ui code and the server
> > code.
> > > Even if the RPC Servlets are separate from the UI code, how would you
> > > let your Async service code know the URL of the RPC servlets which may
> > > be deployed in a different tomcat container all together?
> > > On Oct 11, 6:35 pm, Sripathi Krishnan <sripathi.krish...@gmail.com>
> > > wrote:
> > > > You should be able to decouple.
> > > > 1. Split your code into three logical packages - client, server and
> > > > shared.
> > > > - client package has all UI code
> > > > - shared has the RemoteService and corresponding Async Interfaces,
> > > > plus any Serializable classes needed for the communication
> > > > between client
> > > > and server
> > > > - server has the RPC Servlets, plus any other code needed for
> > > server
> > > > components.
> > > > 2. Run GWT on client and shared packages. You may want to include a
> > > > <source path='shared'/> and <source path='client'/> lines to your
> > > > module.gwt.xml. Also, during compilation of gwtc, you don't need
> > > > gwt-servlet.jar in your claspath.
> > > > 3. When you are compiling server side code, make sure to include java
> > > > files from shared folder. Your classpath should include
> > > gwt-server.jar, but
> > > > it doesn't need the client side jar files.
> > > > 4. When you bundle your war, gwt-serlvet.jar needs to be present in
> > > the
> > > > lib folder.
> > > > --Sri
> > > > 2009/10/9 Chris Ramsdale <cramsd...@google.com>
> > > > > Uros,
> > > > > If you are using GWT style RPC you won't be able to decouple the
> > > > > client/server relationship as the GWT compiler needs to know about (and
> > > > > compile) both sides in order for the application to be built. You may
> > > want
> > > > > to take a look at GWT's RequestBuilder class (link below) that allows
> > > you to
> > > > > build GWT based client apps that communicate with a server that may or
> > > may
> > > > > not be GWT based and are ultimately compiled and deployed without
> > > having to
> > > > > do the same with the server.
> > > > > On Wed, Oct 7, 2009 at 1:23 PM, Uros Trebec <uros.tre...@gmail.com>
> > > wrote:
> > > > >> Hi there!
> > > > >> I was wondering if there is in any way possible to package and deploy
> > > > >> GWT-RPC servlet as a stand-alone WAR application, without client side
> > > > >> JS & resources?
> > > > >> Basically what I want to do is have a client-side JS & resurces
> > > > >> deployable separately from the servlet, so the servlet application
> > > > >> wouldn't be redeployed every time I compile and deploy generated JS.