Chrome关闭后,Jsessionid cookie不会过期

我使用Shiro框架进行身份validation。 问题是:当我关闭Chrome浏览器并再次打开它时,我仍然可以访问受保护的URL。 如果我手动删除jsessionid cookie一切正常,则禁止访问受保护的URL。 在jsessionid的设置中,我看到: Expires:浏览会话结束时 。 所以它应该过期,但事实并非如此。 我也在firefox中进行了这个操作,没有那个问题。 我甚至不知道调查的方式。 PS我不使用shiro remember-mefunction。 但是,无论如何,在使用时,Shiro会创建另一个cookie(名为rememberMe)。

为什么我对winapi GetWindowPlacement的调用失败(使用JNA)?

这些是winapi方法 BOOL WINAPI SetWindowPlacement( _In_ HWND hWnd, _In_ const WINDOWPLACEMENT *lpwndpl ); typedef struct tagWINDOWPLACEMENT { UINT length; UINT flags; UINT showCmd; POINT ptMinPosition; POINT ptMaxPosition; RECT rcNormalPosition; } WINDOWPLACEMENT, *PWINDOWPLACEMENT, *LPWINDOWPLACEMENT; 我的Java代码: – class WINDOWPLACEMENT{ public int length; public int flags; public int showCmd; public POINT ptMinPosition; public POINT ptMaxPosition; public RECT rcNormalPosition; } […]

从透明png精灵制作多边形的算法

