Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7852239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:22:28+00:00 2026-06-02T19:22:28+00:00

I am trying to implement AJAX Crawling for my Webpage. To get a feeling

  • 0

I am trying to implement AJAX Crawling for my Webpage.

To get a feeling I created a new GWT Project with sample code.

I created a filter

public final class CrawlServlet implements Filter {
    @Override
      public void doFilter(ServletRequest request, ServletResponse response,
          FilterChain chain) throws IOException {

    PrintWriter out = response.getWriter();

    if (request.toString().contains("_escaped_fragment=")) {
        out.write("yo");
    } else {
        try {
            chain.doFilter(request, response);
            return;
        } catch (ServletException e) {
            e.printStackTrace();
        }
    }
  }`

I get the correct response if browse this site: http://127.0.0.1:8888/URLFilter.html?gwt.codesvr=127.0.0.1:9997?_escaped_fragment=key=#!yo
and I see the GWT Sample Application if my URL is not escaped_fragment. But when I hit ‘Send’ (calling the RPC) I get a IllegalStatementException.

[WARN] Exception while dispatching incoming RPC call
java.lang.IllegalStateException: WRITER

at test.server.CrawlServlet.doFilter(CrawlServlet.java:32)

(this is the chain.doFilter(request, response);

My web.xml

 <!-- Servlets --> 

 <filter>
    <filter-name>crawlServlet</filter-name>
    <filter-class>test.server.CrawlServlet</filter-class>
  </filter>

  <filter-mapping>
    <filter-name>crawlServlet</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>


  <servlet>
    <servlet-name>greetServlet</servlet-name>
    <servlet-class>test.server.GreetingServiceImpl</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>greetServlet</servlet-name>
    <url-pattern>/urlfilter/greet</url-pattern>
  </servlet-mapping>

As i haven’t found much of tutorials/example regarding filter/rpc in GWT I gladly appreciate any help.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:22:29+00:00Added an answer on June 2, 2026 at 7:22 pm
    PrintWriter out = response.getWriter();
    

    Is your problem – you are getting a reference to the writer in the filter, then the servlet (or another filter) is using getOutputStream() to do its own work. From the javadocs for getWriter:

     * <p>Either this method or {@link #getOutputStream} may be called
     * to write the body, not both.
    

    …

     * @exception IllegalStateException
     *          if the <code>getOutputStream</code>
     *          method has already been called for this 
     *          response object
    

    The standard approach is to only use the writer/output stream if no other filter/servlet can possible do any writing – this includes even calling the getter. If you always want to write something, whether or not a later filter/servlet in the chain will also respond, then wrap the current response object up in something like a HttpServletResponseWrapper, possibly with a custom output stream or writer so that others can continue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

we are trying to implement ajax in new incident to get values of assign
I'm trying to implement google analytics code into our system that is mainly ajax
I'm very new to the AJAX and Javascript world and I'm trying to implement
I am trying to implement a simple request to Wikipedia's API using AJAX (XMLHttpRequest).
I'm trying to implement the HTML5 history feature to perform AJAX loading of page
I'm trying to implement authentication using jquery to make an ajax request to a
I am trying to implement ajax in jsp(avoid form submit) using struts2. I used
I'm trying to implement jQuery tabs to replace AJAX tab container. I've followed the
Yesterday I was trying to implement a Listener for a SelectManyListbox using Ajax in
Details: I'm basically trying to implement the functionality of the example here ( http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editondblclick/defaultvb.aspx

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.