Permalink
Browse files

minor null pointer fixes if Legend graphic element is not presentsrc/…

…org/deegree/security/owsrequestvalidator/wms/
  • Loading branch information...
jeichar
jeichar committed Nov 10, 2008
1 parent 8bacdd8 commit 271b027bd39a30279ffada24bba81c1bf3dc321f
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry path="src" kind="src"/>
<classpathentry path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.5" kind="con"/>
<classpathentry path="org.eclipse.jst.j2ee.internal.web.container" kind="con"/>
<classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER" kind="con"/>
<classpathentry path="build/classes" kind="output"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
@@ -1,4 +1,3 @@
#Mon Dec 04 16:39:09 CET 2006
classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER\:\:org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType\:\:java-1.5.0-sun-1.5.0.08/owners=jst.java\:5.0
classpath.helper/org.eclipse.jst.server.core.container\:\:org.eclipse.jst.server.tomcat.runtimeTarget\:\:Apache\ Tomcat\ v5.5/owners=jst.web\:2.4
#Tue Nov 04 10:22:09 CET 2008
classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER\:\:org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType\:\:jdk1.5.0_15/owners=jst.java\:5.0
eclipse.preferences.version=1
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v5.5"/>
<fixed facet="jst.java"/>
<fixed facet="jst.web"/>
<installed facet="jst.java" version="5.0"/>
@@ -2,7 +2,7 @@
<services>
<!-- sample WMS servers -->
<service serviceId="mistra"
-<service serviceId="mistra"
serviceDescription="Mistra WMS (only inside Swisstopo network)"
serviceEndPoint="http://test4-swisstopogeodata.lt.admin.ch/wms-mistra">
<roles>
@@ -26,6 +26,14 @@
<role>role1</role>
</roles>
</service>
<service serviceId="jpl"
serviceDescription="JPL"
serviceEndPoint="http://wms.jpl.nasa.gov/wms.cgi">
<roles>
<role>tomcat</role>
</roles>
</service>
<service serviceId="vmap" serviceDescription="Metacarta vmap"
serviceEndPoint="http://labs.metacarta.com/wms/vmap0?">
@@ -166,6 +166,60 @@
</auth-constraint>
</security-constraint>
<filter>
<filter-name>OWSProxyServletFilter_jpl</filter-name>
<filter-class>
org.deegree.security.owsproxy.OWSProxyServletFilter
</filter-class>
<init-param>
<param-name>WMS:POLICY</param-name>
<param-value>/WEB-INF//wmsPolicy_jpl.xml</param-value>
</init-param>
<init-param>
<param-name>ALTREQUESTPAGE</param-name>
<param-value>/accessDenied.html</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>OWSProxyServletFilter_jpl</filter-name>
<servlet-name>jpl</servlet-name>
</filter-mapping>
<filter>
<filter-name>OWSLoggerFilter_jpl</filter-name>
<filter-class>com.camptocamp.owsproxy.OWSLoggerFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>OWSLoggerFilter_jpl</filter-name>
<servlet-name>jpl</servlet-name>
</filter-mapping>
<servlet>
<description/>
<display-name>JPL</display-name>
<servlet-name>jpl</servlet-name>
<servlet-class>com.camptocamp.owsproxy.OWSProxyServlet</servlet-class>
<init-param>
<param-name>serviceEndPoint</param-name>
<param-value>http://wms.jpl.nasa.gov/wms.cgi</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>jpl</servlet-name>
<url-pattern>/jpl</url-pattern>
</servlet-mapping>
<security-constraint>
<display-name>Ows Proxy Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/jpl</url-pattern>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>tomcat</role-name>
</auth-constraint>
</security-constraint>
<filter>
<filter-name>OWSProxyServletFilter_vmap</filter-name>
<filter-class>
org.deegree.security.owsproxy.OWSProxyServletFilter
@@ -2,12 +2,34 @@
<OWSPolicy service="WMS" xmlns="http://www.deegree.org/security">
<Security></Security>
<Requests>
<GetMap>
</GetMap>
<GetFeatureInfo>
</GetFeatureInfo>
<GetCapabilities>
</GetCapabilities>
<GetMap>
<Preconditions>
<Parameter name="bbox">
<Role name="tomcat">
<Value>-2486119,840341,-1033438,240015,EPSG:42304
</Value>
</Role>
</Parameter>
<Parameter name="layers">
<Role name="tomcat">
<Value>park</Value>
<Value>bathymetry</Value>
</Role>
</Parameter>
</Preconditions>
</GetMap>
<GetCapabilities>
<PostConditions>
<Parameter name="layers">
<Role name="tomcat">
<Value>park</Value>
<Value>bathymetry</Value>
</Role>
</Parameter>
</PostConditions>
</GetCapabilities>
<GetFeatureInfo>
</GetFeatureInfo>
<GetLegendGraphic>
</GetLegendGraphic>
</Requests>
@@ -1,8 +1,11 @@
package com.camptocamp.owsproxy;
import java.io.IOException;
import java.io.InputStream;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -11,8 +14,6 @@
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
import org.deegree.ogcwebservices.wms.operation.GetFeatureInfo;
import org.deegree.security.owsproxy.OWSProxyServletFilter;
/**
* Implementation class for Proxy OWS Servlet
@@ -85,10 +86,14 @@ protected void doGet(HttpServletRequest request,
response.setContentType(contentTypeHeader.getValue());
}
byte[] responseBody = method.getResponseBody();
response.getOutputStream().write(responseBody);
byte[] cache = new byte[response.getBufferSize()];
InputStream in = method.getResponseBodyAsStream();
ServletOutputStream out = response.getOutputStream();
for (int read = in.read(cache); read > 0; read = in.read(cache)) {
out.write(cache, 0, read);
}
} catch (Exception e) {
throw new ServletException(e);
}
@@ -127,6 +127,9 @@ public void validateRequest( OGCWebServiceRequest request, User user )
userCoupled = false;
Request req = policy.getRequest( "WMS", "GetLegendGraphic" );
if( req==null){
return;
}
// request is valid because no restrictions are made
if ( req.isAny() )
return;

0 comments on commit 271b027

Please sign in to comment.