jetty

Set Jetty session cookie name programmatically

早过忘川 提交于 2019-12-07 00:28:26
I'm running in this issue , how can I set session cookie name by code in Jetty 8? ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); sessionHandler = new SessionHandler(); sessionHandler.getSessionManager().setSessionCookie("JSESSIONID_"+runningPort); context.setSessionHandler(sessionHandler); Is wrong, in Jetty8 SessionManager setSessionCookie(String) was removed. Here is the answer: ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); SessionManager sm = new HashSessionManager(); ((HashSessionManager)sm)

Embedded Jetty rewrites not working properly

回眸只為那壹抹淺笑 提交于 2019-12-06 20:23:35
问题 I am trying to implement a simple rewrite rule in an embedded Jetty server, following the Jetty documentation examples. I want requests to /admin/ to rewrite to /admin.html. At the moment if I request /admin/ I get a 404 error with /admin.html not found. But if I request /admin.html directly, it works! There are 2 other similar posts on stackoverflow but no answers to the question! Here's the code: WebAppContext _ctx = new WebAppContext(); _ctx.setContextPath("/"); _ctx.setDefaultsDescriptor

Deploying a servlet programmatically with Jetty

天涯浪子 提交于 2019-12-06 19:36:51
问题 I've got a servlet that I wish to deploy programmatically using Jetty. The servlet uses Spring and it's web.xml points to the Spring context XML file as you'd expect. At the moment, I'm just trying the example code from the Jetty docs but with my own servlet: Server server = new Server(8080); ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); context.setContextPath("/"); server.setHandler(context); context.addServlet(new ServletHolder(new BatchReceiver(

Startup-Log “No Transaction manager found”

戏子无情 提交于 2019-12-06 18:29:25
问题 When I start jetty, following line appears in Log: :INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one. What does it means? How do I know that my webapp requires a transaction manager? Which features serves such transaction manager or what am I missing if I do not have one? 回答1: Typically if you need one, you know you need one. Transaction managers like Atomikos or JOTM are what are being referred to here. Used for distributed

结合Dynamic .NET TWAIN和Jetty,实现基于网页的TWAIN文件扫描

馋奶兔 提交于 2019-12-06 16:34:34
网页TWAIN扫描是通过多种技术结合实现的,看下流程图: 参考原文: Web-based Document Imaging Capture with .Net TWAIN and Jetty 准备工作 阅读: 如何通过jni4net,在Java应用中调用C#接口 使用Jetty搭建Java Websocket Server,实现图像传输 如何运行 在Eclipse中运行Java Application,选择UIMain 当这个窗口启动的时候,Websocket Server已经初始化完成。 Load:加载本地图片 Send:把图片推送到网页客户端 Scan:通过扫描仪扫描文件,把图像自动发送到网页客户端 在Chrome中选择一个扫描仪源 显示TWAIN扫描文件图像 TWAIN网页扫描流程解析 首先把所有相关的库(DLL & Jar)导入到Eclipse工程中: 结合准备工作中两篇文章的代码, 创建一个类 SourceManager : package com.data; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.ArrayList; import javatwain.DotNetScanner;

Jetty responds with 400 Bad Request when request Content-Type is gzip

北慕城南 提交于 2019-12-06 15:44:18
Spring MVC Java 1.8.0_45-b14 backend running on Jetty 9.3.0.v20150612 is working well with uncompressed requests, but fails to accept compressed ones. I've followed Gzip Handler configuration instructions here , made sure these are supported for POST requests as well. Though it doesn't say this configuration is at all for requests... it may be only for responses. etc/jetty-gzip.xml - <Configure id="Server" class="org.eclipse.jetty.server.Server"> <Get id="next" name="handler" /> <Set name="handler"> <New id="GzipHandler" class="org.eclipse.jetty.server.handler.gzip.GzipHandler"> <Set name=

Setting dirAllowed to false in Jetty 8.1.12

我是研究僧i 提交于 2019-12-06 14:59:55
I was using Jetty 6.x where we created a spring based Jetty server with dirAllowed set to false. The config is as follows. <bean id="Server" class="org.mortbay.jetty.Server" init-method="start" destroy-method="stop"> <property name="connectors"> <list> <bean id="Connector" class="org.mortbay.jetty.nio.SelectChannelConnector"> <property name="port" value="${tnplportal.jettyServer.httpPort}" /> <property name="headerBufferSize" value="${tnplportal.jettyServer.headerBufferSize}" /> </bean> </list> </property> <property name="handler"> <bean id="handlers" class="org.mortbay.jetty.handler

java.lang.reflect.InvocationTargetException in jetty-web.xml when setting WebAppContext.configurationClasses

安稳与你 提交于 2019-12-06 14:56:03
问题 I'm trying to add org.eclipse.jetty.annotations.AnnotationConfiguration to the configurationClasses property of org.eclipse.jetty.webapp.WebAppContext but (when invoking Jetty with sbt containe:start ), getting: [warn] Config error at <Set name="configurationClasses"> [warn] <Array type="java.lang.String"><Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item><Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item><Item>org.eclipse.jetty.webapp.MetaInfConfiguration</Item><Item>org.eclipse

Embedded Jetty server hangs

谁都会走 提交于 2019-12-06 14:50:09
I am trying to embedded a jetty server in my program and it seems to hang after each thread gets to server one request. The test case code I wrote is: import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.util.Date; import java.util.concurrent.atomic.AtomicLong; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.StatusLine; import org.apache.http.client.HttpClient;

Apache Shiro with Embedded-Jetty or Spark-Java - Is it possible?

痞子三分冷 提交于 2019-12-06 14:47:57
Does anyone have an example project on how I could integrate Shiro with Spark-Java/Jetty(embedded) please? I can see from http://sparkjava.com/documentation#filters that it must be the way. But not sure what would be the smartest way to do this according to https://shiro.apache.org/web.html If you may have any examples, appreciate much! 来源: https://stackoverflow.com/questions/54835994/apache-shiro-with-embedded-jetty-or-spark-java-is-it-possible