本文整理了Java中org.eclipse.jetty.server.Request.setAttribute
方法的一些代码示例,展示了Request.setAttribute
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.setAttribute
方法的具体详情如下:
包路径:org.eclipse.jetty.server.Request
类名称:Request
方法名:setAttribute
暂无
代码示例来源:origin: jphp-group/jphp
@Signature
public void attribute(String name, Object value) {
request.setAttribute(name, value);
}
代码示例来源:origin: jphp-group/jphp
String value = matcher.group(1);
request.getRequest().setAttribute(name, value);
代码示例来源:origin: jooby-project/jooby
@Override
public void handle(final String target, final Request baseRequest,
final HttpServletRequest request, final HttpServletResponse response) throws IOException,
ServletException {
try {
baseRequest.setHandled(true);
String type = baseRequest.getContentType();
boolean multipart = false;
if (type != null && type.toLowerCase().startsWith(MediaType.multipart.name())) {
baseRequest.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, multiPartConfig);
multipart = true;
}
ServletServletRequest nreq = new ServletServletRequest(request, tmpdir, multipart)
.with(upgrade(baseRequest, request, response, webSocketServerFactory));
dispatcher.handle(nreq, new JettyResponse(nreq, response));
} catch (IOException | ServletException | RuntimeException ex) {
baseRequest.setHandled(false);
log.error("execution of: " + target + " resulted in error", ex);
throw ex;
} catch (Throwable ex) {
baseRequest.setHandled(false);
log.error("execution of: " + target + " resulted in error", ex);
throw new IllegalStateException(ex);
}
}
代码示例来源:origin: pippo-java/pippo
@Override
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
if (isMultipartRequest(request)) {
baseRequest.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, multipartConfig);
}
super.doHandle(target, baseRequest, request, response);
}
代码示例来源:origin: io.airlift/http-server
@Override
public void onRequestBegin(Request request)
{
request.setAttribute(REQUEST_BEGIN_ATTRIBUTE, System.nanoTime());
}
代码示例来源:origin: com.proofpoint.platform/http-server
@Override
public void onResponseBegin(Request request)
{
request.setAttribute(RESPONSE_CONTENT_TIMESTAMPS_ATTRIBUTE, new ArrayList<Long>());
}
代码示例来源:origin: com.proofpoint.platform/http-server
@Override
public void onRequestBegin(Request request)
{
request.setAttribute(REQUEST_BEGIN_ATTRIBUTE, System.nanoTime());
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
public void parsedRequestAttribute(String key, int value) throws IOException
{
_request.setAttribute(key, Integer.toString(value));
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
public void parsedSslSession(Buffer sslSession) throws IOException
{
_request.setAttribute("javax.servlet.request.ssl_session", sslSession.toString());
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
public void parsedRequestAttribute(String key, Buffer value) throws IOException
{
if (value==null)
_request.removeAttribute(key);
else
_request.setAttribute(key,value.toString());
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
/**
* @see org.eclipse.jetty.continuation.Continuation#setAttribute(java.lang.String, java.lang.Object)
*/
public void setAttribute(String name, Object attribute)
{
_connection.getRequest().setAttribute(name,attribute);
}
代码示例来源:origin: com.proofpoint.platform/http-server
@SuppressWarnings("unchecked")
@Override
public void onRequestEnd(Request request)
{
long requestBeginTime = (Long) request.getAttribute(REQUEST_BEGIN_ATTRIBUTE);
request.setAttribute(REQUEST_BEGIN_TO_END_ATTRIBUTE, System.nanoTime() - requestBeginTime);
}
代码示例来源:origin: org.eclipse.jetty/server
/**
* @see org.eclipse.jetty.continuation.Continuation#setAttribute(java.lang.String, java.lang.Object)
*/
public void setAttribute(String name, Object attribute)
{
_connection.getRequest().setAttribute(name,attribute);
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server
/**
* @see org.eclipse.jetty.continuation.Continuation#setAttribute(java.lang.String, java.lang.Object)
*/
public void setAttribute(String name, Object attribute)
{
_connection.getRequest().setAttribute(name,attribute);
}
代码示例来源:origin: org.locationtech.geogig/geogig-web-app
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request,
HttpServletResponse response) throws
IOException, ServletException {
// add the repository provide to the request attributes
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Setting RepositoryProvider on Request to: " + repoProvider);
}
baseRequest.setAttribute(RepositoryProvider.KEY, repoProvider);
// now let the delegate handle it
super.handle(target, baseRequest, request, response);
}
代码示例来源:origin: io.airlift/http-server
@SuppressWarnings("unchecked")
@Override
public void onBeforeDispatch(Request request)
{
long requestBeginTime = (Long) request.getAttribute(REQUEST_BEGIN_ATTRIBUTE);
request.setAttribute(REQUEST_BEGIN_TO_DISPATCH_ATTRIBUTE, System.nanoTime() - requestBeginTime);
}
代码示例来源:origin: com.proofpoint.platform/http-server
@SuppressWarnings("unchecked")
@Override
public void onBeforeDispatch(Request request)
{
long requestBeginTime = (Long) request.getAttribute(REQUEST_BEGIN_ATTRIBUTE);
request.setAttribute(REQUEST_BEGIN_TO_DISPATCH_ATTRIBUTE, System.nanoTime() - requestBeginTime);
}
代码示例来源:origin: org.keycloak/keycloak-jetty-core
@Override
protected void completeBearerAuthentication(KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal, String method) {
this.principal = principal;
RefreshableKeycloakSecurityContext securityContext = principal.getKeycloakSecurityContext();
Set<String> roles = AdapterUtils.getRolesFromSecurityContext(securityContext);
if (log.isDebugEnabled()) {
log.debug("Completing bearer authentication. Bearer roles: " + roles);
}
request.setAttribute(KeycloakSecurityContext.class.getName(), securityContext);
}
代码示例来源:origin: org.keycloak/keycloak-jetty-core
protected Authentication register(Request request, KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal) {
request.setAttribute(AdapterDeploymentContext.class.getName(), deploymentContext);
Authentication authentication = request.getAuthentication();
if (!(authentication instanceof KeycloakAuthentication)) {
UserIdentity userIdentity = createIdentity(principal);
authentication = createAuthentication(userIdentity, request);
request.setAuthentication(authentication);
}
return authentication;
}
代码示例来源:origin: org.keycloak/spring-boot-container-bundle
protected Authentication register(Request request, KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal) {
request.setAttribute(AdapterDeploymentContext.class.getName(), deploymentContext);
Authentication authentication = request.getAuthentication();
if (!(authentication instanceof KeycloakAuthentication)) {
UserIdentity userIdentity = createIdentity(principal);
authentication = createAuthentication(userIdentity, request);
request.setAuthentication(authentication);
}
return authentication;
}
内容来源于网络,如有侵权,请联系作者删除!