Java Code Examples for org.restlet.data.Form#getFirstValue()

The following examples show how to use org.restlet.data.Form#getFirstValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OAuthServerResource.java    From DeviceConnect-Android with MIT License 6 votes vote down vote up
/**
 * Get request parameter "client_id".
 * 
 * @param params
 * @return
 * @throws OAuthException
 */
protected static Client getClient(Form params) throws OAuthException {
    // check clientId:
    String clientId = params.getFirstValue(CLIENT_ID);
    if (clientId == null || clientId.isEmpty()) {
        getLogger().warning("Could not find client ID");
        throw new OAuthException(OAuthError.invalid_request,
                "No client_id parameter found.", null);
    }
    Client client = clients.findById(clientId);
    getLogger().fine("Client = " + client);
    if (client == null) {
    	getLogger().warning("Need to register the client : " + clientId);
        throw new OAuthException(OAuthError.invalid_request,
                "Need to register the client : " + clientId, null);
    }

    return client;
}
 
Example 2
Source File: JsonParameters.java    From helix with Apache License 2.0 6 votes vote down vote up
public JsonParameters(Form form) throws Exception {
  // get parameters in String format
  String jsonPayload = form.getFirstValue(JSON_PARAMETERS, true);
  if (jsonPayload == null || jsonPayload.isEmpty()) {
    _parameterMap = Collections.emptyMap();
  } else {
    _parameterMap = ClusterRepresentationUtil.JsonToMap(jsonPayload);
  }

  // get extra parameters in ZNRecord format
  ObjectMapper mapper = new ObjectMapper();
  String newIdealStateString = form.getFirstValue(NEW_IDEAL_STATE, true);

  if (newIdealStateString != null) {
    ZNRecord newIdealState =
        mapper.readValue(new StringReader(newIdealStateString), ZNRecord.class);
    _extraParameterMap.put(NEW_IDEAL_STATE, newIdealState);
  }

  String newStateModelString = form.getFirstValue(NEW_STATE_MODEL_DEF, true);
  if (newStateModelString != null) {
    ZNRecord newStateModel =
        mapper.readValue(new StringReader(newStateModelString), ZNRecord.class);
    _extraParameterMap.put(NEW_STATE_MODEL_DEF, newStateModel);
  }
}
 
Example 3
Source File: AccessTokenServerResource.java    From DeviceConnect-Android with MIT License 6 votes vote down vote up
/**
 * Get request parameter "grant_type".
 * 
 * @param params
 * @return
 * @throws OAuthException
 */
protected static GrantType getGrantType(Form params) throws OAuthException {
    String typeString = params.getFirstValue(GRANT_TYPE);
    getLogger().info("Type: " + typeString);
    try {
        GrantType type = Enum.valueOf(GrantType.class, typeString);
        getLogger().fine("Found flow - " + type);
        return type;
    } catch (IllegalArgumentException iae) {
        throw new OAuthException(OAuthError.unsupported_grant_type,
                "Unsupported flow", null);
    } catch (NullPointerException npe) {
        throw new OAuthException(OAuthError.invalid_request,
                "No grant_type parameter found.", null);
    }
}
 
Example 4
Source File: ITeslaRules.java    From ipst with Mozilla Public License 2.0 5 votes vote down vote up
@Get("json")
public Object getRepresentation() throws Exception{

    Form queryForm = getRequest().getOriginalRef().getQueryAsForm();
    String workflowId = queryForm.getFirstValue("workflowId", true, null);
    String startStr = queryForm.getFirstValue("start", "0");
    String countStr = queryForm.getFirstValue("count", "50");

    Map<String, Object> query = new HashMap();
    if (algoType != null) query.put("algoType", algoType);
    if (contingencyId != null) query.put("contingencyId", contingencyId);
    if (indexType != null) query.put("indexType", indexType);
    if (workflowId != null) query.put("workflowId", workflowId);

    Dataset set = datasource.getData(query,
            Integer.parseInt(startStr),
            Integer.parseInt(countStr),
            ColumnDescriptor.getDescriptorsForNames("algoType", "contingencyId", "indexType", "workflowId", "quality", "treeSize", "criticality", "tree"));
    Iterator<Collection> it = set.getRowIterator();

    JSONArray result = new JSONArray();

    while (it.hasNext()) {
        Object[] values = it.next().toArray();
        JSONObject ruleObj = new JSONObject();
        ruleObj.put("algoType", values[0]);
        ruleObj.put("contingencyId", values[1]);
        ruleObj.put("indexType", values[2]);
        ruleObj.put("workflowId", values[3]);
        ruleObj.put("quality", values[4]);
        ruleObj.put("treeSize", values[5]);
        ruleObj.put("criticality", values[6]);
        ruleObj.put("tree", new JSONObject((String)values[7]));
        result.put(ruleObj);
    }

    return result;
}
 
