Package org.dbwiki.web.ui

Examples of org.dbwiki.web.ui.ServerResponseHandler


  /** Creates appropriate response handler for homepage
   *
   */
  protected ServerResponseHandler getHomepageResponseHandler(HttpRequest request) {
    ServerResponseHandler responseHandler = new ServerResponseHandler(request, _wikiTitle);
    responseHandler.put(HtmlContentGenerator.ContentMenu, new ServerMenuPrinter(this));
    responseHandler.put(HtmlContentGenerator.ContentContent, new DatabaseWikiListingPrinter(this));

    return responseHandler;
  }
View Full Code Here


    if (message != DatabaseWikiFormPrinter.MessageNone) {
      //
      // If parameter validation results in an error message the create wiki
      // form is re-displayed showing the error message.
      //
      ServerResponseHandler responseHandler = new ServerResponseHandler(request, _wikiTitle + " - Create Database Wiki");
      responseHandler.put(HtmlContentGenerator.ContentContent, new DatabaseWikiFormPrinter(properties, RequestParameterAction.ActionInsert, "Create Database Wiki", message));
      return responseHandler;
    } else {
      //
      // If the parameter values are valid the database wiki is created
      //
View Full Code Here

      message = DatabaseWikiFormPrinter.MessageNoTitle;
    }
   
    // If invalid, pass back appropriate message.
    if (message != DatabaseWikiFormPrinter.MessageNone) {
      ServerResponseHandler responseHandler = new ServerResponseHandler(request, _wikiTitle + " - Edit Database Wiki");
      responseHandler.put(HtmlContentGenerator.ContentContent, new DatabaseWikiFormPrinter(properties, RequestParameterAction.ActionUpdate, "Edit Database Wiki", message));
      return responseHandler;
    } else {
      // Otherwise, apply the changes.
      if ((request.user() == null) && (_authenticationMode != DatabaseWikiProperties.AuthenticateNever)) {
        throw new WikiFatalException("User information is missing");
View Full Code Here

   * @param exchange
   * @throws java.io.IOException
   * @throws org.dbwiki.exception.WikiException
   */
  protected void respondTo(Exchange<?> exchange) throws java.io.IOException, org.dbwiki.exception.WikiException {
    ServerResponseHandler responseHandler = null;
   
    HttpRequest request = new HttpRequest(new RequestURL(exchange,""), users());

    if (request.type().isIndex()) {
      responseHandler = this.getHomepageResponseHandler(request);
    } else if (request.type().isCreate()) {
      responseHandler = new ServerResponseHandler(request, _wikiTitle + " - Create Database Wiki");
      responseHandler.put(HtmlContentGenerator.ContentContent, new DatabaseWikiFormPrinter("Create Database Wiki"));
    } else if (request.type().isEdit()) {
      DatabaseWiki wiki = this.getRequestWiki(request, RequestParameter.ParameterEdit);
      responseHandler = new ServerResponseHandler(request, _wikiTitle + " - Edit Database Wiki");
      responseHandler.put(HtmlContentGenerator.ContentContent, new DatabaseWikiFormPrinter(wiki.getProperties(), RequestParameterAction.ActionUpdate, "Edit Database Wiki"));
    } else if (request.type().isReset()) {
      this.resetWikiConfiguration(this.getRequestWiki(request, RequestParameter.ParameterReset));
      responseHandler = this.getHomepageResponseHandler(request);
    } else if (request.type().isAction()) {
      RequestParameterAction action = RequestParameter.actionParameter(request.parameters().get(RequestParameter.ParameterAction));
      if (action.actionInsert()) {
        responseHandler = this.getInsertWikiResponseHandler(request);
      } else if (action.actionCancel()) {
        responseHandler = this.getHomepageResponseHandler(request);
      } else if (action.actionUpdate()) {
        responseHandler = this.getUpdateWikiResponseHandler(request);
      } else {
        throw new WikiRequestException(WikiRequestException.InvalidRequest, request.toString());
      }
    } else {
      throw new WikiRequestException(WikiRequestException.InvalidRequest, request.toString());
    }
   
    File template = null;

    //
    // TODO: Improve handling of individual home pages.
    //
    // This part is still a bit tricky. In order to identify whether the response handler results from
    // a call to getHomepageResponseHandler() we rely on the fact that only getHomepageResponseHandler()
    // adds content handler for Menu and Content.
    //
    if (responseHandler.contains(HtmlContentGenerator.ContentMenu) && responseHandler.contains(HtmlContentGenerator.ContentContent)) {
      template = _homepageTemplate;
    } else {
      template = _formTemplate;
    }

View Full Code Here

TOP

Related Classes of org.dbwiki.web.ui.ServerResponseHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.