Jan Wieg

Greenhorn
+ Follow
since Nov 23, 2015
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 Jan Wieg

Hey Guys,

I have an Java application with lots of NIO methods like Files.copy, Files.move, Files.delete, FileChannel.. My web application actually works fine with the default UnixFileSystem  and an EncryptedFileSystem to encrypt the physical data on your local machine. What I now trying to achieve: I want to access a remote WebDAV server and modify data on that server with the basic functions like upload, delete or update the remote WebDAV data - without changing every method on my application. So here comes my idea:

I think an WebDAV FileSystem implementation would do the trick. Adding a custom WebDAV FileSystemProvider which is managing the mentioned file operations on the remote data. I've googled a lot and the Apache VFS with Sardine implementation looks good - BUT it seems that the Apache VFS is not compatible with NIO?

Here's some example code:



After that I want to work in my application with localPath1 + localPath2. So that e.g. a Files.copy(localPath1, newRemotePath) would copy a file on the WebDAV server to a new directory.

Is this the right course of action? Or are there other libraries to achieve that?

Thanks for your ideas/advice's,
Jan
2 years ago
I've already solved it by myself.

I have to extend the Servlet with the VelocityViewServlet like this:

public class VelocityServlet extends VelocityViewServlet

Now it works.

Thank you anyway!
In my servlet I do:

-----------------------------
request.setAttribute("users", users);
request.setAttribute("foo2", "foobar");
request.setAttribute("foo1", "foobo");

RequestDispatcher requestDispatcher = request.getRequestDispatcher("/index.vm");
requestDispatcher.forward(request, response);

-----------------------------

And in my index.vm I do:

-----------------------------
<html>
<head> <title>Hello Velocity</title> </head>
<body>
<h1>Hello World!</h1>
<br />

$foo1
<br>
$foo2

</body>
</html>

-----------------------------

But after deploying, the HTML page in the browser looks like:

-----------------------------
$foo1
$foo2
-----------------------------

So the html file can't recieve any data from servlet. My guess is, that there is something wrong with my web.xml. In Velocity I have to do the servlet-mappings'n stuff - in JSP/JSTL I do this with the Annotation 'WebServlet()'.

Maybe you could have a look at the web.xml (see my original post above).

Thank you!
Hallo there,

I'm trying to get started with the velocity template engine. I've followed this tutorial:

Link

My problem is, after I deploy my application on Tomcat 8, I miss the dynamic data generated by my servlet in the velocity template. There is only the html stuff I added in the .vm file directly.

---------------------------------

- index.vm: http://pastebin.com/2UbMLCpy

- VelocityServlet: http://pastebin.com/2XuZyKJG

- User Bean: http://pastebin.com/dyRSw3Qz

- web.xml: http://pastebin.com/YxCRrhL2

---------------------------------

With normal JSP/JSTL this would be an easy task, but for a new job beginning in january I have to practise with Velocity. :/

Thanks for your help & greetings,
Jan