Example 5
Source File: ITeslaRules.java    From ipst with Mozilla Public License 2.0 5 votes vote down vote up
@Get("cond")
public String getTreeConditions() throws Exception{

    Form queryForm = getRequest().getOriginalRef().getQueryAsForm();
    String workflowId = queryForm.getFirstValue("workflowId", true, null);

    Map<String, Object> query = new HashMap();
    if (algoType != null) query.put("algoType", algoType);
    if (contingencyId != null) query.put("contingencyId", contingencyId);
    if (indexType != null) query.put("indexType", indexType);
    if (workflowId != null) query.put("workflowId", workflowId);

    Dataset set = datasource.getData(query,
            0,
            -1,
            ColumnDescriptor.getDescriptorsForNames("tree"));
    Iterator<Collection> it = set.getRowIterator();

    StringBuffer conditions = new StringBuffer();

    while (it.hasNext()) {
        Object[] values = it.next().toArray();
        JSONObject jsonTreeDescr = new JSONObject((String)values[0]);

        processJsonTree(jsonTreeDescr, conditions);
    }

    return conditions.toString();
}
 
Example 6
Source File: OAuthServerResource.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
/**
 * Get request parameter "scope".
 * 
 * @param params
 * @return
 * @throws OAuthException
 */
protected static String[] getScope(Form params) throws OAuthException {
    String scope = params.getFirstValue(SCOPE);
    if (scope == null || scope.isEmpty()) {
        
    	/*
要求するときにクライアントがスコープパラメータを省略した場合は 
承認、認可サーバーは処理しなければならないのどちらか 
事前に定義されたデフォルト値を使用して要求するか、要求を失敗 
無効な範囲を示す...(ドラフト-IETF-OAuthの-V2-303.3。)
    	 */
    	/*
         * If the client omits the scope parameter when requesting
         * authorization, the authorization server MUST either process the
         * request using a pre-defined default value, or fail the request
         * indicating an invalid scope... (draft-ietf-oauth-v2-30 3.3.)
         */
        Object defaultScope = getResourceContext().getAttributes().get(
                PARAMETER_DEFAULT_SCOPE);
        if (defaultScope == null || defaultScope.toString().isEmpty()) {
            throw new OAuthException(OAuthError.invalid_scope,
                    "Scope has not provided.", null);
        }
        scope = defaultScope.toString();
    }
    return Scopes.parseScope(scope);
}
 
Example 7
Source File: ITeslaDataResource.java    From ipst with Mozilla Public License 2.0 5 votes vote down vote up
private CsvRepresentation getForecastsAndSnapshots() {
    String forecastStr = getRequest().getOriginalRef().getQueryAsForm().getFirstValue("forecast");
    String horizon = getRequest().getOriginalRef().getQueryAsForm().getFirstValue("horizon");
    if ((forecastStr == null || Double.parseDouble(forecastStr) == 0) && (horizon == null || "SN".equals(horizon)))
        throw new IllegalArgumentException("ForecastsDiff operation must be used with either a positive 'forecast' value or a non-snapshot 'horizon'");

    final MongoDataset forecasts = (MongoDataset)getData();

    Form queryForm = getRequest().getOriginalRef().getQueryAsForm();
    queryForm.set("forecast", "0");
    queryForm.removeFirst("horizon");  //TODO use one or the other. Better to use horizon?
    MongoDataset snapshots = (MongoDataset)ds.getData(
            parseQuery(queryForm),
            0,
            -1,
            parseColumns(queryForm));

    Set<ColumnDescriptor> mergedList = new TreeSet<ColumnDescriptor>();
    mergedList.addAll(Arrays.asList(forecasts.getQueriedFields()));
    mergedList.addAll(Arrays.asList(snapshots.getQueriedFields()));
    ColumnDescriptor[] mergedFields = mergedList.toArray(new ColumnDescriptor[] {});

    Dataset result = new MergeDataset(forecasts, snapshots, mergedFields);

    String headersStr = queryForm.getFirstValue("headers");
    String nanValue = queryForm.getFirstValue("nanValue");
    char delimiter = queryForm.getFirstValue("delimiter", ",").charAt(0);

    return new CsvRepresentation(result, Boolean.parseBoolean(headersStr), delimiter, nanValue);


}
 
