Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Accessing a RAP application without a servlet name
Accessing a RAP application without a servlet name [message #548995] Fri, 23 July 2010 15:48 Go to next message
Norbert Bumm is currently offline Norbert BummFriend
Messages: 4
Registered: July 2009
Junior Member
Hi,

I have tried to register a redirect servlet as suggested in the FAQ
http://wiki.eclipse.org/RAP/FAQ#How_to_access_a_RAP_applicat ion_without_specifying_a_servlet_name.3F

for accessing our application without a servlet name. But I get an error message

„ERROR: Duplicate alias. Failed to register resource for [alias="/", contributor="org.eclipse.help.webapp[2]"]"

As the message says we have an integrated Eclipse Help System for our application. The Eclipse Help System also tries to register an alias for "/". The registration of the redirect servlet for alias "/" seems to be not possible with an integrated Eclipse Help System?

Has anyone a suggestion how to work around this?

Thanks in advance,
Norbert
Re: Accessing a RAP application without a servlet name [message #549845 is a reply to message #548995] Wed, 28 July 2010 08:26 Go to previous message
Norbert Bumm is currently offline Norbert BummFriend
Messages: 4
Registered: July 2009
Junior Member
Hi,

I found a solution for the my problem. Instead of registering a redirect servlet I registered a redirect servlet filter. This is a new feature of the current Equinox release.

public class RedirectServletFilter implements javax.servlet.Filter {
  

  public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws ServletException, IOException {
    
    try {
      HttpServletRequest request = (HttpServletRequest) req;
      HttpServletResponse response = (HttpServletResponse) res;
      
      if( "/".equals( request.getPathInfo() ) ) {
        response.sendRedirect( response.encodeRedirectURL( "servlet_name" ) );
      } 
      else {
        chain.doFilter(request, response);
      }
    } catch (ClassCastException e) {
      throw new ServletException("non-HTTP request or response");
    }
    
  }

  public void init(FilterConfig filterConfig) {
  }

  public void destroy() {
  }
}


Register the above Filter:
   <extension
         point="org.eclipse.equinox.http.registry.filters">
      <filter
            alias="/"
            class="org.example.RedirectServletFilter"
            load-on-startup="true">
      </filter>
   </extension>
Previous Topic:'null' is null or not an object
Next Topic:WST & RAP keybinding conflicts
Goto Forum:
  


Current Time: Tue Dec 10 18:17:06 GMT 2024

Powered by FUDForum. Page generated in 0.02787 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top