org.eclipse.jetty.server.LocalConnector Java Examples
The following examples show how to use
org.eclipse.jetty.server.LocalConnector.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContentLengthFilterTest.java From nifi with Apache License 2.0 | 6 votes |
private void configureAndStartServer(HttpServlet servlet, int maxFormContentSize) throws Exception { serverUnderTest = new Server(); localConnector = new LocalConnector(serverUnderTest); localConnector.setIdleTimeout(SERVER_IDLE_TIMEOUT); serverUnderTest.addConnector(localConnector); contextUnderTest = new ServletContextHandler(serverUnderTest, "/"); if (maxFormContentSize > 0) { contextUnderTest.setMaxFormContentSize(maxFormContentSize); } contextUnderTest.addServlet(new ServletHolder(servlet), "/*"); // This only adds the ContentLengthFilter if a valid maxFormContentSize is not provided if (maxFormContentSize < 0) { FilterHolder holder = contextUnderTest.addFilter(ContentLengthFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)); holder.setInitParameter(ContentLengthFilter.MAX_LENGTH_INIT_PARAM, String.valueOf(MAX_CONTENT_LENGTH)); } serverUnderTest.start(); }
Example #2
Source File: TimedHandlerTest.java From micrometer with Apache License 2.0 | 5 votes |
@BeforeEach void setup() { this.registry = new SimpleMeterRegistry(SimpleConfig.DEFAULT, new MockClock()); this.timedHandler = new TimedHandler(registry, Tags.empty()); this.server = new Server(); this.connector = new LocalConnector(server); server.addConnector(connector); latchHandler = new LatchHandler(); server.setHandler(latchHandler); latchHandler.setHandler(timedHandler); }