Example 8
Source File: AccessTokenServerResource.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
protected static String getApplicationName(Form params) throws OAuthException {
    String base64ApplicationName = params.getFirstValue(APPLICATION_NAME);
    String applicationName = new String(Base64.decode(base64ApplicationName, Base64.URL_SAFE|Base64.NO_WRAP));
    if (applicationName == null || applicationName.isEmpty()) {
        throw new OAuthException(OAuthError.invalid_request,
                "Mandatory parameter application_name is missing", null);
    }
    return applicationName;
}
 
Example 9
Source File: AccessTokenServerResource.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
/**
 * Get request parameter "redirect_uri".
 * 
 * @param params
 * @return
 * @throws OAuthException
 */
protected static String getRedirectURI(Form params) throws OAuthException {
    String redirUri = params.getFirstValue(REDIR_URI);
    if (redirUri == null || redirUri.isEmpty()) {
        throw new OAuthException(OAuthError.invalid_request,
                "Mandatory parameter redirect_uri is missing", null);
    }
    return redirUri;
}
 
Example 10
Source File: SwitchClustersResource.java    From floodlight_with_topoguard with Apache License 2.0 5 votes vote down vote up
@Get("json")
public Map<String, List<String>> retrieve() {
    IFloodlightProviderService floodlightProvider =
            (IFloodlightProviderService)getContext().getAttributes().
                get(IFloodlightProviderService.class.getCanonicalName());
    ITopologyService topology =
            (ITopologyService)getContext().getAttributes().
                get(ITopologyService.class.getCanonicalName());

    Form form = getQuery();
    String queryType = form.getFirstValue("type", true);
    boolean openflowDomain = true;
    if (queryType != null && "l2".equals(queryType)) {
        openflowDomain = false;
    }

    Map<String, List<String>> switchClusterMap = new HashMap<String, List<String>>();
    for (Long dpid: floodlightProvider.getAllSwitchDpids()) {
        Long clusterDpid =
                (openflowDomain
                 ? topology.getOpenflowDomainId(dpid)
                 :topology.getL2DomainId(dpid));
        List<String> switchesInCluster = switchClusterMap.get(HexString.toHexString(clusterDpid));
        if (switchesInCluster != null) {
            switchesInCluster.add(HexString.toHexString(dpid));
        } else {
            List<String> l = new ArrayList<String>();
            l.add(HexString.toHexString(dpid));
            switchClusterMap.put(HexString.toHexString(clusterDpid), l);
        }
    }
    return switchClusterMap;
}
 
Example 11
Source File: DefaultRequestReader.java    From attic-polygene-java with Apache License 2.0 5 votes vote down vote up
private String getValue( String name, Form queryAsForm, Form entityAsForm )
{
    String value = queryAsForm.getFirstValue( name );
    if( value == null )
    {
        value = entityAsForm.getFirstValue( name );
    }
    return value;
}
 
Example 12
Source File: SPARQLResource.java    From attic-polygene-java with Apache License 2.0 5 votes vote down vote up
private Value parseValueParam( Repository repository, Form form, String parameterName )
    throws ResourceException
{
    String paramValue = form.getFirstValue( parameterName );
    try
    {
        return Protocol.decodeValue( paramValue, repository.getValueFactory() );
    }
    catch( IllegalArgumentException e )
    {
        throw new ResourceException( Status.CLIENT_ERROR_BAD_REQUEST, "Invalid value for parameter '" + parameterName + "': "
                                                                      + paramValue );
    }
}
 
