public Deployment getDeployment() { return context.getDeployment(); }
public String encodeURL(String url) { String absolute = toAbsolute(url); if (isEncodeable(absolute)) { // W3c spec clearly said if (url.equalsIgnoreCase("")) { url = absolute; } return originalServletContext.getSessionConfig().rewriteUrl(url, servletContext.getSession(originalServletContext, exchange, true).getId()); } else { return (url); } }
@Override public String getContextPath() { return servletContext.getContextPath(); }
@Override public void setRequestCharacterEncoding(String encoding) { ensureNotInitialized(); ensureNotProgramaticListener(); deploymentInfo.setDefaultRequestEncoding(getContextPath()); }
@Override public String changeSessionId() { HttpSessionImpl session = servletContext.getSession(originalServletContext, exchange, false); if (session == null) { throw UndertowServletMessages.MESSAGES.noSession(); } String oldId = session.getId(); Session underlyingSession; if(System.getSecurityManager() == null) { underlyingSession = session.getSession(); } else { underlyingSession = AccessController.doPrivileged(new HttpSessionImpl.UnwrapSessionAction(session)); } String newId = underlyingSession.changeSessionId(exchange, originalServletContext.getSessionConfig()); servletContext.getDeployment().getApplicationListeners().httpSessionIdChanged(session, oldId); return newId; }
/** * Gets the session * * @param create * @return */ public HttpSessionImpl getSession(final HttpServerExchange exchange, boolean create) { return getSession(this, exchange, create); }
Deployment deployment = requestImpl.getServletContext().getDeployment(); throw UndertowServletMessages.MESSAGES.couldNotFindContextToDispatchTo(requestImpl.getOriginalContextPath()); String toDispatch = requestURI.substring(context.getDeployment().getServletContext().getContextPath().length()); String qs = ((HttpServletRequest) servletRequest).getQueryString(); if (qs != null && !qs.isEmpty()) {
public SessionConfig getSessionConfig() { return context.getSessionConfig(); }
@Override public void handleNotification(SecurityNotification notification) { EventType eventType = notification.getEventType(); HttpSessionImpl httpSession = servletContext.getSession(notification.getExchange(), false); switch (eventType) { case AUTHENTICATED: if (isCacheable(notification)) { if(servletContext.getDeployment().getDeploymentInfo().isChangeSessionIdOnLogin()) { if (httpSession != null) { Session session = underlyingSession(httpSession); httpSession = servletContext.getSession(notification.getExchange(), true);
final InstanceHandle<?> instance = servletContext.getDeployment().getDeploymentInfo().getClassIntrospecter().createInstanceFactory(clazz).createInstance(); handles.add(instance); callbacks.put(path, (ServerSentEventConnectionCallback) instance.getInstance()); servletContext.getDeployment().getDeploymentInfo().addInnerHandlerChainWrapper(new HandlerWrapper() { @Override public HttpHandler wrap(HttpHandler handler) { servletContext.addListener(new ServletContextListener() { @Override public void contextInitialized(ServletContextEvent sce) {
@Override public ServletRegistration.Dynamic addServlet(final String servletName, final String className) { return addServlet(servletName, className, Collections.emptyList()); }
@Override public String getMimeType(String file) { if (SecurityUtil.isPackageProtectionEnabled()) { return (String) doPrivileged("getMimeType", new Object[] { file }); } else { return context.getMimeType(file); } }
@Override public void addListener(final String className) { try { Class<? extends EventListener> clazz = (Class<? extends EventListener>) deploymentInfo.getClassLoader().loadClass(className); addListener(clazz); } catch (ClassNotFoundException e) { throw new IllegalArgumentException(e); } }
@Override public String readAttribute(final HttpServerExchange exchange) { ServletRequestContext context = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY); if (context != null) { Object result = context.getCurrentServletContext().getAttribute(attributeName); if (result != null) { return result.toString(); } } return null; }
public void destroy() { context.destroy(); }
this.deployment = deployment; final ServletContextImpl servletContext = new ServletContextImpl(servletContainer, deployment); deployment.setServletContext(servletContext); handleExtensions(deploymentInfo, servletContext);
public HttpSession getSession(final ServletContextImpl originalServletContext, final HttpServerExchange exchange, boolean create) { SessionConfig c = originalServletContext.getSessionConfig(); ConvergedHttpSessionFacade httpSession = exchange.getAttachment(sessionAttachmentKey); if (httpSession != null && httpSession.isValidIntern()) { final SessionManager sessionManager = context.getDeployment().getSessionManager(); Session session = sessionManager.getSession(exchange, c); if (session != null) { originalServletContext.getSession(originalServletContext, exchange, true); } else if (existing != null) { c.clearSession(exchange, existing);
@Override public HttpSession getSession(final boolean create) { return servletContext.getSession(originalServletContext, exchange, create); }
private void forwardImpl(ServletRequest request, ServletResponse response, ServletRequestContext servletRequestContext) throws ServletException, IOException { final HttpServletRequestImpl requestImpl = servletRequestContext.getOriginalRequest(); final HttpServletResponseImpl responseImpl = servletRequestContext.getOriginalResponse(); if (!servletContext.getDeployment().getDeploymentInfo().isAllowNonStandardWrappers()) { if (servletRequestContext.getOriginalRequest() != request) { if (!(request instanceof ServletRequestWrapper)) { requestImpl.setQueryParameters(newQueryParameters); String newRequestUri = servletContext.getContextPath() + newServletPath; servletRequestContext.setServletResponse(response); if (named) { servletContext.getDeployment().getServletDispatcher().dispatchToServlet(requestImpl.getExchange(), chain, DispatcherType.FORWARD); } else { servletContext.getDeployment().getServletDispatcher().dispatchToPath(requestImpl.getExchange(), pathMatch, DispatcherType.FORWARD);
public SessionConfig getSessionConfig() { return context.getSessionConfig(); }