How do I make a global helper servlet for all applications?

I am running about five different web applications in tomcat 5.0.24. They all need to do some spelling correction from time to time. I have a spelling correction API and a bunch of dictionaries, etc. so I can do it just fine. The problem is, I don't want each application to create all the dictionaries because then I end up with five spell checking programs and five dictionaries being accessed (basically I am exactly repeating myself five times and I start running out of memory). I would like to have a servlet that just sits waiting all the time and which any other servlet or JSP in any of my web applications can quickly dash of a spell check request to at any time.
How do I do this?
I think I need to write a servlet since I want to run it in tomcat and access it from my webapps, but it might not need to be a servlet since it is never actually contacted from a browser and will not ever write anything back to the client. I just need my other servlets and JSPs to access the spell checking functionality from time to time.

I'd say tomcat/common/lib is a good guess for where you'd put the class's jar file, but I don't use Tomcat so I can't say for sure. As for how to only have one dictionary, you need a singleton class, i.e. one that only permits one instance of the class to be created. Like this, if you haven't heard of it:public class SpellChecker {
  // create a single SpellChecker here:
  private SpellChecker theInstance = new SpellChecker();
  // don't let anybody else create another one:
  private SpellChecker() {}
  // provide a method for returning the single instance:
  public static SpellChecker getInstance() {
    return theInstance;
  // remaining methods go here
  // watch out for synchronization issues
}To get hold of the spell-checker, just doSpellChecker.getInstance()PC²

Similar Messages

  • How can i set a global error page for all error cod

    how can i set a global error page for all error code?
    i don't want to leave a long list in the web.xml file.could any one help me?
    thanks

    If u have a common Error JSP named as ErrorPage.jsp
    You need to have the following piece of code in the JSP as :
    <%@ page isErrorPage ="true"%>
    This makes it as the Common Error Page for the Application. Now all you need to do is from other JSP's throw the Exception to teh container. The container will redirect to this Page and process accordingly.
    Thanks and regards,
    Pazhanikanthan. P

  • I got a new computer. How do I make this the primary pc for all of my apple devices?

    I purchased a new pc. How do I make this the primary pc for iTunes and all of my apple devices? I need to know how to take all Itunes files off old pc and put on new pc. Also, disable old pc.

    Backup your library using this User Tip.
    The same tool can be used to backup other important user data.
    Deauthorise the old computer
    Restore the library into the music folder of your new profile. (Use the same tool as for the backup)
    Install iTunes and sign in to your account.
    tt2

  • Global item for all applications in a workspace

    Hi All,
    Is there a way to set a global item available for all applications in a workspace?

    Sabiha,
    I know this is a bit late, but here's what I did. This answer spans your question a bit but may be helpful to others.
    I have a dev, test, and prod environment so we have difference values depending on the instance. When moving an app from dev to test I don't want to have to modify any substitution strings since that can become a pain and possibilities of someone forgetting something is high.
    1- Great a table called global_values, which has a value_name, and value
    Let's say you wanted to store an email address: admin_email...
    2- Make sure to insert into global_values ('ADMIN_EMAIL, '[email protected]');
    3- For each application you have, create an application item called G_ADMIN_EMAIL
    4- For each application create a process (on login) called: Set Global Values. In this use the util:
    HTMLDB_UTIL.SET_SESSION_STATE (
    p_name => 'G_ADMIN_EMAIL',
    p_value => <function to get the global value> );
    4(extra): For one application item this is ok, but to make it even better, just create a function that will set all the application items so you don't have to change this in all your applications.
    The advantage with all this is that the data is stored in the DB and will help you move from instances without any errors. The disadvantage is that it'll be a slight performance hit since you're calling a function for each user login. You'll also have to add an application_item for each of your applications....
    Martin

  • How can I make a global change so all controls and indicators labels on the front panel change to another colour?

    How can I make a global change so all controls and indicators labels on the front panel change to another colour?
    I need to change the front panel so that it can be used in a dark environment.

    Hi
    The only way I see, is to use the "Controls[]" property and iterate through all of them. But don't forget about nested elements (i.e. clusters, tab-controls, ...).
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...

  • How do I make a table of contents for a collection of six short stories that is after the legal page and NOT in the front on an unnumbered page?

    How do I make a table of contents for a collection of six short stories that is after the legal page and NOT in the front on an unnumbered page?
    When I first started I made a title page and then pasted in my first story from a .TXT file. After cleaning up I went back to the front a couple of empty lines ahead of the story and typed in the story title.  Unlarged the font size and centered it, then

    You can't do that. This is what the Pages User Guide, downloadable from your Pages Help menu, says:
    Creating and Updating a Table of Contents
    Each table of contents (TOC) you create using a Word Processing template lists only the content that follows it, up until the next table of contents. If you want a master table of contents for the entire document, it must be the only table of contents, and it must be at the beginning of the document.
    You can do it manually though.

  • Sorry I'm new to Final Cut Express. How do you make an image (jpeg file for example) move across the screen slowly as I've seen in many films.

    Sorry I'm new to Final Cut Express. How do you make an image (jpeg file for example) move across the screen slowly as I've seen in many films.

    Neil from bristol wrote:
    … How do you make an image … move across the screen …
    by setting KEYFRAMES
    (read, what FC/e's built-in Help-feature tells about it)
    resize and set pic to start position
    set keyframe
    move playhead in timeline to desired length
    set pic to end position
    set keyframe …

  • How do you make a Spry menu view on all pages but only have to change it one place?

    How do you make a Spry menu view on all pages but only have to change it one place? Someone told me maybe I could create a Library item. Any help will be appreciated.

    If your pages all have the same basic design, using a DW Template would be a way to do it...
    http://help.adobe.com/en_US/dreamweaver/cs/using/WScbb6b82af5544594822510a94ae8d65-7abea.h tml

  • How do I make my computer the primary for my iPhone 3G?

    How do I make my computer the primary for my iPhone 3G? I am able to load music from my iTunes library but unable to delete music or create playlists on the phone from itunes. The computer I set the phone up with (primary) was destroyed.

    There is no "main" or " primary" account.
    Iphone, ipod touch, ipad will sycn with one and only one computer at a time.  Syncing to another will indeed erase the current content from the device and replace with content from the new computer.
    Copy everything from the old computer or your backup copy of the old computer, to the new one.

  • How do I make Pages the default program for .doc files?

    How do I make Pages the default program for .doc files without having the need to change the default program for each individual.doc file?

    Navigate to a .doc file.
    Ctrl click the file
    Choose Open with and then go down the list, past pages, to other
    Navigate to pages
    Before you click Open make sure you click the 'Always open with' check box.
    You should be okay.
    You can do a similar think by selecting the file, Choosing File-Get Info
    Then open the Open With Disclosure triangle.
    select pages and then click CHANGE ALL
    Hope this hleps.
    M.

  • How do I make deleted gmail stay deleted? All of a sudden, everything I delete is there again when I open my email the next time.  I am opening it with the icon on the bar at the bottom of my screen.

    How do I make deleted gmail stay deleted? All of a sudden, everything that I have deleted reappears the next time I open the mail.

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try on another computer
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • How can I make Adobe Reader 9 open for incoming PDFs instead of Acrobat 5.0?

    How can I make Adobe Reader 9 open for incoming PDFs instead of Acrobat 5.0?

    Hi,
    Assuming that you have Reader 9.3.4 already installed on your machine, you can try the following to make Reader 9.3.4 as the default PDF opening application:
    1. Right click on any PDF on your system and click on the "Open With" Option in the context menu that appears. In case you get another submenu, click on Chose Program in that menu. (In case you do not see any "Open With" option, then hold down the Shift key and right click on the file)
    2. Click on Browse button in the dialog that appears, and select Reader 9. Make sure that you select the checkbox for "Always use the selected program to open this kind of file"
    3. Click on OK.
    This will make Adobe Reader 9 as the default viewer for all PDFs on your system.

  • How can I make "No Proxy" the default for accessing the internet?

    How can I make "No Proxy" the default for accessing the internet?

    *Tools > Options > Advanced > Network : Connection > Settings
    If you do not need to use a proxy to connect to internet then try to select "No Proxy" if "Use the system proxy settings" or one of the others do not work properly.
    See "Firefox connection settings":
    *https://support.mozilla.org/kb/Firefox+cannot+load+websites+but+other+programs+can

  • HT1807 how do I make sure to encounter charges for roaming but still use my phone on wifi?  I have viber app and would like to message also without additional charges.  Is there a setting I need to hit to ensure this?

    Travel internationally and use my ipohne with wifi, how do I make sure to avoid charges for roaming but still use my internet and messaging on wifi?  I have viber app and would like to message also without additional charges.  Is there a setting I need to hit to ensure this?

    Settings>General>Network>Roaming>Data Roaming>Off. If you really want to be absolutely certain, Settings>General>Network>Cellular Data>Off.

  • How do I make Photoshop 7 my default for viewing photos?

    How do I make Photoshop 7 my default for viewing photos?

    windows 7
    Terry Keiser
    <Removed by Moderator>

Maybe you are looking for