Example 13
Source File: ClusterRepresentationUtil.java    From helix with Apache License 2.0 4 votes vote down vote up
public static Map<String, String> getFormJsonParameters(Form form) throws JsonParseException,
    JsonMappingException, IOException {
  String jsonPayload = form.getFirstValue(JsonParameters.JSON_PARAMETERS, true);
  return ClusterRepresentationUtil.JsonToMap(jsonPayload);
}
 
Example 14
Source File: GetDisambiguation.java    From AGDISTIS with GNU Affero General Public License v3.0 4 votes vote down vote up
@Post
public String postText(Representation entity) throws IOException, Exception {
	NEDAlgo_HITS agdistis = null;
	try {
		agdistis = new NEDAlgo_HITS();
	} catch (IOException e) {
		log.error(
				"Can not load index due to either wrong properties in agdistis.properties or missing index at location",
				e);
		System.exit(0);
	}
	log.info("Start working on Request for AGDISTIS");
	String result = "";
	String text = "";
	String type = "";
	InputStream input = entity.getStream();
	// here the inputStream is duplicated due to it can be read only once.
	// Therefore, we do it for checking if the input is from gerbil or not.
	byte[] byteArray = IOUtils.toByteArray(input);
	InputStream input1 = new ByteArrayInputStream(byteArray);
	InputStream input2 = new ByteArrayInputStream(byteArray);

	String string = IOUtils.toString(input1);
	// Parse the given representation and retrieve data
	Form form = new Form(string);
	text = form.getFirstValue("text");
	type = form.getFirstValue("type");
	log.info("text: " + text);
	log.info("type: " + type);

	if (text == null) {
		result = NIFGerbil(input2, agdistis); // This part is created to
		// work
		// along with GERBIL, because
		// GERBIL only sends the NIF
		// files without taking care of
		// more than one parameter. So,
		// GERBIL is not capable to send
		// the nif in the text parameter
		// making
		// AGDISTIS?type=nif&text= not
		// work.
		return result;
	}
	if (type == null) {
		type = "agdistis";
	}

	if (type.equals("agdistis")) {
		return standardAG(text, agdistis); // This type is the standard
											// and in case the user
											// doesn't send the type
											// parameter, it is
											// considered as the main
											// one(e.g
											// AGDISTIS?type=agdistis&text=<entity>Barack
											// Obama</entity>).

	} else if (type.equals("nif")) {
		return NIFType(text, agdistis); // This type is for AGDISTIS
										// works beyond the GERBIL, this
										// part is in case of user wants
										// to check just a certain NIF
										// file(e.g
										// AGDISTIS?type=nif&text=@prefix....)

	} else if (type.equals("candidates")) {
		return candidateType(text, agdistis); // Here is to let us know
												// about all candidates
												// for each mention and
												// its respective
												// HITS/PageRank score.
	} else {
		return "ERROR";
	}
}
 
Example 15
Source File: AuthorizationServerResource.java    From DeviceConnect-Android with MIT License 4 votes vote down vote up
/**
  * Get request parameter "redirect_uri". (See 3.1.2.3. Dynamic
  * Configuration)
  * 
  * @param params
  * @param client
  * @return
  * @throws OAuthException
  */
 protected static RedirectionURI getRedirectionURI(Form params, Client client)
         throws OAuthException {
     String redirectURI = params.getFirstValue(REDIR_URI);
     String[] redirectURIs = client.getRedirectURIs();
     
     /*
      * If multiple redirection URIs have been registered, if only part of
      * the redirection URI has been registered, or if no redirection URI has
      * been registered, the client MUST include a redirection URI with the
      * authorization request using the "redirect_uri" request parameter.
      * (See 3.1.2.3. Dynamic Configuration)
      */
     if (redirectURIs == null || redirectURIs.length != 1) {
         if (redirectURI == null || redirectURI.isEmpty()) {
             throw new OAuthException(OAuthError.invalid_request,
                     "Client MUST include a redirection URI.", null);
         }
     } else {
         if (redirectURI == null || redirectURI.isEmpty()) {
             // If the optional parameter redirect_uri is not provided,
             // we use the one provided during client registration.
             return new RedirectionURI(redirectURIs[0]);
         }
     }

     /*
リダイレクトURIは、許可要求に含まれている場合、 
認可サーバーは受信した値を比較し、一致しなければならない 
少なくとも登録リダイレクトURIの1(またはURIに対して 
[RFC3986]セクション6で定義されているコンポーネント)、もしあれば、リダイレクト 
URIは、登録された。 (See 3.1.2.3. Dynamic Configuration)

      * When a redirection URI is included in an authorization request, the
      * authorization server MUST compare and match the value received
      * against at least one of the registered redirection URIs (or URI
      * components) as defined in [RFC3986] Section 6, if any redirection
      * URIs were registered. (See 3.1.2.3. Dynamic Configuration)
      */
     for (String uri : redirectURIs) {
         if (redirectURI.startsWith(uri)) {
             return new RedirectionURI(redirectURI, true);
         }
     }

     // The provided uri is no based on the uri with the client registration.
     throw new OAuthException(OAuthError.invalid_request,
             "Callback URI does not match.", null);
 }
 
