embedded-jetty

Jersey problems with Maven - Shade Plugin

喜你入骨 提交于 2020-01-01 10:04:22
问题 My problem is very similar to: Jersey exception only thrown when depencencies assembled into a single jar I run my application (jetty embedded + jersey) and everything works. When i try to create a executable JAR i get the error: org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor aroundWriteTo GRAVE: MessageBodyWriter not found for media type=application/json, type=class My POM.XML: <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId>

Jetty http session is always null (Embedded Container, ServletHolder)

时光毁灭记忆、已成空白 提交于 2020-01-01 08:56:27
问题 I am trying to implement a simple servlet which uses a HTTP session in an embedded jetty (7.3.0 v20110203) container. To start jetty I use the following code: Server server = new Server(12043); ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.SESSIONS); handler.setContextPath("/"); server.setHandler(handler); ServletHolder holder = new ServletHolder(new BaseServlet()); handler.addServlet(holder, "/*"); server.start(); server.join(); The servlet acquires a

Embedded Jetty - Spring MVC - view resolver - NO XML - HTTP ERROR: 404

不想你离开。 提交于 2020-01-01 03:26:40
问题 I'm trying to set up a simple Spring MVC server using embedded Jetty. I've set up the server, enabled spring and configured a view resolver for .jsp files. The controller gives me 404 with the following message: Problem accessing /jsp/test.jsp. Reason: Not Found Does anyone know what the problem is? I've been googling for two days. The server: private static final int DEFAULT_PORT = 8080; private static final String CONTEXT_PATH = "/"; private static final String CONFIG_LOCATION = "spring

How to use setThreadPool() in Jetty

妖精的绣舞 提交于 2019-12-31 03:08:08
问题 I wanted to see how to use the setThreadPool() functionality. Let's say my main class is the following: import javax.servlet.SingleThreadModel; import org.eclipse.jetty.server.Server; public class FServer implements SingleThreadModel { public static void main(String[] args) throws Exception { Server server = new Server(x); server.setHandler(new Handler()); server.start(); server.join(); } } When trying to add the setThreadPool() , I'm always asked to implement abstract methods. My question is

How to start an aggregate jetty-server JAR from Ant?

老子叫甜甜 提交于 2019-12-30 13:24:48
问题 Background Disclaimer: I have very little experience with Java. We previously used a wrapped version of Jetty 6 for on-demand static content (JS, CSS, images, HTML) during our Ant build so we can run unit tests with PhantomJS against an HTTP-hosted environment. However, Jetty is now on version 8.1.3 and we no longer need that wrapping (which solves a different problem which is now moot), so I wanted to update to just using Jetty 8.1.3 directly. First I downloaded the whole Jetty distribution,

Jetty : Dynamically removing the registered servlet

ε祈祈猫儿з 提交于 2019-12-30 06:45:10
问题 I created and started jetty server with WebAppContext. I can also add servlet to the WebAppContext with addServlet method. But I want to dynamically remove this servlet. How can I do this ? Something like removeServlet() is not provided in the WebAppContext. 回答1: You need to do it manually (there probably should be a convenience method, but there isn't) In Jetty 7 it would be something like ( untested ): public void removeServlets(WebAppContext webAppContext, Class<?> servlet) {

Starting Wicket web application with OSGi HTTP Service

為{幸葍}努か 提交于 2019-12-29 08:07:12
问题 I'm trying to start a Wicket Application using Felix implementation of OSGi HTTP service, for that I just register the service using WicketServlet with applicationClassName parameter: props.put("applicationClassName", MainApplication.class.getName()); service = (HttpService)context.getService(httpReference); service.registerServlet("/", new WicketServlet(), props, null); I have also tried using Felix Whiteboard implementation and registering the web service as a Servlet one: props.put("alias"

How to override jetty.xml with jetty.port

。_饼干妹妹 提交于 2019-12-29 06:45:36
问题 I'm using maven-jetty-plugin and trying to override my jetty.xml setting with the -Djetty.port=8090 but it's not working. Only when I remove the connector part from the jetty.xml file I get the port to be 8090. So: mvn jetty:run -Djetty.port=8090 With the connector starts in port 8080 Without the connector starts in port 8090 Problem is I need to configure acceptors, stats and other stuff. I tried removing only the port from the connector but it didn't work. I'm using: JAVA 1.7_05 MAVEN 3.0.4

Configuring a spring-boot application using web.xml

笑着哭i 提交于 2019-12-28 10:44:47
问题 I'm bootifying an existing Spring Web application so the generated war file embed a Jetty web server. I want to stick to the existing configuration as much as I can in order to limit the regressions. Here is the existing web.xml : <web-app id="fbecart-webapp" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <context-param> <param-name

How to add Access-Control-Allow-Origin to jetty server

本秂侑毒 提交于 2019-12-28 02:13:07
问题 I've got a jetty server to run my web services. Recently I developed a program to consume the web service and ran into Access-Control-Allow-Origin issue. How can I add the Access-Control-Allow-Origin: * to a jetty embedded server. below is the webappcontext code. public WebAppContext buildWebAppContext(){ webAppContext = new WebAppContext(); webAppContext.setDescriptor(webAppContext + "/WEB-INF/web.xml"); webAppContext.setResourceBase("."); webAppContext.setContextPath("/posApplication");