Author: deepal
Date: Tue Dec 18 03:18:43 2007
New Revision: 11396
Log:
wso2registry ->wso2registry/web
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/config/RegistryConfiguration.java
trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/config/RegistryConfiguration.java
==============================================================================
---
trunk/registry/modules/core/src/main/java/org/wso2/registry/config/RegistryConfiguration.java
(original)
+++
trunk/registry/modules/core/src/main/java/org/wso2/registry/config/RegistryConfiguration.java
Tue Dec 18 03:18:43 2007
@@ -25,6 +25,7 @@
import org.wso2.registry.RegistryException;
import org.wso2.registry.i18n.Messages;
+import javax.servlet.ServletConfig;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import java.io.FileInputStream;
@@ -48,7 +49,7 @@
* @throws org.wso2.registry.RegistryException
* : if something went wrong
*/
- public void populateRegistryConfig(String xmlLocation) throws
RegistryException {
+ public void populateRegistryConfig(String xmlLocation, ServletConfig
servletConfig) throws RegistryException {
InputStream in;
if (xmlLocation != null) {
try {
@@ -57,9 +58,14 @@
throw new RegistryException(e.getMessage());
}
} else {
- in =
Thread.currentThread().getContextClassLoader().getResourceAsStream("org/wso2/servlet/registry.xml");
+ in =
servletConfig.getServletContext().getResourceAsStream("/WEB-INF/registry.xml");
if (in == null) {
- throw new
RegistryException(Messages.getMessage("inputstream.null",
"org/wso2/servlet/registry.xml"));
+ in =
Thread.currentThread().getContextClassLoader().getResourceAsStream(
+ "org/wso2/servlet/registry.xml");
+ }
+ if (in == null) {
+ throw new
RegistryException(Messages.getMessage("inputstream.null",
+ "org/wso2/servlet/registry.xml"));
}
}
try {
@@ -118,13 +124,6 @@
}
}
- public static void main(String[] args) throws Exception {
- RegistryConfiguration configuration = new RegistryConfiguration();
- configuration.populateRegistryConfig(null);
- OMElement ele = configuration.getRegistryConfigAsXML();
- System.out.println(ele);
- }
-
public void addDataBaseConfiguration(DataBaseConfiguration
dataBaseConfiguration) {
dbconfgigMap.put(dataBaseConfiguration.getConfigName(),
dataBaseConfiguration);
}
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
==============================================================================
---
trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
(original)
+++
trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
Tue Dec 18 03:18:43 2007
@@ -45,8 +45,6 @@
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
/**
* Servlet for providing REST API for the registry.
@@ -68,10 +66,7 @@
// default registry.xml file bundled with the webapp.
String configPath =
config.getInitParameter(RegistryConstants.REGISTRY_CONFIG_PATH);
RegistryConfiguration registryConfiguration = new
RegistryConfiguration();
- if (configPath == null) {
- configPath = getRegistryConfigPath(config);
- }
- registryConfiguration.populateRegistryConfig(configPath);
+ registryConfiguration.populateRegistryConfig(configPath,config);
config.getServletContext().
setAttribute(RegistryConstants.REGISTRY_CONFIG,
registryConfiguration);
@@ -135,16 +130,6 @@
}
}
- private String getRegistryConfigPath(ServletConfig config) {
- try {
- URL url =
config.getServletContext().getResource("/WEB-INF/registry.xml");
- return url.toString();
- } catch (MalformedURLException e) {
- log.debug(e);
- }
- return null;
- }
-
protected void doPost(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse)
throws ServletException, IOException {
@@ -186,6 +171,8 @@
HttpServletResponse response)
throws ServletException, IOException {
initContextRoot(request);
+ request.getRequestDispatcher("/web")
+ .forward(request, response);
}
/**
_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev