|
SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here. |
|
Thread Tools | Search this Thread | Display Modes |
#41
|
||||
|
||||
Also, why do I need to add the context name?
Code:
http://harris:8080/YOUR_CONTEXT_NAME/SagePodcastRecorder?name=Sean Code:
http://harris:8080/bmt
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#42
|
||||
|
||||
Quote:
Quote:
Code:
http://harris:8080/sagepodcastrecorder/SagePodcastRecorder?name=sean Think of a context name as a namespace. A web application server may host many different "applications" each with one of more servlets. Without the context, I may have a servlet called "status" and you might have a servlet called "status", and one would overwrite the the other. Quote:
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#43
|
||||
|
||||
Sean,
I tried this, and other variations of upper and lowercase. Nothing worked. Code:
http://harris:8080/sagepodcastrecorder/SagePodcastRecorder?name=Sean
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#44
|
||||
|
||||
Tom, I've attached a sample web app, with context xml and source. You should be able to unzip this in the root of your sagetv home, and then hit the following url
Code:
http://localhost:8080/testweb/TestServlet?name=tom TextWeb.xml (fragment) Code:
<Set name="contextPath">/testweb</Set> Code:
<servlet-mapping> <servlet-name>TestServlet</servlet-name> <url-pattern>/TestServlet</url-pattern> </servlet-mapping> Hope this helps to bring you a little closer.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#45
|
||||
|
||||
Sean,
I REALLY appreciate all of your help on this. You are certainly going "above and beyond" the call of duty... Your test works perfectly. I think my problem lies in "web.xml". I have no "web.xml" and your code does not have one either, so I'm sure I'm missing the boat somewhere. Your zip file has TestWeb.war and TestWeb.xml. Where is "web.xml"? I see a web.xml for bmt that is under ../jetty/webapps/bmt/webapp/WEB-INF but I do not see one for TestWeb. Is "web.xml" something that is inside of the .war file? I'm starting to think I need to add this code someplace in the IDE and have it packaged in the .war. I NetBeans I see two files under WebPages/WEB-INF. One is "beans.xml" and one is "sun-web.xml". sun-web.xml also shows up under the jetty folder where I have deployed my webapp. In the IDE, under WEB-INF I see the option to add: HTMP, Web Service, Web Client, JSP, Servlet, and lots of other options. Of course "Servlet" catches my eye. Also in the IDE I see the option to add "servlet" so I think I am on to something here. I'll get back to you once I sort things out a little further, but I am very hopeful right now. Tom
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#46
|
||||
|
||||
Quote:
Because you opted to use the sun glassfish project, it's a j2ee application server, which is basically an app server on steroids, that is used in the "enterprise" (ee == enterprise edition). j2ee servers deal primarily with "ear" files which is another package format that can contain serveral war files. Typically enterprise servers (glassfish, websphere, weblogic), etc all have their own extensions to the web.xml, that are not recognized by simple app servers like Jetty and Tomcat. What I would do, is stop using glassfish (uninstall it). Install the tomcat server (either download it, or install it as a plugin). If you stick with tomcat or jetty, then I'll think that you'll have more luck with you simply web apps. Then when you create a new "web project", it will create just a standard app server server project without any proprietary extensions. Also, when you create a new servlet (File -> New...) it should automatically wire the web.xml for you, ie, you don't need to manually edit this file. That's how eclipse does it, and I assume somewhere in netbeans, it works the same way. btw, war file are just zip files and so you can check my .war file, and you'll see that I have an web.xml in the WEB-INF/ dir of the .war
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#47
|
||||
|
||||
Sean,
Yup, it's NetBeans related. I was choosing "Web App" instead of "Servlet". I'm about to try it again... Tom
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#48
|
||||
|
||||
Success at last! It was NetBeans related. This AM I actually downloaded and installed Tomcat. The final piece of the puzzle was to choose the right type of project AND I had to use the context.xml that was generated by NetBeans. The context.xml looks like this:
Code:
<?xml version="1.0" encoding="UTF-8"?> <Context antiJARLocking="true" path="/SagePodcastRecorder"/>
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#49
|
||||
|
||||
Another question. In an earlier post it was stated that the servlet processing is synchronous and each time the servlet is called a new thread is created. I get that. What is the best way to keep static data that needs to be saved for subsequent processing?
Here is what I have in mind for the servlet. Downloading a podcast takes time so of course I do not want to make the requester wait for completion. When the requester makes a request I just want to queue it, spawn a thread to handle the download (hopefully that can be done in a servlet) and return to the requester right away. So far so good. If a request is made to download a podcast while one is already downloading, I want to queue that up until the first podcast has downloaded. What is the best way to store the queue (and any other data that needs to be saved because it pertains to all podcast downloads, not just the current one.)
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#50
|
||||
|
||||
Quote:
Quote:
Quote:
It works something like this... Tracker Servlet is called with an action to run -- TrackerId = Tracker.getInstance().runAction(action); -- return TrackerId to the caller (ie http client, in my case i returned xml or json since it's easy to parse) Tracker Servlet is called with the TrackerId from the previous call -- TrackableInfo = Tracker.getInstance().getInfo(TrackerId) -- return TrackerableInfo as json or xml As part of the Tracker code, I use a Timer to periodically clean out tasks where the TrackerInfo has indicated that it has completed... and a certain amount of time has elapsed since it has completed.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#51
|
||||
|
||||
Sean,
OK thanks. When you say use a static member of the servlet class, do you mean I can create static data that does not go away as long as sage is running?
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#52
|
||||
|
||||
Quote:
Code:
public class MyServlet extends HttpServlet { private static Map<String,Tracker> trackers = new HashMap<String,Tracker>(); } Servlets have their own lifecycle as well... there are methods called init() and destroy() that as called when the servlet is initialized (ie, only once) and when the servlet is destroyed. For something like the tracker, you may want to consider using a TrackerManager that has the static reference to the class and NOT put the static reference inside the actual servlet class. Code:
public class TrackerManager { private static final instance TrackerManager = new TrackerManager(); public static TrackerManager getInstance() { return instance; } private Map<String,Tracker> trackers = new HashMap<String,Tracker>(); ... } Code:
public class MyServlet extends HttpServlet { public void doGet(...) { ... String trackerId = TrackerManager.getInstance().runAction(...); } }
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#53
|
||||
|
||||
Trackers - More things to read up on...
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#54
|
||||
|
||||
Keep in mind when I say "Trackers"... that's not a core java thing... I just called it a "Tracker" in bmt... but I still had write the code for it.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#55
|
||||
|
||||
I'd like to say I understand your code, but I don't. I need to chew on things to see if I can wrap my brain around it.
Thanks for the info and things to consider.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#56
|
||||
|
||||
Quote:
I'd start simple, build your own simple single purpose tracker, and then add/extend as you need. If my sample is confusing, then I'd pretend that you never saw it
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#57
|
||||
|
||||
Quote:
These two statements seem contradictory to me. Can you elaborate a little? My first thought is to go with what's easier for me to understand, and that's putting the private static in the "MyServlet" class. I just want to make sure the data really is static until the JVM (i.e. Sage) terminates. Second, Where is a good java developers community that is helpful to beginners. I am sure I'll have loads of java and NetBeans questions and I don't want to keep on bothering you here. For example, I could not get NetBeans to build your example code. It complained about the generics on Map<> and HashMap<> saying that "source level 1.5" was needed. I tried putting the "- source 5" into the command line parameters area in NetBeans but that did not help. I had to build the code without the generics - which I'd rather not do. My thinking is the more checking the compiler can do for me the better
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#58
|
||||
|
||||
Quote:
Quote:
BTW sorry for the brief replies, but I'm on an airplane on my way to google io.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#59
|
||||
|
||||
Thanks. No problem with the short replies either. I'm getting on an airplane tomorrow with the shiny new java programming book I just bought
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Re: Replying to Announcement Threads | MeInMaui | SageTV Customizations | 1 | 07-09-2009 10:49 PM |
Number of threads? | Stuntman | SageTV Beta Test Software | 8 | 11-24-2008 01:00 PM |