Hi,
I have the same problem, except, I am doing my calls to a html page.
But I still get an exception that the contentLength in the request was
not set.
So I debugged it, and even if I set it to 1 manually, then the
contentType was not text/x-gwt-rpc.
So what am I doing wrong?
Is there anything more I can do the just surf to the hmtl page of the
service?
by the way: the service works fine if I just run it with GWT. But not
with spring.
Here is the code of my GWTController:
public class GWTController extends RemoteServiceServlet implements
Controller, ServletContextAware {
private RemoteService remoteService;
private Class remoteServiceClass;
private ServletContext servletContext;
/**
* Constructor
*
* @param intelliHeating The business logic of the program.
* @param remoteService the GWT RemoteService implementation
* that will be delegated to by the {...@code GWTController}.
*/
public GWTController(RemoteService remoteService) {
this.remoteService = remoteService;
this.remoteServiceClass = this.remoteService.getClass();
}
/**
*
* Implements Spring Controller interface method.
* Call GWT's RemoteService doPost() method and return null.
* @param request current HTTP request
* @param response current HTTP response
* @return a ModelAndView to render, or null if handled directly
* @throws Exception in case of errors
*/
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
doPost(request, response);
return null;
// response handled by GWT RPC over XmlHttpRequest
}
public ServletContext getServletContext() {
return servletContext;
}
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
}
On 27 jan, 17:53, Edo <[email protected]> wrote:
> Thank you.
> It's working fine now.
>
> Edo
>
> On Jan 27, 6:33 pm, Isaac Truett <[email protected]> wrote:
>
>
>
> > Right. You got the correct response for what you tried to do. RPC service
> > implementations do not support GET. But I think you misunderstood the
> > response. It's perfectly normal. You should not be pointing your browser to
> > an RPC service. You should request an HTML page (or JSP, PHP, ASP, etc.)
> > that includes your GWT application using a <script> tag. Look at the last
> > part of the URL in hosted mode. Request that file.
> > - Isaac
>
> > On Tue, Jan 27, 2009 at 11:22 AM, Edo <[email protected]> wrote:
>
> > > Thank you for your response.
>
> > > I tried to launch the application, by navigating the browser to
>
> > >http://localhost:8080/mgmtWebProject/mgmt/LoadControlPlaneNodesServic...
>
> > > and I received an error, which said that doGet is not supported.
> > > That's why I added the doGet method.
> > > How can I send POST requests?
>
> > > Edo.
>
> > > On Jan 27, 6:11 pm, Isaac Truett <[email protected]> wrote:
> > > > It doesn't sound like there's anything wrong with your deployment, it
> > > sounds
> > > > like you're trying to do something invalid. Why are you sending GET
> > > requests
> > > > to an RPC servlet?
>
> > > > On Tue, Jan 27, 2009 at 5:11 AM, Edo <[email protected]> wrote:
>
> > > > > Hello,
> > > > > I'm new to GWT, and this is the first application I'm trying to
> > > > > develop.
>
> > > > > First time I deployed my application to tomcat and tried to run it, I
> > > > > received a message that doGet is not supported,
> > > > > So I added a class that extends RemoteServiceServlet, and implements
> > > > > the doGet by delegating it to doPost:
>
> > > > > @Override
> > > > > public void doGet(HttpServletRequest request,
> > > > > HttpServletResponse response){
> > > > > request.getContentLength();
> > > > > doPost(request, response);
> > > > > }
>
> > > > > I redeployed the application, and when I tried running it, I received
> > > > > the following exception:
>
> > > > > SEVERE: Exception while dispatching incoming RPC call
> > > > > javax.servlet.ServletException: Content-Length must be specified
> > > > > at
> > > com.google.gwt.user.server.rpc.RPCServletUtils.readContentAsUtf8
> > > > > (RPCServletUtils.java:131)
> > > > > at
> > > com.google.gwt.user.server.rpc.RemoteServiceServlet.readContent
> > > > > (RemoteServiceServlet.java:335)
> > > > > at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
> > > > > (RemoteServiceServlet.java:77)
> > > > > at
> > > > > com.traffix.mgmtconsole.server.services.OpenbloxManagementService.doGet
> > > > > (OpenbloxManagementService.java:56)
> > > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
> > > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
> > > > > Do I really need to implement the doGet method in my classes?
> > > > > Is there a way I can avoid it?
> > > > > How can I fix the above exception?
>
> > > > > Thank you for your help.
> > > > > Edo- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---