本文整理汇总了Java中org.apache.tapestry5.services.Request.getParameter方法的典型用法代码示例。如果您正苦于以下问题:Java Request.getParameter方法的具体用法?Java Request.getParameter怎么用?Java Request.getParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tapestry5.services.Request
的用法示例。
在下文中一共展示了Request.getParameter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleDismissAlerts
import org.apache.tapestry5.services.Request; //导入方法依赖的package包/类
protected void handleDismissAlerts(final Request request, final Response response) throws IOException {
AlertStorage storage = applicationStateManager.getIfExists(AlertStorage.class);
if (storage != null) {
String id = request.getParameter("id");
if (id != null) {
storage.dismiss(Long.parseLong(id));
} else {
storage.dismissAll();
}
}
if (request.isXHR()) {
try (PrintWriter printWriter = response.getPrintWriter("application/json")) {
printWriter.write("{}");
}
}
}
示例2: service
import org.apache.tapestry5.services.Request; //导入方法依赖的package包/类
/**
* Filter interface for the HttpServletRequestHandler pipeline. A filter
* should delegate to the handler. It may perform operations before or after
* invoking the handler, and may modify the request and response passed in to
* the handler.
*
* @param request
* @param response
* @param handler
*
* @return true if the request has been handled, false otherwise
*/
@Override
public boolean service(final Request request, final Response response, final RequestHandler handler)
throws IOException {
{
if (path.equals(request.getPath())) {
String operation = request.getParameter("operation");
switch (operation) {
case "retrieve-alerts":
handleRetrieveAlerts(request, response);
break;
case "dismiss-alerts":
handleDismissAlerts(request, response);
break;
default:
response.sendError(400, "Invalid operation: " + operation);
break;
}
return true;
} else {
return handler.service(request, response);
}
}
}
示例3: checkToken
import org.apache.tapestry5.services.Request; //导入方法依赖的package包/类
/**
* This method performs the check of the token. It extracts the current client token from the request and the
* current server-side token by accessing the CsrfTokenProvider instance assigned in this session.
*
* @param request .
* @param httpServletRequest .
* @throws CsrfException when token not there or token does not match
*/
public void checkToken(Request request, HttpServletRequest httpServletRequest)
throws CsrfException
{
String requestParam = request.getParameter(parameterName);
CsrfToken serverToken = tokenRepository.loadToken();
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("SessionToken: " + serverToken + ", ClientToken: " + requestParam);
}
if (serverToken == null || !serverToken.getToken().equals(requestParam))
{
// check if session id changed - if yes Spring Security (or another security framework)
// requested a new session after login
HttpSession session = httpServletRequest.getSession(false);
if (session != null && session.isNew())
{
return;
}
LOGGER.warn("CSRF Attack detected. Server-Token: {} vs. Client-Token: {}",
serverToken, requestParam);
throw new CsrfException("CSRF Attack detected. Invalid client token: " + requestParam);
}
}
示例4: getVerifierCode
import org.apache.tapestry5.services.Request; //导入方法依赖的package包/类
@Override
public String getVerifierCode(Request request) {
return request.getParameter(OAuthConstants.CODE);
}
示例5: getVerifierCode
import org.apache.tapestry5.services.Request; //导入方法依赖的package包/类
@Override
public String getVerifierCode(Request request) {
return request.getParameter(OAuthConstants.VERIFIER);
}
示例6: dispatch
import org.apache.tapestry5.services.Request; //导入方法依赖的package包/类
@Override
public boolean dispatch(Request request, Response response) throws IOException {
String path = request.getPath();
if(!path.contains(callbackPath))
return false;
String clientId = request.getParameter(OAuthTapestryConstants.OAUTH_CLIENT_ID_PARAMETER);
boolean isDenied = request.getParameter(OAuthTapestryConstants.OAUTH_DENIED_PARAMETER) != null;
if(!isDenied) {
OAuthClient client = authClientProvider.get(clientId);
try {
AccessToken tokens = oAuthServiceAdapter.retrieveAccessToken(client, request);
successHandler.handle(client, tokens, request);
} catch (OAuthException e) {
logger.error("Error while obtaining AccessTokens", e);
}
}
PageRenderRequestParameters params = new PageRenderRequestParameters("oauth/CallbackLandingPage", new EmptyEventContext(), false);
handler.handlePageRender(params);
return true;
}
示例7: retrieveAccessToken
import org.apache.tapestry5.services.Request; //导入方法依赖的package包/类
@Override
public AccessToken retrieveAccessToken(OAuthClient client, Request request) {
OAuthService service = client.getService();
if(!checkVersion(service))
return null;
String requestToken = request.getParameter(OAuthConstants.TOKEN);
String code = getVerifierCode(request);
logger.info("Verifyng Callback Request with token {} and verifier {}", requestToken, code);
Verifier verifier = new Verifier(code);
OAuthSession session = getSession();
Token sessionToken = session.getToken();
if(!session.isValidToken(requestToken))
throw new OAuthTokenException("Request tokens do not match.");
Token token = service.getAccessToken(sessionToken, verifier);
AccessToken accessToken = new AccessToken(token.getToken(), token.getSecret());
logger.info("Access Token obtained {}", accessToken);
session.setAccessToken(accessToken);
storeSession(session);
return accessToken;
}