Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Status page without login
Status page without login [message #1752248] Fri, 20 January 2017 09:51 Go to next message
Andreas Christ is currently offline Andreas ChristFriend
Messages: 24
Registered: April 2016
Junior Member
We'd like to implement a simple page with some status information (e.g. Scout version, JDK version, LIB/JAR versions etc.) which should be accessed without any login/authentication. Is it possible, to display such a page for any anonymous user?
Re: Status page without login [message #1752251 is a reply to message #1752248] Fri, 20 January 2017 10:03 Go to previous messageGo to next message
Ivan Motsch is currently offline Ivan MotschFriend
Messages: 123
Registered: March 2010
Senior Member
Typically this is done in the web.xml where some or all of the /res/ resources are excluded from access restrictions. The code below is from the scout demo app.

<filter>
    <filter-name>AuthFilter</filter-name>
    <filter-class>org.eclipse.scout.widgets.ui.html.WidgetsUiServletFilter</filter-class>
    <init-param>
      <param-name>filter-exclude</param-name>
      <param-value>
        /res/*
        /path-to-your-status-page
      </param-value>
    </init-param>
  </filter>


This param is interpreted by the WidgetsUiServletFilter that covers the full /* servlet range.

In order to have your status page, simply implement the Bean interface org.eclipse.scout.rt.ui.html.IUiServletRequestHandler.

public class StatusPageUiServletRequestHandler extends AbstractUiServletRequestHandler {

  private final HttpCacheControl m_httpCacheControl = BEANS.get(HttpCacheControl.class);

  @Override
  public boolean handleGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    // serve only /path-to-your-status-page
    String pathInfo = req.getPathInfo();
    if (ObjectUtility.notEquals(pathInfo, "/path-to-your-status-page")) {
      //not handled
      return false;
    }

    // disable caching
    m_httpCacheControl.checkAndSetCacheHeaders(req, resp, null, null);

    // return calculated status page to servlet response...
      
    //handled
    return true;
  }
}
Re: Status page without login [message #1755226 is a reply to message #1752251] Wed, 01 March 2017 10:27 Go to previous message
Andreas Christ is currently offline Andreas ChristFriend
Messages: 24
Registered: April 2016
Junior Member
No Message Body

[Updated on: Wed, 01 March 2017 11:26]

Report message to a moderator

Previous Topic:[neon] double menus mobile
Next Topic:[neon] How to replace org.osgi.service.prefs.Preferences
Goto Forum:
  


Current Time: Mon May 22 17:41:39 GMT 2017

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

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