I am new to Red5. From my Red5 webapp I need to provide static content (in external directory) as a resource. In red5-web.xml,
<mvc:resources mapping="/videos/**" location="file:/user/recordings/" />
I spent lot of time but could not figure out why its not working (getting 404).
Any suggestions will be very helpful. Thank you.
Since Red5 uses embedded Tomcat for its Java EE container, you should be able to externally link resources via their configuration. In addition, there should be no restrictions that I know of when using Spring MVC (if that's what you're using).
Here are some links for you to review:
Tomcat Context
Serving external images
Source paths and Aliases
Related
I see that it uses HTML, CSS, and JS, but does that package with the app or does it need a server if it is a static page?
Also if a server is needed could i get away with hosting on Github pages.
Your HTML, CSS, and JS files are bundled with the app bundle and loaded from local storage. This means that your content comes from file:// (unless you have certain plugins installed that create an http server on localhost).
You'll only need a server if you need one as a backend (which you'd communicate with via XHR/Ajax).
I'm planning to create a pure Dart application where both the HTTP server and the web client side is written in Dart. Coming from Java and Eclipse the ultimate would be that i can open the whole project hierarchy in Dart Editor and be able to run the server which serves the client files and debug both sides of the app (server side with the DartVM and client side with Dartium).
I've fired up Dart Editor and after creating a simple Command-line application as the basis for the server side i got confused with the project layout.
The direct server side code files (web server boostrap class, handler and filter classes) are definietly going into the projects bin/ folder. Server side dependencies are going into the project's pubspec.yaml file.
The problem arrises when the server have to access the client application files (.dart files, static page source, etc.) in order to serve them to the browser. The easiest solution would be to create a web folder inside the server project and put client web files there, but this way (as far as i understood) server side dependencies are inherited into the client because we are still in the same pubspec scope. I don't want this.
I thought about creating a client library in the projects lib/ folder and put web files there but i don't know how good practice is to put a complete web application into there. I guess i have to put HTML and other client static files into the asset/ subfolder of the lib. I'm affraid that i'm loosing web application assist from the IDE this way.
What i might also be able to do is to put the client into a separate project, organize it like a Dart webapp project with it's very own pubspec.yaml and then make this the dependency of the server application somehow. I don't know if this way the server could access web files in the other project for serving. Probably this is the best way of doing it because it provides a clean separation of the client and server files.
Can somebody enlighten me what's the correct way of doing this?
Some more explanation.
Say i'm going with the separate project approach as others already suggesting in the answers but i still like to run the server which is able to serve the client in the development phase without any fancy hack. The server has to access the client files in the other project. It doesn't matter if its Javascript or Dart, the static files are there anyway. And during development i wish to serve the dart files since Dartium speeds up development with it's direct Dart running capability significantly.
With Java and Maven i can make the client package a runtime dependency of the server and i can simply serve the client files from the classpath. Does Dart support accessing a pub dependency's internal files the similar way or the only way for this is to put everything into the asset folder of the client or going with the relative path hack?
This is work in progress:
prepare a Dart app for server-side deployment
To improve the development experience you may use a symlink as a workaround so that you have the client files available in a directory of the server package.
I suggest creating a feature request at http://www.dartbug.com/new for better support.
I would go for two separate projects.
You won't need to make the client package a dependency on the server package.
The server only needs to know where the directory with the build output of the client package is.
Which files to serve is usually requested by the client.
The client requests e.g. index.html and all further dependencies (.dart, .hmtl, .js, .img, .css, ...) are hard-coded in this file and therefore the server should not need to know any further details beforehand.
I'd suggest organising two separate projects. There are a few things that you might profit from if you use this approach. The most obvious there's no coupling between client and server, you get a very clear separation. The other one is that your server can evolve independently of the client. Dart applications will need to be compiled to javascript. In the end you will have a dart server app serving javascript files (+ maybe dart files if you decide to do so). Some of the packages that you use on the server side are not available in dartium - you don't want to have to deal with this dependency mess. Your server might consist of more then just one app, maybe your server will have a module in java or some other language. Keeping this two project separately gives you a lot more flexibility.
I'm new to web servers and would appreciate your help. I was given JSP files (and some other css and javascript files) and I'm trying to figure out a way to quickly get these JSP files up and running on the Apache Tomcat server just to view them. I got the Tomcat server running using Eclipse, but now I'm not sure how I can run the JSP files. Do I need a web.xml file? I've looked at some examples of web.xml but I am not sure what pieces are needed.
If there is anything that you can give me to lead me in the right direction, it would be extremely helpful. Thanks in advance!
Have a look here: http://www.vogella.com/articles/EclipseWTP/article.html
In short:
Install the WTP extension and create a new Dynamic Web Project. Set the project to run with the Tomcat managed by Eclipse.
Then copy your JSPs to the project and start Tomcat through Eclipse.
Maybe you can convert your existing project to a Dynamic Web Project.
I have a simple site, that uses just four HTML pages. One page has a <div id=main_container /> element. From the GWT application I use the RootPanel.get("main_container") to access that element. The GWT app uses GWT-RPC to connect to a server (written in java). My problem is how to test it on xampp, because if I compile the GWT app and upload the war files and put inside it the four HTML files, then I can access all of the pages except the one that contains the <div> element. I need some help here!
If you are using GWT-RPC, you also need an Application Server like jetty or tomcat. Apache alone is not enough.
If you are developing your app, there is no need for apache as you can run your whole web app in DevMode or just jetty.
In production what you want to do is set up Apache as a proxy to your web app running on jetty. Just to be clear, you cannot run a GWT app that also uses GWT-RPC on most shared host environments.
I have a Adobe Flash Builder GUI application that connects to Red5 to communicate.
can i use the red5 to call facebook API calls? can anyone provide an example? all the examples that i can find are with tomcat.
thanks!
Unfortunately they can't.
facebook-java-api cannot work with red5 because it requires the session data that does not pass into red5 and uses variables that i received only by a java Servlet.
there is also a facebook java api called TinyFbClient (www.socialjava.com).
this client is small, very easy to understand with very nice examples.
here i didn't have to use sessions, but i do need to get the uid of the user i want to query on. the client side can forward that information when needed.
TinyFbClient depends on jersey (http://download.java.net/maven/2/com/sun/jersey/) but unfortunately jersy does not compile on red5 properly. if you'll try to use the binary version you'll just get the error
java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl
and that is because the compiled binary cannot operate properly.
I resolved the issue by installing tomcat and allowing the user to connect to tomcat first, with tomcat i fetch the session and the relevant facebook data, stores it in a database and then with red5 i manipulate the data as needed.
hopefully this information will be found useful.
update
i had the previous error message because i did not copy the relevant jars (jersey and jsr311) to the red5 directory. unfortunately it did not solve the problem.
i tried different versions of jersey (1.0.x,1.1.x,1.2). the code did compile but any calls to a facebook api would just stop the application.
i decided to do the facebook information fetching part in tomcat and then to deliver it to red5.
Yes, it can work in Red5. Especially if you had it working in Tomcat, since we provide an embedded Tomcat server.