Search in sources :

Example 1 with ManagedServlet

use of io.undertow.servlet.core.ManagedServlet in project undertow by undertow-io.

the class HttpServletRequestImpl method parseFormData.

private FormData parseFormData() {
    if (parsedFormData == null) {
        if (readStarted) {
            return null;
        }
        final ManagedServlet originalServlet = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY).getCurrentServlet().getManagedServlet();
        final FormDataParser parser = originalServlet.getFormParserFactory().createParser(exchange);
        if (parser == null) {
            return null;
        }
        readStarted = true;
        try {
            return parsedFormData = parser.parseBlocking();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
    return parsedFormData;
}
Also used : ManagedServlet(io.undertow.servlet.core.ManagedServlet) FormDataParser(io.undertow.server.handlers.form.FormDataParser) IOException(java.io.IOException)

Example 2 with ManagedServlet

use of io.undertow.servlet.core.ManagedServlet in project undertow by undertow-io.

the class HttpServletRequestImpl method setCharacterEncoding.

@Override
public void setCharacterEncoding(final String env) throws UnsupportedEncodingException {
    if (readStarted) {
        return;
    }
    try {
        characterEncoding = Charset.forName(env);
        final ManagedServlet originalServlet = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY).getOriginalServletPathMatch().getServletChain().getManagedServlet();
        final FormDataParser parser = originalServlet.getFormParserFactory().createParser(exchange);
        if (parser != null) {
            parser.setCharacterEncoding(env);
        }
    } catch (UnsupportedCharsetException e) {
        throw new UnsupportedEncodingException();
    }
}
Also used : ManagedServlet(io.undertow.servlet.core.ManagedServlet) UnsupportedCharsetException(java.nio.charset.UnsupportedCharsetException) FormDataParser(io.undertow.server.handlers.form.FormDataParser) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Example 3 with ManagedServlet

use of io.undertow.servlet.core.ManagedServlet in project undertow by undertow-io.

the class ServletContextImpl method getServletRegistration.

@Override
public ServletRegistration getServletRegistration(final String servletName) {
    ensureNotProgramaticListener();
    final ManagedServlet servlet = deployment.getServlets().getManagedServlet(servletName);
    if (servlet == null) {
        return null;
    }
    return new ServletRegistrationImpl(servlet.getServletInfo(), servlet, deployment);
}
Also used : ManagedServlet(io.undertow.servlet.core.ManagedServlet)

Aggregations

ManagedServlet (io.undertow.servlet.core.ManagedServlet)3 FormDataParser (io.undertow.server.handlers.form.FormDataParser)2 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 UnsupportedCharsetException (java.nio.charset.UnsupportedCharsetException)1