本文整理了Java中org.apache.catalina.connector.Request.setNote
方法的一些代码示例,展示了Request.setNote
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.setNote
方法的具体详情如下:
包路径:org.apache.catalina.connector.Request
类名称:Request
方法名:setNote
[英]Bind an object to a specified name in the internal notes associated with this request, replacing any existing binding for this name.
[中]将对象绑定到与此请求关联的内部注释中的指定名称,替换此名称的任何现有绑定。
代码示例来源:origin: magro/memcached-session-manager
/**
* {@inheritDoc}
*/
@Override
public void invoke( final Request request, final Response response ) throws IOException, ServletException {
final Object processRequest = request.getNote(RequestTrackingHostValve.REQUEST_PROCESS);
if(processRequest != Boolean.TRUE) {
request.setNote(INVOKED, Boolean.TRUE);
try {
getNext().invoke( request, response );
} finally {
request.setNote(RequestTrackingHostValve.REQUEST_PROCESSED, Boolean.TRUE);
}
}
else {
boolean sessionIdChanged = false;
try {
request.setNote(INVOKED, Boolean.TRUE);
sessionIdChanged = changeRequestedSessionId( request, response );
getNext().invoke( request, response );
} finally {
request.setNote(RequestTrackingHostValve.REQUEST_PROCESSED, Boolean.TRUE);
request.setNote(RequestTrackingHostValve.SESSION_ID_CHANGED, Boolean.valueOf(sessionIdChanged));
}
}
}
代码示例来源:origin: magro/memcached-session-manager
@Nonnull
protected static String getURIWithQueryString( @Nonnull final Request request ) {
final Object note = request.getNote(MSM_REQUEST_ID);
if(note != null) {
// we have a string and want to save cast
return note.toString();
}
final StringBuilder sb = new StringBuilder(30);
sb.append(request.getMethod())
.append(' ')
.append(request.getRequestURI());
if(!isPostMethod(request) && request.getQueryString() != null) {
sb.append('?').append(request.getQueryString());
}
final String result = sb.toString();
request.setNote(MSM_REQUEST_ID, result);
return result;
}
代码示例来源:origin: magro/memcached-session-manager
@Test
public final void testRequestIsMarkedAsProcessed() throws IOException, ServletException {
_sessionTrackerValve.invoke( _request, _response );
verify(_request).setNote(eq(RequestTrackingHostValve.REQUEST_PROCESSED), eq(Boolean.TRUE));
}
代码示例来源:origin: magro/memcached-session-manager
@Test
public final void testProcessRequestNotePresent() throws IOException, ServletException {
_sessionTrackerValve.invoke( _request, _response );
verify( _service, never() ).backupSession( anyString(), anyBoolean(), anyString() );
verify(_request).setNote(eq(RequestTrackingHostValve.REQUEST_PROCESS), eq(Boolean.TRUE));
}
代码示例来源:origin: magro/memcached-session-manager
@Test
public final void testChangeSessionIdForRelocatedSession() throws IOException, ServletException {
final String sessionId = "bar";
final String newSessionId = "newId";
when( _request.getRequestedSessionId() ).thenReturn( sessionId );
when( _service.changeSessionIdOnMemcachedFailover( eq( sessionId ) ) ).thenReturn( newSessionId );
_sessionTrackerValve.invoke( _request, _response );
verify( _request ).changeSessionId( eq( newSessionId ) );
verify(_request).setNote(eq(RequestTrackingHostValve.SESSION_ID_CHANGED), eq(Boolean.TRUE));
}
代码示例来源:origin: org.glassfish.main.security/websecurity
public void setNote(String name, Object value) {
httpRequest.setNote(name, value);
}
代码示例来源:origin: com.tomitribe.tribestream/tribestream-container
public static void set(final Request request, final RequestContext requestContext) {
request.setNote(Constants.REQUEST_NOTE_PREFIX + Constants.REQUEST_NOTE_CONTEXT, requestContext);
}
代码示例来源:origin: magro/memcached-session-manager
request.setNote(REQUEST_IGNORED, Boolean.TRUE);
getNext().invoke( request, response );
} finally {
request.setNote(REQUEST_PROCESS, Boolean.TRUE);
代码示例来源:origin: de.javakaffee.msm/memcached-session-manager
/**
* {@inheritDoc}
*/
@Override
public void invoke( final Request request, final Response response ) throws IOException, ServletException {
final Object processRequest = request.getNote(RequestTrackingHostValve.REQUEST_PROCESS);
if(processRequest != Boolean.TRUE) {
request.setNote(INVOKED, Boolean.TRUE);
try {
getNext().invoke( request, response );
} finally {
request.setNote(RequestTrackingHostValve.REQUEST_PROCESSED, Boolean.TRUE);
}
}
else {
boolean sessionIdChanged = false;
try {
request.setNote(INVOKED, Boolean.TRUE);
sessionIdChanged = changeRequestedSessionId( request, response );
getNext().invoke( request, response );
} finally {
request.setNote(RequestTrackingHostValve.REQUEST_PROCESSED, Boolean.TRUE);
request.setNote(RequestTrackingHostValve.SESSION_ID_CHANGED, Boolean.valueOf(sessionIdChanged));
}
}
}
代码示例来源:origin: org.keycloak/keycloak-saml-tomcat-adapter-core
protected SamlSessionStore getSessionStore(Request request, HttpFacade facade, SamlDeployment resolvedDeployment) {
SamlSessionStore store = (SamlSessionStore)request.getNote(TOKEN_STORE_NOTE);
if (store != null) {
return store;
}
store = createSessionStore(request, facade, resolvedDeployment);
request.setNote(TOKEN_STORE_NOTE, store);
return store;
}
代码示例来源:origin: magro/memcached-session-manager
request.setNote(NEW_SESSION_ID, sessionId);
代码示例来源:origin: chexagon/redis-session-manager
/**
* Get the full query string of the request; used only for logging
*
* @param request
* @return
*/
private String getQueryString(final Request request) {
final StringBuilder sb = new StringBuilder();
sb.append(request.getMethod()).append(' ').append(request.getRequestURI());
if (!isPostMethod(request) && request.getQueryString() != null) {
sb.append('?').append(request.getQueryString());
}
final String result = sb.toString();
request.setNote(REQUEST_QUERY, result);
return result;
}
代码示例来源:origin: de.javakaffee.msm/memcached-session-manager
@Nonnull
protected static String getURIWithQueryString( @Nonnull final Request request ) {
final Object note = request.getNote(MSM_REQUEST_ID);
if(note != null) {
// we have a string and want to save cast
return note.toString();
}
final StringBuilder sb = new StringBuilder(30);
sb.append(request.getMethod())
.append(' ')
.append(request.getRequestURI());
if(!isPostMethod(request) && request.getQueryString() != null) {
sb.append('?').append(request.getQueryString());
}
final String result = sb.toString();
request.setNote(MSM_REQUEST_ID, result);
return result;
}
代码示例来源:origin: org.keycloak/keycloak-tomcat-core-adapter
protected AdapterTokenStore getTokenStore(Request request, HttpFacade facade, KeycloakDeployment resolvedDeployment) {
AdapterTokenStore store = (AdapterTokenStore)request.getNote(TOKEN_STORE_NOTE);
if (store != null) {
return store;
}
if (resolvedDeployment.getTokenStore() == TokenStore.SESSION) {
store = createSessionTokenStore(request, resolvedDeployment);
} else {
store = new CatalinaCookieTokenStore(request, facade, resolvedDeployment, createPrincipalFactory());
}
request.setNote(TOKEN_STORE_NOTE, store);
return store;
}
代码示例来源:origin: org.keycloak/spring-boot-container-bundle
protected AdapterTokenStore getTokenStore(Request request, HttpFacade facade, KeycloakDeployment resolvedDeployment) {
AdapterTokenStore store = (AdapterTokenStore)request.getNote(TOKEN_STORE_NOTE);
if (store != null) {
return store;
}
if (resolvedDeployment.getTokenStore() == TokenStore.SESSION) {
store = createSessionTokenStore(request, resolvedDeployment);
} else {
store = new CatalinaCookieTokenStore(request, facade, resolvedDeployment, createPrincipalFactory());
}
request.setNote(TOKEN_STORE_NOTE, store);
return store;
}
代码示例来源:origin: org.apache.tomee/tomee-catalina
if (request != null) {
final Object securityContext = securityService.enterWebApp(this, pcp, OpenEJBSecurityListener.requests.get().getWrapper().getRunAs());
request.setNote(SECURITY_NOTE, securityContext);
} else {
final CUTask.Context context = CUTask.Context.CURRENT.get();
代码示例来源:origin: org.jboss.web/jbossweb
request.setNote(Constants.REQ_SSOID_NOTE, cookie.getValue());
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
request.setNote(Constants.REQ_JASPIC_SUBJECT_NOTE, client);
return true;
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
request.setNote(Constants.REQ_JASPIC_SUBJECT_NOTE, client);
return true;
代码示例来源:origin: de.javakaffee.msm/memcached-session-manager
request.setNote(NEW_SESSION_ID, sessionId);
内容来源于网络,如有侵权,请联系作者删除!