Example 16
Source File: ResourceUtil.java    From helix with Apache License 2.0 4 votes vote down vote up
public static String getYamlParameters(Form form, YamlParamKey key) {
  return form.getFirstValue(key.toString());
}
 
Example 17
Source File: TopicManagementRestletResource.java    From uReplicator with Apache License 2.0 4 votes vote down vote up
@Override
@Post
public Representation post(Representation entity) {
  final String topicName = (String) getRequest().getAttributes().get("topicName");
  Form queryParams = getRequest().getResourceRef().getQueryAsForm();
  String srcCluster = queryParams.getFirstValue("src");
  String dstCluster = queryParams.getFirstValue("dst");

  LOGGER.info("Received request to whitelist topic {} from {} to {} on uReplicator ",
      topicName, srcCluster, dstCluster);

  // TODO: validate src->dst combination
  if (!isValidPipeline(srcCluster, dstCluster)) {
    LOGGER.warn(
        "Failed to whitelist topic {} on uReplicator because of not valid pipeline from {} to {}",
        topicName, srcCluster, dstCluster);
    return getResponseJsonStringRepresentation(Status.CLIENT_ERROR_NOT_FOUND,
        String.format(
            "Failed to whitelist topic %s on uReplicator because of not valid pipeline from %s to %s",
            topicName, srcCluster, dstCluster));
  }

  // Check if topic in source cluster
  TopicPartition srcTopicPartitionInfo = _clusterToObserverMap.get(srcCluster)
      .getTopicPartitionWithRefresh(topicName);
  LOGGER.info("Source topicPartitionInfo: {}", srcTopicPartitionInfo);
  if (srcTopicPartitionInfo == null) {
    LOGGER
        .warn("Failed to whitelist topic {} on uReplicator because of not exists in src cluster",
            topicName);
    return getResponseJsonStringRepresentation(Status.CLIENT_ERROR_NOT_FOUND,
        String.format(
            "Failed to whitelist new topic: %s, it's not existed in source Kafka cluster!",
            topicName));
  }

  // Check if topic in destination cluster
  TopicPartition dstTopicPartitionInfo = _clusterToObserverMap.get(dstCluster)
      .getTopicPartitionWithRefresh(topicName);
  LOGGER.info("Destination topicPartitionInfo: {}", dstTopicPartitionInfo);
  if (dstTopicPartitionInfo == null) {
    LOGGER
        .warn("Failed to whitelist topic {} on uReplicator because of not exists in dst cluster",
            topicName);
    return getResponseJsonStringRepresentation(Status.CLIENT_ERROR_NOT_FOUND,
        String.format(
            "Failed to whitelist new topic: %s, it's not existed in destination Kafka cluster!",
            topicName));
  }
  _helixMirrorMakerManager.updateCurrentStatus();
  String pipeline = ControllerUtils.getPipelineName(srcCluster, dstCluster);
  if (_helixMirrorMakerManager.isTopicPipelineExisted(topicName, pipeline)) {
    LOGGER.info("Topic {} already on uReplicator in pipeline {}", topicName, pipeline);
    return getResponseJsonStringRepresentation(Status.SUCCESS_OK,
        String.format("Failed to add new topic: %s from: %s to: %s, it is already existed!",
            topicName, srcCluster, dstCluster));
  } else {
    try {
      _helixMirrorMakerManager.addTopicToMirrorMaker(srcTopicPartitionInfo.getTopic(),
          srcTopicPartitionInfo.getPartition(), srcCluster, dstCluster, pipeline);
      LOGGER.info("Successfully whitelist the topic {} from {} to {}", topicName, srcCluster,
          dstCluster);
      return getResponseJsonStringRepresentation(Status.SUCCESS_OK,
          String.format("Successfully add new topic: %s from: %s to: %s",
              srcTopicPartitionInfo.getTopic(), srcCluster, dstCluster));
    } catch (Exception e) {
      LOGGER.info("Failed to whitelist the topic {} from {} to {} due to exception {}",
          topicName, srcCluster, dstCluster, e);
      return getResponseJsonStringRepresentation(Status.SERVER_ERROR_INTERNAL,
          String.format("Failed add new topic: %s from: %s to: %s due to exception: %s",
              srcTopicPartitionInfo.getTopic(), srcCluster, dstCluster, e.toString()));
    }
  }
}
 
