org.jasig.portlet.widget.servlet.mvc
Class DictionaryDataController

java.lang.Object
  extended by org.jasig.portlet.widget.servlet.mvc.DictionaryDataController

@Controller
@RequestMapping(value="/ajax/dictionary")
public class DictionaryDataController
extends Object

DictionaryDataController handles AJAX requests for a word definition.

Author:
Jen Bourey

Field Summary
protected  String DICT_ID_PARAM_NAME
           
protected  String DICT_SERVICE_URL
           
protected  org.apache.commons.logging.Log log
           
protected  String WORD_PARAM_NAME
           
 
Constructor Summary
DictionaryDataController()
           
 
Method Summary
protected  String getCacheKey(String word, String dict)
          Get a cache key for the specified word and dictionary combination.
 org.springframework.web.servlet.ModelAndView getDefinition(javax.servlet.http.HttpServletRequest request, String word, String dict)
          Get a definition for the specified word from the specified dictionary.
protected  String getDefinition(String word, String dict)
          Get the definition from the server.
 void setCache(net.sf.ehcache.Cache cache)
          Cache of definitions.
 void setDictionaryParsingService(IDictionaryParsingService service)
          Set the dictionary parsing service to be used to get a definition from the DictService server response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log

DICT_SERVICE_URL

protected final String DICT_SERVICE_URL
See Also:
Constant Field Values

DICT_ID_PARAM_NAME

protected final String DICT_ID_PARAM_NAME
See Also:
Constant Field Values

WORD_PARAM_NAME

protected final String WORD_PARAM_NAME
See Also:
Constant Field Values
Constructor Detail

DictionaryDataController

public DictionaryDataController()
Method Detail

setDictionaryParsingService

public void setDictionaryParsingService(IDictionaryParsingService service)
Set the dictionary parsing service to be used to get a definition from the DictService server response.

Parameters:
service -

setCache

public void setCache(net.sf.ehcache.Cache cache)
Cache of definitions.

Parameters:
cache -

getDefinition

@RequestMapping(method=GET)
public org.springframework.web.servlet.ModelAndView getDefinition(javax.servlet.http.HttpServletRequest request,
                                                                                 @RequestParam(value="word")
                                                                                 String word,
                                                                                 @RequestParam(value="dictId")
                                                                                 String dict)
                                                           throws Exception
Get a definition for the specified word from the specified dictionary.

Parameters:
request -
word -
dict -
Returns:
Throws:
Exception

getDefinition

protected String getDefinition(String word,
                               String dict)
Get the definition from the server.

Parameters:
word -
dict -
Returns:

getCacheKey

protected String getCacheKey(String word,
                             String dict)
Get a cache key for the specified word and dictionary combination.

Parameters:
word -
dict -
Returns:


Copyright © 2011 Jasig. All Rights Reserved.