Package org.dbwiki.web.request.parameter

Examples of org.dbwiki.web.request.parameter.RequestParameterList


  /*
   * Constructors
   */
 
  public RequestType(RequestURL url) {
    RequestParameterList parameters = url.parameters();
   
    _type = requestTypeUnknown;
   
    if (parameters.hasParameter(RequestParameter.ParameterAction)) {
      // Note that the number of parameters for action may differ.
      if (parameters.get(RequestParameter.ParameterAction).value().equals(RequestParameterAction.ActionCancel)) {
        if (url.isRoot()) {
          // path = / && (?action=cancel ... || <null> || ?version=...)
          _type = requestTypeIndex;
        } else {
          // path != / && (?action=cancel ... || <null> || ?version=...)
          _type = requestTypeGet;
        }
      } else {
        //?action=insert, annotate, update ...
        _type =  requestTypeAction;
      }
    } else if (parameters.size() == 0) {
      if (url.isRoot()) {
        // / [index_pos=...] [version=...]
        _type = requestTypeIndex;
      } else {
        // path != / && (?action=cancel ... || <null> || ?version=...)
        _type = requestTypeGet;
      }
    } else if (parameters.size() == 1) {
      if (parameters.hasParameter(RequestParameter.ParameterActivate)) {
        //?activate
        _type = requestTypeActivate;
      } else if (parameters.hasParameter(RequestParameter.ParameterCopy)) {
        //?copy{&version=...]
        _type = requestTypeCopy;
      } else if (parameters.hasParameter(RequestParameter.ParameterCopyPasteExport)) {
        //?cpxml{&version=...]
        _type = requestTypeCopyPasteExport;
      } else if (parameters.hasParameter(RequestParameter.ParameterCreate)) {
        //?new[=...]
        _type = requestTypeCreate;
      } else if (parameters.hasParameter(RequestParameter.ParameterCreateSchemaNode)) {
        //?new_schema_node
        _type = requestTypeCreateSchemaNode;
      } else if (parameters.hasParameter(RequestParameter.ParameterDelete)) {
        //?delete
        _type = requestTypeDelete;
      } else if (parameters.hasParameter(RequestParameter.ParameterEdit)) {
        //?edit[=...]
        _type = requestTypeEdit;
      } else if (parameters.hasParameter(RequestParameter.ParameterPaste)) {
        //?paste
        _type = requestTypePaste;
      } else if (parameters.hasParameter(RequestParameter.ParameterPasteForm)) {
        //?paste
        _type = requestTypePasteForm;
      } else if (parameters.hasParameter(RequestParameter.ParameterReset)) {
        //?reset=...
        _type = requestTypeReset;
      } else if (parameters.hasParameter(RequestParameter.ParameterSearch)) {
        //?search=...
        _type = requestTypeSearch;
      } else if (parameters.hasParameter(RequestParameter.ParameterSettings)) {
        //?settings
        _type = requestTypeSettings;
      } else if (parameters.hasParameter(RequestParameter.ParameterPreviousVersion)) {
        //?previous
        _type = requestTypeTimemachinePrevious;
      } else if (parameters.hasParameter(RequestParameter.ParameterChangesSince)) {
        //?changes
        _type = requestTypeTimemachineChanges;
      } else if (parameters.hasParameter(RequestParameter.ParameterExportXML)) {
        //?xml
        _type = requestTypeExportXML;
      } else if (parameters.hasParameter(RequestParameter.ParameterExportJSON)) {
        //?xml
        _type = requestTypeExportJSON;
      } else if (parameters.hasParameter(RequestParameter.ParameterHistory)) {
        _type = requestTypePageHistory;
      } else if (url.isRoot()) {
        // / [index_pos=...] [version=...]
        if (parameters.hasParameter(RequestParameter.ParameterVersion)) {
          _type = requestTypeIndex;
        } else if (parameters.hasParameter(RequestParameter.ParameterIndexPosition)) {
          _type = requestTypeIndex;
        }
      } else {
        if (parameters.hasParameter(RequestParameter.ParameterVersion)) {
          // path != / && (?action=cancel ... || <null> || ?version=...)
          _type = requestTypeGet;
       
      }
    } else if (parameters.size() == 2) {
      if ((parameters.hasParameter(RequestParameter.ParameterCopy))  && (parameters.hasParameter(RequestParameter.ParameterVersion))) {
        //?copy{&version=...]
        _type = requestTypeCopy;
      } else if ((parameters.hasParameter(RequestParameter.ParameterCopyPasteExport))  && (parameters.hasParameter(RequestParameter.ParameterVersion))) {
        //?cpxml{&version=...]
        _type = requestTypeCopyPasteExport;
      } else if ((parameters.hasParameter(RequestParameter.ParameterLayout)) && (parameters.hasParameter(RequestParameter.ParameterResource))) {
        //?layout resource=...
        _type = requestTypeLayout;
      } else if ((parameters.hasParameter(RequestParameter.ParameterTemplate)) && (parameters.hasParameter(RequestParameter.ParameterResource))) {
        //?template resource=...
        _type = requestTypeTemplate;
      } else if ((parameters.hasParameter(RequestParameter.ParameterPaste)) && (parameters.hasParameter(RequestParameter.ParameterURL))) {
        //?paste
        _type = requestTypePaste;
      } else if ((parameters.hasParameter(RequestParameter.ParameterStyleSheet)) && (parameters.hasParameter(RequestParameter.ParameterResource))) {
        //?style_sheet resource=...
        _type = requestTypeStyleSheet;
      } else if ((parameters.hasParameter(RequestParameter.ParameterURLDecoding)) && (parameters.hasParameter(RequestParameter.ParameterResource))) {
        //?url_decoding resource=...
        _type = requestTypeURLDecoding;
       
      } else if ((parameters.hasParameter(RequestParameter.ParameterReset)) && (parameters.hasParameter(RequestParameter.ParameterResource))) {
        // / [index_pos=...] [version=...]
        if ((parameters.hasParameter(RequestParameter.ParameterVersion)) && (parameters.hasParameter(RequestParameter.ParameterIndexPosition))) {
          _type = requestTypeIndex;
        }
      } else if ((parameters.hasParameter(RequestParameter.ParameterVersion)) && (parameters.hasParameter(RequestParameter.ParameterExportXML))) {
        //?version=x && ?xml
        try {
          RequestParameterVersion version = RequestParameter.versionParameter(parameters.get(RequestParameter.ParameterVersion));
          if (version.versionSingle()) {
            _type = requestTypeExportXML;
          }
        } catch (org.dbwiki.exception.WikiException wikiException) {
          // silently ignore wiki exceptions
          // FIXME #requestparsing: is this really the behaviour we want?
        }
      } else if ((parameters.hasParameter(RequestParameter.ParameterVersion)) && (parameters.hasParameter(RequestParameter.ParameterExportJSON))) {
        //?version=x && ?json
        try {
          RequestParameterVersion version = RequestParameter.versionParameter(parameters.get(RequestParameter.ParameterVersion));
          if (version.versionSingle()) {
            _type = requestTypeExportJSON;
          }
        } catch (org.dbwiki.exception.WikiException wikiException) {
          // silently ignore wiki exceptions
View Full Code Here


   */
  private boolean isProtectedRequest(HttpExchange exchange) {
      if (exchange.getRequestMethod().equalsIgnoreCase("GET")) {
      String rawQuery = exchange.getRequestURI().getRawQuery();
      if (rawQuery != null) {
        RequestParameterList parameters;
        try {
          parameters = new RequestParameterList(rawQuery);
        } catch (WikiFatalException e) {
          e.printStackTrace();
         
          // is this really what we want to do?
          return true;
        }
        if (parameters.hasParameter(RequestParameter.ParameterActivate)) {
          return true;
        } else if (parameters.hasParameter(RequestParameter.ParameterCreate)) {
          return true;
        } else if (parameters.hasParameter(RequestParameter.ParameterCreateSchemaNode)) {
          return true;
        } else if (parameters.hasParameter(RequestParameter.ParameterDelete)) {
          return true;
        } else if (parameters.hasParameter(RequestParameter.ParameterEdit)) {
          return true;
        } else if (parameters.hasParameter(RequestParameter.ParameterLayout)) {
          return true;
        } else if (parameters.hasParameter(RequestParameter.ParameterPaste)) {
          return true;
        } else if (parameters.hasParameter(RequestParameter.ParameterReset)) {
          return true;
        } else if (parameters.hasParameter(RequestParameter.ParameterTemplate)) {
          return true;
        } else if (parameters.hasParameter(RequestParameter.ParameterStyleSheet)) {
          return true;
        } else {
          return false;
        }
      }
View Full Code Here

        in.close();
        }
    } catch (java.io.IOException ioException) {
      throw new WikiFatalException(ioException);
    }
    _parameters = new RequestParameterList(urlParameter);
  }
View Full Code Here

  // FIXME #htmlgeneration: This seems to not initialize the parent's _request field

  public DatabaseWikiContentGenerator(DatabaseIdentifier dbIdentifier, String title, CSSLinePrinter cssPrinter, WikiException exception) {
   
    _dbIdentifier = dbIdentifier;
    _parameters = new RequestParameterList();
    _title = title;

    this.put(ContentCSS, cssPrinter);
    this.put(ContentContent, new ExceptionPrinter(exception));
    this.put(ContentTitle, new TitlePrinter(_title));
View Full Code Here

TOP

Related Classes of org.dbwiki.web.request.parameter.RequestParameterList

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.