anton moiseev

Greenhorn
+ Follow
since Dec 12, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by anton moiseev

Hi,

I'm looking for a JavaScript raphael's getSubpath (http://raphaeljs.com/reference.html#getSubpath) method analog in pure java.

Batik has getPathSegAtLength(): http://xmlgraphics.apache.org/batik/javadoc/org/apache/batik/dom/svg/SVGPathContext.html#getPathSegAtLength%28float%29

But it would only return existing path segment index, and I need it to split the segment into 2 parts if the point is located on the middle on the segment, so generally it should generate the new path from the provided one.

The path is defined in the following format: "M10,50c0,50,80-50,80,0c0,50-80-50-80,0z"

Probably there is a kind of library which works with paths defined in this format and provides some good math operations to manipulate/transform them in different ways. Batik and SVG Salamander seem to concentrate on the SVG standard support and drawing and I do not need any drawing - only additional util methods.

thank's
7 years ago
My server allows to upload rather big files - it may take up to several hours for upload to finish depending on the connection speed, I can't predict how long it will take. So for sure, I can try to set infinite (ok, 24 hours is enough) session life - seems that I will finally come to this solution, but actually I need such long sessions only for file upload process, so this seems to be rough solution and ineffective in long term.

For the setMaxInactiveInterval - I have checked its source code - it would set only inactive interval value, but will not reset the timer. Still, this might be better, than setting value in servlet context and probably would work as workaround - make the session 24 hours when upload is started and return default value when it is finished, I will try how this would go, thank's.
8 years ago
JSP
ok, it seems that I have found something, but still can't use it. The method I was thinking of is org.apache.catalina.Session.access();

http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/session/StandardSession.html#access%28%29

Tomcat's HttpSession implementation is StandardSession object, which also implements org.apache.catalina.Session interface which has the "access" method.

So, I have tried to call in this way (after adding lib/catalina.jar to project's classpath)
((org.apache.catalina.Session) request.getSession()).access();

this did not work, cause tomcat did not want to deploy web application with catalina.jar as local dependency.

So, I tried reflection (after removing catalina.jar from deps):

request.getSession().getClass().getMethod("access").invoke(request.getSession());

But this did not work either, cause though debugger shows request.session attribute of type StandardSession (which has the "access" method I need), the request.getSession() call returns StandardSessionFacade (http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/session/StandardSessionFacade.html) wrapped around this object, which does not provide access to "access" method of the wrapped session.

So it seems that the call I need is hidden rather well.
8 years ago
JSP
Hi,

I have a tomcat server which allows to upload rather big files in the secured area. I am using apache commons fileupload, so the upload is performing in background on server.

Now, when I login, press "upload" for big file, go away for some time, then return and see the login request page instead of upload success page (I have a script which forwards to another page of the site when upload is finished, but it seems that upload itself fails too) - the session timed out while the file had been uploading. If I make some activity on the site during upload (navigate among pages), the upload would finish fine.

So, what I want to do is to try to keep HttpSession alive programmatically on server side while the file is being uploaded - I have upload progress listener, so it could call something like session.resetTimer() - same thing which is called when the user request some page. But I can't see anything looking like this method in HttpSession class - only session.invalidate() method which is opposite to what I want.

Is there a way to simulate user activity on server side to prolongate the session?

thank's
8 years ago
JSP
Hi, I want to make external dir outside tomcat webapps to be available from web.

To do this, I use the common way - create context file "apache-tomcat/conf/Catalina/localhost/testapp#images.xml" with contents:


So filesystem file "/files/images/img1.png" can be accessed from web as "http://localhost:8080/testapp/images/img1.png"

Until now this works ok. Now I want to make same trick for the ROOT webapp. As it is said here: http://tomcat.apache.org/tomcat-5.5-doc/config/context.html , ROOT application context can be defined as "apache-tomcat/conf/Catalina/localhost/ROOT.xml".

So, I just renamed "apache-tomcat/conf/Catalina/localhost/testapp#images.xml" to "apache-tomcat/conf/Catalina/localhost/ROOT#images.xml" and was expecting that I can now access the files from web with "http://localhost:8080/images/img1.png" in the same way as it worked for "testapp", but this did not work this time - tomcat returns resource not found page.

I have apache-tomcat-7.0.5 running on linux.

thank's
8 years ago
thank's for clarifications, seems that I misunderstood some examples I have found.
8 years ago
JSP
Hi,

I need to use fmt:message tag with custom bundle (which is not specified in web.xml). Use jstl 1.2 with tomcat 7.0.2

The doc and multiple examples ower web show that I should symply use "bunde" tag parameter to load this custom bundle, so I put the tag in this way:

<fmt:message key="message_key" bundle="com.eyewain.messages.GeoTagNamesBundle"/>

and log shows the following error when tries to display this page:

org.apache.jasper.JasperException: Unable to convert string "com.eyewain.messages.GeoTagNamesBundle" to class "javax.servlet.jsp.jstl.fmt.LocalizationContext" for attribute "bundle": Property Editor not registered with the PropertyEditorManager
at org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:849)

But if I put the following construction instead, all works:

<fmt:bundle basename="com.eyewain.messages.GeoTagNamesBundle">
<fmt:message key="message_key"/>:
</fmt:bundle>

Can't understand the principal difference between those 2 constructions. This code is put inside my custom .tag file if that might make sense.

I could only find one relevant post with similar problem:
http://www.coderanch.com/t/516292/JSP/java/JSTL-not-registered-PropertyEditorManager-error

But it seems that their solution does not fit to my situation - I have <web-app version="2.5"...> tag in my web.xml - the version is not 2.3 and even not 2.4 as in the above post.
8 years ago
JSP