當前位置: 首頁>>代碼示例>>Java>>正文


Java Reference.addQueryParameter方法代碼示例

本文整理匯總了Java中org.restlet.data.Reference.addQueryParameter方法的典型用法代碼示例。如果您正苦於以下問題:Java Reference.addQueryParameter方法的具體用法?Java Reference.addQueryParameter怎麽用?Java Reference.addQueryParameter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.restlet.data.Reference的用法示例。


在下文中一共展示了Reference.addQueryParameter方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sendToProvider

import org.restlet.data.Reference; //導入方法依賴的package包/類
protected Representation sendToProvider(String provider)
{
   String id = openIDState.start();
   
   Reference openidRef = new Reference(provider);
   openidRef.addQueryParameter("openid.ns", "http://specs.openid.net/auth/2.0");
   openidRef.addQueryParameter("openid.return_to", getRequest().getResourceRef().toString()+"/"+id);
   openidRef.addQueryParameter("openid.realm", getRequest().getHostRef().toString());
   openidRef.addQueryParameter("openid.claimed_id", "http://specs.openid.net/auth/2.0/identifier_select");
   openidRef.addQueryParameter("openid.identity", "http://specs.openid.net/auth/2.0/identifier_select");
   openidRef.addQueryParameter("openid.mode", "checkid_setup");
   openidRef.addQueryParameter("openid.ns.ui", "http://specs.openid.net/extensions/ui/1.0");
   openidRef.addQueryParameter("openid.ui.icon", "true");
   openidRef.addQueryParameter("openid.ui.mode", "x-has-session");
   openidRef.addQueryParameter("openid.ns.ax", "http://openid.net/srv/ax/1.0");
   openidRef.addQueryParameter("openid.ax.mode", "fetch_request");
   openidRef.addQueryParameter("openid.ax.required", "email,firstname,lastname");
   openidRef.addQueryParameter("openid.ax.type.email", "http://axschema.org/contact/email");
   openidRef.addQueryParameter("openid.ax.type.firstname", "http://axschema.org/namePerson/first");
   openidRef.addQueryParameter("openid.ax.type.lastname", "http://axschema.org/namePerson/last");
   getResponse().redirectSeeOther(openidRef);
   //response.setEntity(new StringRepresentation(openidRef.toString(),MediaType.TEXT_PLAIN));
   return null;
}
 
開發者ID:alexmilowski,項目名稱:xproclet,代碼行數:25,代碼來源:OpenIDRequestResource.java

示例2: sendToProvider

import org.restlet.data.Reference; //導入方法依賴的package包/類
protected Representation sendToProvider(String provider)
{
   String id = openIDState.start();
   
   Reference oauth2Ref = new Reference(provider);
   try {
      // Construct a redirect URI with the OAuth2 parameters for the service
      URI redirect = new URI(getRequest().getResourceRef().toString()).resolve(getContext().getParameters().getFirstValue("oauth2.redirect_uri"));
      getLogger().info(redirect.toString());
      oauth2Ref.addQueryParameter("client_id", getContext().getParameters().getFirstValue("oauth2.client_id"));
      oauth2Ref.addQueryParameter("redirect_uri", redirect.toString());
      oauth2Ref.addQueryParameter("response_type", "code");
      oauth2Ref.addQueryParameter("scope", "openid email");
      oauth2Ref.addQueryParameter("state", id);
      getResponse().redirectSeeOther(oauth2Ref);
   } catch (URISyntaxException ex) {
      getLogger().log(Level.SEVERE,"Cannot construct redirect URI",ex);
   }
   return null;
}
 
開發者ID:alexmilowski,項目名稱:xproclet,代碼行數:21,代碼來源:OAuth2RequestResource.java

示例3: createGetRequest

import org.restlet.data.Reference; //導入方法依賴的package包/類
private Request createGetRequest(String reqParamValue, String callbackParamValue) {
    Reference ref = new Reference("http://foo.com");
    if (reqParamValue != null) {
        ref.addQueryParameter(RpcResource.GET_REQUEST_REQ_PARAM, reqParamValue);
    }
    if (callbackParamValue != null) {
        ref.addQueryParameter(RpcResource.GET_REQUEST_CALLBACK_PARAM, callbackParamValue);
    }
    Request result = new Request(Method.GET, ref);
    result.setEntity(new StringRepresentation(""));
    result.getAttributes().put("org.restlet.http.headers", new Form());
    result.getEntity().setCharacterSet(CharacterSet.UTF_8);
    return result;
}
 
開發者ID:devacfr,項目名稱:spring-restlet,代碼行數:15,代碼來源:RpcResourceTest.java

示例4: callLoginPageServerResource

import org.restlet.data.Reference; //導入方法依賴的package包/類
/**
 * LoginPageServerResourceを実行する.
 * 
 * @param userId ユーザーID
 * @param password パスワード
 * @return 戻り値(ResultRepresentation)
 */
private static ResultRepresentation callLoginPageServerResource(final String userId, final String password) {
    // 前の処理からセッションIDを引き継ぐ
    String sessionId = AuthorizationServerResource.getSessionId();
    Series<Cookie> cookies = new Series<>(Cookie.class);
    cookies.add(AuthorizationBaseServerResource.ClientCookieID, sessionId);

    // (B)の処理
    LoginPageServerResource.initResult();
    Request request = new Request();
    Reference requestReference = new Reference(DUMMY_ORIGINAL_REF);
    requestReference.addQueryParameter(LoginPageServerResource.USER_ID, userId);
    requestReference.addQueryParameter(LoginPageServerResource.PASSWORD, password);
    requestReference.addQueryParameter(LoginPageServerResource.CONTINUE,
            RedirectRepresentation.RedirectProc.requestAuthorization.toString());

    // QueryParameterとは別の変數に値を入れているので、直接値を設定する
    ArrayList<String> userIds = new ArrayList<>();
    userIds.add(userId);
    ArrayList<String> passwords = new ArrayList<>();
    passwords.add(password);
    ArrayList<String> continues = new ArrayList<>();
    continues.add(RedirectRepresentation.RedirectProc.requestAuthorization.toString());

    LoginPageServerResource.getQuery().put(LoginPageServerResource.USER_ID, userIds);
    LoginPageServerResource.getQuery().put(LoginPageServerResource.PASSWORD, passwords);
    LoginPageServerResource.getQuery().put(LoginPageServerResource.CONTINUE, continues);

    request.setCookies(cookies);
    request.setOriginalRef(requestReference);
    request.setResourceRef(requestReference);
    Response response = new Response(request);
    LoginPageServerResource.init(request, response);
    ResultRepresentation resultRepresentation;
    try {
        resultRepresentation = (ResultRepresentation) LoginPageServerResource.getPage();
    } catch (OAuthException e) {
        resultRepresentation = new ResultRepresentation();
        resultRepresentation.setResult(false);
        resultRepresentation.setError(e.getMessage(), e.getErrorDescription());
    }

    return resultRepresentation;
}
 
開發者ID:DeviceConnect,項目名稱:DeviceConnect-Android,代碼行數:51,代碼來源:LocalOAuth2Main.java


注:本文中的org.restlet.data.Reference.addQueryParameter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。