Revision 4080
Added by daigle almost 16 years ago
LoginServlet.java | ||
---|---|---|
37 | 37 |
import javax.servlet.http.HttpSession; |
38 | 38 |
|
39 | 39 |
import edu.ucsb.nceas.metacat.client.*; |
40 |
import edu.ucsb.nceas.metacat.service.PropertyService; |
|
41 |
import edu.ucsb.nceas.metacat.util.SystemUtil; |
|
40 | 42 |
import edu.ucsb.nceas.utilities.Options; |
43 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException; |
|
41 | 44 |
|
42 | 45 |
/** |
43 | 46 |
* @author dcosta |
... | ... | |
121 | 124 |
|
122 | 125 |
|
123 | 126 |
/** |
124 |
* Initializes the servlet. Reads properties and initializes object fields.
|
|
125 |
*
|
|
126 |
* @throws ServletException
|
|
127 |
*/
|
|
128 |
public void init(ServletConfig config) throws ServletException {
|
|
129 |
ServletContext context = null; |
|
130 |
String dirPath;
|
|
131 |
Options options = null;
|
|
127 |
* Initializes the servlet. Reads properties and initializes object fields.
|
|
128 |
*
|
|
129 |
* @throws ServletException
|
|
130 |
*/
|
|
131 |
public void init(ServletConfig config) throws ServletException {
|
|
132 |
ServletContext context = null;
|
|
133 |
String dirPath;
|
|
134 |
Options options = null;
|
|
132 | 135 |
|
133 |
super.init(config); |
|
134 |
context = config.getServletContext(); |
|
135 |
dirPath = context.getRealPath(CONFIG_DIR); |
|
136 |
File propertyFile = new File(dirPath, CONFIG_NAME); |
|
137 |
|
|
138 |
try { |
|
139 |
options = Options.initialize(propertyFile); |
|
140 |
} |
|
141 |
catch (IOException e) { |
|
142 |
System.err.println("Error in loading options: " + e.getMessage()); |
|
143 |
} |
|
144 |
|
|
145 |
this.contextString = options.getOption("context"); |
|
146 |
} |
|
136 |
super.init(config); |
|
137 |
context = config.getServletContext(); |
|
138 |
dirPath = context.getRealPath(CONFIG_DIR); |
|
139 |
File propertyFile = new File(dirPath, CONFIG_NAME); |
|
147 | 140 |
|
141 |
try { |
|
142 |
options = Options.initialize(propertyFile); |
|
143 |
this.contextString = PropertyService.getProperty("application.context"); |
|
144 |
} catch (IOException e) { |
|
145 |
System.err.println("Error in loading options: " + e.getMessage()); |
|
146 |
} catch (PropertyNotFoundException pnfe) { |
|
147 |
System.err.println("couldn't read property during initialization: " |
|
148 |
+ pnfe.getMessage()); |
|
149 |
} |
|
150 |
} |
|
148 | 151 |
} |
Also available in: Unified diff
Merge 1.9 changes into Head