Example 18
Source File: ITeslaDataResource.java    From ipst with Mozilla Public License 2.0 4 votes vote down vote up
@Override
protected ColumnDescriptor[] parseColumns(Form queryForm) {
    String useReferenceCIM = queryForm.getFirstValue("useReferenceCIM", true, "true");

    ColumnDescriptor[] attributes;

    if (Boolean.parseBoolean(useReferenceCIM)) {
        // rely on referenceCIM to choose attributes

        String powerTypeStr = queryForm.getFirstValue("powerType");
        String eqtypeStr = queryForm.getFirstValue("equip");
        String measuretypeStr = queryForm.getFirstValue("attr");
        String regionStr = queryForm.getFirstValue("region");
        String countryStr = queryForm.getFirstValue("country");
        String equipIdsStr = queryForm.getFirstValue("ids");

        Collection<String> powerTypes = null;
        if (powerTypeStr != null) powerTypes = Arrays.asList(powerTypeStr.split(","));

        Collection<String> types = null;
        if (eqtypeStr != null) types = Arrays.asList(eqtypeStr.split(","));

        Collection<String> measureTypes = null;
        if (measuretypeStr != null) measureTypes = Arrays.asList(measuretypeStr.split(","));

        Collection<String> regions = null;
        if (regionStr != null) regions = Arrays.asList(regionStr.split(","));

        Collection<String> countries = null;
        if (countryStr != null) countries = Arrays.asList(countryStr.split(","));

        Collection<String> equipIds = null;
        if (equipIdsStr != null) equipIds = Arrays.asList(equipIdsStr.split(","));

        //String[] equipIds = ((ITeslaDatasource)ds).findEquipments(types, regions, countries);

        attributes = ((ITeslaDatasource)ds).findAttributes(types, powerTypes, measureTypes, regions, countries, equipIds);
    } else {
        // ignore referenceCIM --> take all attributes found in DB
        attributes = ColumnDescriptor.getDescriptorsForNames(ds.getMetadata().getColumnNames());
        List<ColumnDescriptor> tempList = new ArrayList(Arrays.asList(attributes));

        // add functional attributes on every potential equipment (guesswork)
        for (ColumnDescriptor cd: attributes) {
            // in the absence of a referenceCIM, using heuristics on attribute names to guess generators or lines
            if (cd.getName().endsWith("_SM_P") || cd.getName().endsWith("_SM_Q")) {
                tempList.add(new StrictlyPositive(cd.getName()));
                tempList.add(new StrictlyNegative(cd.getName()));
            } else if (cd.getName().contains("__TO__") && cd.getName().endsWith("_I")) {
                tempList.add(new CurrentPowerRatio(cd.getName().substring(0, cd.getName().length()-2)));
            }
        }

        attributes = tempList.toArray(new ColumnDescriptor[] {});

    }

    return subsetColumns(attributes, queryForm);
}
 
Example 19
Source File: AbstractRestResource.java    From FoxBPM with Apache License 2.0 4 votes vote down vote up
protected String getQueryParameter(String name, Form query) {
	return query.getFirstValue(name);
}
 
Example 20
Source File: OAuthServerResource.java    From DeviceConnect-Android with MIT License 2 votes vote down vote up
/**
 * Get request parameter "state".
 * 
 * @param params
 * @return
 * @throws OAuthException
 */
protected static String getState(Form params) {
    return params.getFirstValue(STATE);
}