说,我有一个游戏对象的精灵,它是一个透明的png图像。 我想从这个图像创建一个包含我的游戏对象的多边形。 我很确定它有一个现有的算法,但我还没有找到。 我希望有类似的东西: public static Polygon getPolygon(BufferedImage sprite) { // get coordinates of all points for polygon return polygon; }

如何使用AJAX响应修改Spring mvc项目中的现有url?

我正在开发一个Spring MVC项目,其中主页有两个输入字段。 两个输入字段都是String类型。 但是regNo字段得到数字,如果用户输入regNo,它应该被带到控制器中的相应方法。 如果用户输入名称,则应将其转到控制器中的相应方法。 web.xml中 <!– Archetype Created Web Application –> contextConfigLocation /WEB-INF/spring/appContext.xml org.springframework.web.context.ContextLoaderListener dispatcher org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring/dispatcher-servlet.xml 1 dispatcher /mvc/* /WEB-INF/jsp/template.jsp 1)id =“WebApp_ID”的目的是什么? tiles.xml 调度员servlet.xml中 <!– –> /WEB-INF/tiles.xml org.springframework.web.servlet.view.tiles2.TilesView ProjectController.java @Controller(“resultController”) public class ResultController { private final ResultService resultService; @Autowired public ResultController(ResultService resultService) { this.resultService = resultService; } @RequestMapping(value =”/template”, method = RequestMethod.GET) […]

Java中的“特殊属性/属性”而不是getter / setter,以避免锅炉板代码

介绍 我正在开发一个开源项目Treez ,我在树视图中组织了所谓的“Atoms”。 这些Atom有时具有很多属性 ,这些属性可以通过树视图中的用户操作或Eclipse代码编辑器中的API进行修改。 我的Atoms本身的属性由可重用的“AttributeAtoms”表示 。 那些包含实际属性值并提供诸如validation之类的附加function(“Atom”的其他可能术语可能是“小部件”,“bean”,“属性”或“树节点”)。 问题(S) 在过去,我为每个Atom属性提供了一个getter / setter对。 这是一项额外的工作,它会增加我的Atom类的大小(参见下面的代码示例)。 现在我正在寻找一种替代解决方案 使创建新Atoms的工作量减少(维护它们的工作量减少)。 避免“冗余”的getter / setter锅炉板代码。 我将在下面介绍几个选项。 你会使用哪个选项? 您有关于如何改进这些选项的建议吗? 你还知道更多的选择吗? Getter / Setter代码示例 private AttributeAtom myAttribute = new FilePathAttributeAtom(“myAttribtue”); public String getMyAttribute() { return myAttribute.getValue(); } public void setMyAttribute(String value) { this.myAtrribute.setValue(value); } 相关文章 java有类似于C#属性的东西吗? (没有)Java中的属性? http://blog.netopyr.com/2011/05/19/creating-javafx-properties/ http://www.eclipse.org/forums/index.php/t/781816/ 为什么要使用getter和setter? 使用getter和setter的私有属性有什么好处? 考虑的选择 A.使用IDE自动生成getter / […]

将B树节点保留为RandomAccessFile

我的项目正在尝试编写B树。 我无法将树的节点保存到随机访问文件。 我经常遇到EOFexceptions和StreamCorruptionExceptions 。 我目前使用的一些资源是: 在java中将任何对象转换为字节数组 https://inaved-momin.blogspot.com/2012/08/understanding-javaiostreamcorruptedexce.html 当前问题:从节点读取链接位置然后尝试从随机访问文件中读取它会导致StreamCorruptionExceptions 。 目标:能够访问随机访问文件中的所有节点,修改并将其写回随机访问文件。 Test.java import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.RandomAccessFile; import java.util.ArrayList; public class Test { public static void main(String[] args) throws IOException, ClassNotFoundException { //JsoupTestStringManipulating(); //testAdd(); //testFindPredecessor(); //testDelete(); //testPrefexFind(); //testSave(); testSave2(); } public static void JsoupTestStringManipulating(){ JsoupParser pars = new JsoupParser(); […]

HashMap和垃圾收集:我需要在变量重新赋值之前调用clear()吗?

也许这是一个愚蠢的问题,但我不确定垃圾收集过程。 考虑以下代码: private HashMap configuration = new HashMap(); … //add some items to configuration … //now get another configuration HashMap parameters = new HashMap(); for (String parameterName : configurationParameterNameList) { parameters.put(parameterName, reader.readParameter(parameterName)); } //and reassign the variable this.configuration.clear(); this.configuration = parameters; 在重新分配之前,我是否需要调用configuration.clear() ? Parameter类里面只包含几个String变量。

如何在不同的camel路由上的方法之间共享对象

我在网上搜索没有运气的东西,我觉得这很简单,但显然不是。 我想要做的就是在一个在camel路由中调用的方法中创建一个HashSet,然后将这个HashSet传递给另一个camel路由中的方法。 我的搜索返回的是我应该使用缓存,但我找不到任何示例(一个简单的例子),它将告诉我如何实现它。 第一个路径中的方法“findProperties”创建一个HashSet,我想在“parseFile”方法的第二个路径中使用它。 from(“file:{{List}}?noop=true”) .autoStartup(true) .unmarshal().csv() .to(“bean:ParserUtils?method=findProperties”) .end(); from(“file:{{Path}}?move={{processedPath}}”) .autoStartup(true) .unmarshal().csv() .to(“bean:Parser?method=parseFile”) .end() 我真的很感激在缓存或其他解决方案中获取和设置对象的简单示例。

SMO,WEKA中的顺序最小优化

我是Weka的新手。 我想在WEKA中使用顺序最小优化。 谁能告诉我怎么办? 这是我的Java代码,但它不起作用: public class SVMTest { public void test(File input) throws Exception{ File tmp = new File(“tmp-file-duplicate-pairs.arff”); String path = input.getParent(); //tmp.deleteOnExit(); ////removeFeatures(input,tmp,useType,useNames, useActivities, useOccupation,useFriends,useMailAndSite,useLocations); Instances data = new weka.core.converters.ConverterUtils.DataSource(tmp.getAbsolutePath()).getDataSet(); data.setClassIndex(data.numAttributes() – 1); Classifier c = null; String ctype = null; boolean newmodel = false; ctype =”SMO”; c = new SMO(); String[] options […]

如何在WireMock中成功获取HTTPS端点代理?

我正在编写一个内部使用WireMock的HTTP记录回放代理,并且在记录HTTPS目标时遇到问题。 HTTP站点工作正常。 以下是我为未加密的网站设置WireMock代理的方法: java \ -jar /var/proximate/wiremock-standalone-2.4.1.jar \ –port 9000 \ –proxy-all http://ilovephp.jondh.me.uk \ –record-mappings \ –root-dir /remote/experiment/record/http 然后,我可以使用此命令在该站点上记录任何内容: wget -e use_proxy=yes -e http_proxy=proximate-proxy:9000 \ http://ilovephp.jondh.me.uk/en/tutorial/make-your-own-blog 在短时间内,我将获得一些自动创建的映射: / # ls -R /remote/experiment/record/http /remote/experiment/record/http: __files mappings /remote/experiment/record/http/__files: body-tutorial-make-your-own-blog-tWrNm.txt /remote/experiment/record/http/mappings: mapping-tutorial-make-your-own-blog-tWrNm.json 这是一回事,但在SSL网站上。 代理优先: java \ -jar /var/proximate/wiremock-standalone-2.4.1.jar \ –port 9000 \ –proxy-all https://www.rottentomatoes.com/ \ –record-mappings \ –root-dir […]