Author: aparfonov
Date: 2010-12-23 10:04:43 -0500 (Thu, 23 Dec 2010)
New Revision: 3719
Added:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/ClassPath.java
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/MalformedScriptException.java
Modified:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/GroovyClassLoaderProvider.java
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/GroovyJaxrsPublisher.java
Log:
EXOJCR-1105
Added:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/ClassPath.java
===================================================================
---
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/ClassPath.java
(rev 0)
+++
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/ClassPath.java 2010-12-23
15:04:43 UTC (rev 3719)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.services.rest.ext.groovy;
+
+/**
+ * @author <a href="mailto:andrey.parfonov@exoplatform.com">Andrey
Parfonov</a>
+ * @version $Id$
+ */
+public class ClassPath
+{
+ private ClassPathEntry[] entries;
+
+ private String[] extensions;
+
+ public ClassPath(ClassPathEntry[] entries, String[] extensions)
+ {
+ this.entries = entries;
+ this.extensions = extensions;
+ }
+
+ public ClassPathEntry[] getEntries()
+ {
+ return entries;
+ }
+
+ public String[] getExtensions()
+ {
+ return extensions;
+ }
+}
Property changes on:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/ClassPath.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
===================================================================
---
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java 2010-12-23
15:00:03 UTC (rev 3718)
+++
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java 2010-12-23
15:04:43 UTC (rev 3719)
@@ -41,20 +41,25 @@
{
private static final String[] DEFAULT_SCRIPT_EXTENSIONS = new
String[]{".groovy"};
- protected URL[] roots;
+ protected final String[] extensions;
- protected URL[] files;
+ protected final URL[] roots;
+ protected final URL[] files;
+
// TODO need configurable ?
private int maxEntries = 512;
protected final Map<String, URL> resources;
@SuppressWarnings("serial")
- public DefaultGroovyResourceLoader(URL[] roots, URL[] files) throws
MalformedURLException
+ public DefaultGroovyResourceLoader(URL[] roots, URL[] files, String[] extensions)
throws MalformedURLException
{
this.files = files;
this.roots = new URL[roots.length];
+ if (extensions == null || extensions.length == 0)
+ extensions = DEFAULT_SCRIPT_EXTENSIONS;
+ this.extensions = extensions;
for (int i = 0; i < roots.length; i++)
{
String str = roots[i].toString();
@@ -63,8 +68,7 @@
else
this.roots[i] = roots[i];
}
- resources = Collections.synchronizedMap(new LinkedHashMap<String, URL>()
- {
+ resources = Collections.synchronizedMap(new LinkedHashMap<String, URL>() {
protected boolean removeEldestEntry(Entry<String, URL> eldest)
{
return size() > maxEntries;
@@ -72,6 +76,11 @@
});
}
+ public DefaultGroovyResourceLoader(URL[] roots, URL[] files) throws
MalformedURLException
+ {
+ this(roots, files, null);
+ }
+
public DefaultGroovyResourceLoader(URL[] roots) throws MalformedURLException
{
this(roots, new URL[0]);
@@ -95,9 +104,8 @@
final String ext = extensions[i];
try
{
- resource = AccessController.doPrivileged(new
PrivilegedExceptionAction<URL>()
- {
- public URL run() throws Exception
+ resource = AccessController.doPrivileged(new
PrivilegedExceptionAction<URL>() {
+ public URL run() throws MalformedURLException
{
return getResource(baseName + ext);
}
@@ -106,10 +114,7 @@
catch (PrivilegedActionException e)
{
Throwable cause = e.getCause();
- if (cause instanceof Error)
- throw (Error)cause;
- if (cause instanceof RuntimeException)
- throw (RuntimeException)cause;
+ // MalformedURLException
throw (MalformedURLException)cause;
}
}
@@ -162,6 +167,6 @@
protected String[] getScriptExtensions()
{
- return DEFAULT_SCRIPT_EXTENSIONS;
+ return extensions;
}
}
Modified:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/GroovyClassLoaderProvider.java
===================================================================
---
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/GroovyClassLoaderProvider.java 2010-12-23
15:00:03 UTC (rev 3718)
+++
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/GroovyClassLoaderProvider.java 2010-12-23
15:04:43 UTC (rev 3719)
@@ -35,7 +35,8 @@
* Groovy source files.
*
* @author <a href="mailto:andrey.parfonov@exoplatform.com">Andrey
Parfonov</a>
- * @version $Id$
+ * @version $Id: GroovyClassLoaderProvider.java 3701 2010-12-22 10:15:37Z
+ * aparfonov $
*/
public class GroovyClassLoaderProvider
{
@@ -55,8 +56,7 @@
public GroovyClassLoaderProvider()
{
- defaultClassLoader = AccessController.doPrivileged(new
PrivilegedAction<GroovyClassLoader>()
- {
+ defaultClassLoader = AccessController.doPrivileged(new
PrivilegedAction<GroovyClassLoader>() {
public GroovyClassLoader run()
{
return new GroovyClassLoader(getClass().getClassLoader());
@@ -83,32 +83,35 @@
* @throws MalformedURLException if any of entries in
<code>classPath</code>
* has invalid URL.
*/
- public GroovyClassLoader getGroovyClassLoader(ClassPathEntry[] classPath) throws
MalformedURLException
+ public GroovyClassLoader getGroovyClassLoader(ClassPath classPath) throws
MalformedURLException
{
List<URL> files = new ArrayList<URL>();
List<URL> roots = new ArrayList<URL>();
- for (int i = 0; i < classPath.length; i++)
+ ClassPathEntry[] classPathEntries = classPath.getEntries();
+ if (classPathEntries != null && classPathEntries.length > 0)
{
- ClassPathEntry classPathEntry = classPath[i];
- if (EntryType.SRC_DIR == classPathEntry.getType())
+ for (int i = 0; i < classPathEntries.length; i++)
{
- roots.add(classPathEntry.getPath());
+ ClassPathEntry classPathEntry = classPathEntries[i];
+ if (EntryType.SRC_DIR == classPathEntry.getType())
+ {
+ roots.add(classPathEntry.getPath());
+ }
+ else
+ {
+ files.add(classPathEntry.getPath());
+ }
}
- else
- {
- files.add(classPathEntry.getPath());
- }
}
final GroovyClassLoader parent = getGroovyClassLoader();
- GroovyClassLoader classLoader = AccessController.doPrivileged(new
PrivilegedAction<GroovyClassLoader>()
- {
+ GroovyClassLoader classLoader = AccessController.doPrivileged(new
PrivilegedAction<GroovyClassLoader>() {
public GroovyClassLoader run()
{
return new GroovyClassLoader(parent);
}
});
classLoader.setResourceLoader(new DefaultGroovyResourceLoader(roots.toArray(new
URL[roots.size()]), files
- .toArray(new URL[files.size()])));
+ .toArray(new URL[files.size()]), classPath.getExtensions()));
return classLoader;
}
Modified:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/GroovyJaxrsPublisher.java
===================================================================
---
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/GroovyJaxrsPublisher.java 2010-12-23
15:00:03 UTC (rev 3718)
+++
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/GroovyJaxrsPublisher.java 2010-12-23
15:04:43 UTC (rev 3719)
@@ -22,7 +22,7 @@
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
-import org.exoplatform.commons.utils.SecurityHelper;
+import org.codehaus.groovy.control.CompilationFailedException;
import org.exoplatform.services.rest.ObjectFactory;
import org.exoplatform.services.rest.PerRequestObjectFactory;
import org.exoplatform.services.rest.impl.ResourceBinder;
@@ -36,7 +36,10 @@
import java.net.MalformedURLException;
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
+import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -162,6 +165,7 @@
* @throws NullPointerException if <code>resourceId == null</code>
* @throws ResourcePublicationException see
* {@link ResourceBinder#addResource(Class, MultivaluedMap)}
+ * @throws CompilationFailedException if compilation fails from source errors
*/
public void publishPerRequest(final InputStream in, final ResourceId resourceId,
MultivaluedMap<String, String> properties)
@@ -180,23 +184,24 @@
* @throws NullPointerException if <code>resourceId == null</code>
* @throws ResourcePublicationException see
* {@link ResourceBinder#addResource(Class, MultivaluedMap)}
+ * @throws CompilationFailedException if compilation fails from source errors
*/
public void publishPerRequest(final InputStream in, final ResourceId resourceId,
- final MultivaluedMap<String, String> properties, final ClassPathEntry[]
classPath)
+ final MultivaluedMap<String, String> properties, final ClassPath classPath)
{
- Class<?> rc = SecurityHelper.doPrivilegedAction(new
PrivilegedAction<Class<?>>() {
+ Class<?> rc = AccessController.doPrivileged(new
PrivilegedAction<Class<?>>() {
public Class<?> run()
{
try
{
- GroovyClassLoader cl = (classPath == null || classPath.length == 0) //
- ? classLoaderProvider.getGroovyClassLoader() //
- : classLoaderProvider.getGroovyClassLoader(classPath);
+ GroovyClassLoader cl =
+ (classPath == null) ? classLoaderProvider.getGroovyClassLoader() :
classLoaderProvider
+ .getGroovyClassLoader(classPath);
return cl.parseClass(createCodeSource(in, resourceId.getId()));
}
catch (MalformedURLException e)
{
- throw new ResourcePublicationException(e.getMessage());
+ throw new IllegalArgumentException(e.getMessage());
}
}
});
@@ -216,6 +221,7 @@
* @throws NullPointerException if <code>resourceId == null</code>
* @throws ResourcePublicationException see
* {@link ResourceBinder#addResource(Class, MultivaluedMap)}
+ * @throws CompilationFailedException if compilation fails from source errors
*/
public final void publishPerRequest(String source, ResourceId resourceId,
MultivaluedMap<String, String> properties)
{
@@ -234,9 +240,10 @@
* @throws NullPointerException if <code>resourceId == null</code>
* @throws ResourcePublicationException see
* {@link ResourceBinder#addResource(Class, MultivaluedMap)}
+ * @throws CompilationFailedException if compilation fails from source errors
*/
public final void publishPerRequest(String source, ResourceId resourceId,
MultivaluedMap<String, String> properties,
- ClassPathEntry[] classPath)
+ ClassPath classPath)
{
publishPerRequest(source, DEFAULT_CHARSET, resourceId, properties, classPath);
}
@@ -255,6 +262,7 @@
* @throws NullPointerException if <code>resourceId == null</code>
* @throws ResourcePublicationException see
* {@link ResourceBinder#addResource(Class, MultivaluedMap)}
+ * @throws CompilationFailedException if compilation fails from source errors
*/
public final void publishPerRequest(String source, String charset, ResourceId
resourceId,
MultivaluedMap<String, String> properties)
@@ -278,9 +286,10 @@
* @throws NullPointerException if <code>resourceId == null</code>
* @throws ResourcePublicationException see
* {@link ResourceBinder#addResource(Class, MultivaluedMap)}
+ * @throws CompilationFailedException if compilation fails from source errors
*/
public final void publishPerRequest(String source, String charset, ResourceId
resourceId,
- MultivaluedMap<String, String> properties, ClassPathEntry[] classPath)
+ MultivaluedMap<String, String> properties, ClassPath classPath)
{
publishPerRequest(source, charset == null ? DEFAULT_CHARSET :
Charset.forName(charset), resourceId, properties,
classPath);
@@ -296,6 +305,7 @@
* @throws NullPointerException if <code>resourceId == null</code>
* @throws ResourcePublicationException see
* {@link ResourceBinder#addResource(Object, MultivaluedMap)}
+ * @throws CompilationFailedException if compilation fails from source errors
*/
public void publishSingleton(InputStream in, ResourceId resourceId,
MultivaluedMap<String, String> properties)
{
@@ -313,22 +323,21 @@
* @throws NullPointerException if <code>resourceId == null</code>
* @throws ResourcePublicationException see
* {@link ResourceBinder#addResource(Object, MultivaluedMap)}
+ * @throws CompilationFailedException if compilation fails from source errors
*/
public void publishSingleton(InputStream in, ResourceId resourceId,
MultivaluedMap<String, String> properties,
- ClassPathEntry[] classPath)
+ ClassPath classPath)
{
Object resource;
try
{
resource =
- instantiator.instantiateScript(createCodeSource(in, resourceId.getId()),
- (classPath == null || classPath.length == 0) //
- ? classLoaderProvider.getGroovyClassLoader() //
- : classLoaderProvider.getGroovyClassLoader(classPath));
+ instantiator.instantiateScript(createCodeSource(in, resourceId.getId()),
(classPath == null)
+ ? classLoaderProvider.getGroovyClassLoader() :
classLoaderProvider.getGroovyClassLoader(classPath));
}
catch (MalformedURLException e)
{
- throw new ResourcePublicationException(e.getMessage());
+ throw new IllegalArgumentException(e.getMessage());
}
binder.addResource(resource, properties);
resources.put(resourceId, resource.getClass().getAnnotation(Path.class).value());
@@ -345,6 +354,7 @@
* @throws NullPointerException if <code>resourceId == null</code>
* @throws ResourcePublicationException see
* {@link ResourceBinder#addResource(Object, MultivaluedMap)}
+ * @throws CompilationFailedException if compilation fails from source errors
*/
public final void publishSingleton(String source, ResourceId resourceId,
MultivaluedMap<String, String> properties)
{
@@ -363,9 +373,10 @@
* @throws NullPointerException if <code>resourceId == null</code>
* @throws ResourcePublicationException see
* {@link ResourceBinder#addResource(Object, MultivaluedMap)}
+ * @throws CompilationFailedException if compilation fails from source errors
*/
public final void publishSingleton(String source, ResourceId resourceId,
MultivaluedMap<String, String> properties,
- ClassPathEntry[] classPath)
+ ClassPath classPath)
{
publishSingleton(source, DEFAULT_CHARSET, resourceId, properties, classPath);
}
@@ -384,6 +395,7 @@
* @throws NullPointerException if <code>resourceId == null</code>
* @throws ResourcePublicationException see
* {@link ResourceBinder#addResource(Object, MultivaluedMap)}
+ * @throws CompilationFailedException if compilation fails from source errors
*/
public final void publishSingleton(String source, String charset, ResourceId
resourceId,
MultivaluedMap<String, String> properties)
@@ -407,9 +419,10 @@
* @throws NullPointerException if <code>resourceId == null</code>
* @throws ResourcePublicationException see
* {@link ResourceBinder#addResource(Object, MultivaluedMap)}
+ * @throws CompilationFailedException if compilation fails from source errors
*/
public final void publishSingleton(String source, String charset, ResourceId
resourceId,
- MultivaluedMap<String, String> properties, ClassPathEntry[] classPath)
+ MultivaluedMap<String, String> properties, ClassPath classPath)
{
publishSingleton(source, charset == null ? DEFAULT_CHARSET :
Charset.forName(charset), resourceId, properties,
classPath);
@@ -438,20 +451,159 @@
return resource;
}
+ /**
+ * Validate does stream contain Groovy source code which is conforms with
+ * requirement to JAX-RS resource.
+ *
+ * @param in Groovy source stream
+ * @param name script name. This name will be used by GroovyClassLoader to
+ * identify script, e.g. specified name will be used in error
+ * message in compilation of Groovy fails. If this parameter is
+ * <code>null</code> then GroovyClassLoader will use
automatically
+ * generated name
+ * @param classPath additional path to Groovy sources
+ * @throws MalformedScriptException if source has errors or there is no
+ * required JAX-RS annotation
+ */
+ public void validateResource(final InputStream in, final String name, final ClassPath
classPath)
+ throws MalformedScriptException
+ {
+ Class<?> rc;
+ try
+ {
+ rc = AccessController.doPrivileged(new
PrivilegedExceptionAction<Class<?>>() {
+ public Class<?> run() throws MalformedURLException
+ {
+ GroovyClassLoader cl =
+ (classPath == null) ? classLoaderProvider.getGroovyClassLoader() :
classLoaderProvider
+ .getGroovyClassLoader(classPath);
+ if (name == null || name.length() == 0)
+ return cl.parseClass(createCodeSource(in, cl.generateScriptName()));
+ return cl.parseClass(createCodeSource(in, name));
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ Throwable cause = e.getCause();
+ // MalformedURLException
+ throw new IllegalArgumentException(cause.getMessage());
+ }
+ catch (CompilationFailedException e)
+ {
+ throw new MalformedScriptException(e.getMessage());
+ }
+ /// XXX : Temporary disable resource class validation. Just try to compile
+ // class and assume resource class is OK if compilation is successful.
+ /*try
+ {
+ new
AbstractResourceDescriptorImpl(rc).accept(ResourceDescriptorValidator.getInstance());
+ }
+ catch (RuntimeException e)
+ {
+ // FIXME : Need have proper exception for invalid resources in
'exo.ws.rest.core'.
+ throw new MalformedScriptException(e.getMessage());
+ }*/
+ }
+
+ /**
+ * Validate does stream contain Groovy source code which is conforms with
+ * requirement to JAX-RS resource.
+ *
+ * @param in Groovy source stream
+ * @param name script name. This name will be used by GroovyClassLoader to
+ * identify script, e.g. specified name will be used in error
+ * message in compilation of Groovy fails. If this parameter is
+ * <code>null</code> then GroovyClassLoader will use
automatically
+ * generated name
+ * @throws MalformedScriptException if source has errors or there is no
+ * required JAX-RS annotation
+ */
+ public void validateResource(InputStream in, String name) throws
MalformedScriptException
+ {
+ validateResource(in, name, null);
+ }
+
+ /**
+ * Validate does <code>source</code> contain Groovy source code which is
+ * conforms with requirement to JAX-RS resource.
+ *
+ * @param source Groovy source code as String
+ * @param charset source string charset. May be <code>null</code> than
+ * default charset will be in use
+ * @param name script name. This name will be used by GroovyClassLoader to
+ * identify script, e.g. specified name will be used in error
+ * message in compilation of Groovy fails. If this parameter is
+ * <code>null</code> then GroovyClassLoader will use
automatically
+ * generated name
+ * @param classPath additional path to Groovy sources
+ * @throws MalformedScriptException if source has errors or there is no
+ * required JAX-RS annotation
+ */
+ public final void validateResource(String source, String charset, String name,
ClassPath classPath)
+ throws MalformedScriptException
+ {
+ validateResource(source, charset == null ? DEFAULT_CHARSET :
Charset.forName(charset), name, classPath);
+ }
+
+ /**
+ * Validate does <code>source</code> contain Groovy source code which is
+ * conforms with requirement to JAX-RS resource.
+ *
+ * @param source Groovy source code as String
+ * @param name script name. This name will be used by GroovyClassLoader to
+ * identify script, e.g. specified name will be used in error
+ * message in compilation of Groovy fails. If this parameter is
+ * <code>null</code> then GroovyClassLoader will use
automatically
+ * generated name
+ * @param classPath additional path to Groovy sources
+ * @throws MalformedScriptException if source has errors or there is no
+ * required JAX-RS annotation
+ */
+ public final void validateResource(String source, String name, ClassPath classPath)
throws MalformedScriptException
+ {
+ validateResource(source, DEFAULT_CHARSET, name, classPath);
+ }
+
+ /**
+ * Validate does <code>source</code> contain Groovy source code which is
+ * conforms with requirement to JAX-RS resource.
+ *
+ * @param source Groovy source code as String
+ * @param name script name. This name will be used by GroovyClassLoader to
+ * identify script, e.g. specified name will be used in error
+ * message in compilation of Groovy fails. If this parameter is
+ * <code>null</code> then GroovyClassLoader will use
automatically
+ * generated name
+ * @throws MalformedScriptException if source has errors or there is no
+ * required JAX-RS annotation
+ */
+ public final void validateResource(String source, String name) throws
MalformedScriptException
+ {
+ validateResource(source, DEFAULT_CHARSET, name, null);
+ }
+
private void publishPerRequest(String source, Charset charset, ResourceId resourceId,
- MultivaluedMap<String, String> properties, ClassPathEntry[] classPath)
+ MultivaluedMap<String, String> properties, ClassPath classPath)
{
byte[] bytes = source.getBytes(charset);
- publishPerRequest(new ByteArrayInputStream(bytes), resourceId, properties);
+ publishPerRequest(new ByteArrayInputStream(bytes), resourceId, properties,
classPath);
}
private void publishSingleton(String source, Charset charset, ResourceId resourceId,
- MultivaluedMap<String, String> properties, ClassPathEntry[] classPath)
+ MultivaluedMap<String, String> properties, ClassPath classPath)
{
byte[] bytes = source.getBytes(charset);
publishSingleton(new ByteArrayInputStream(bytes), resourceId, properties,
classPath);
}
+ private void validateResource(String source, Charset charset, String name, ClassPath
classPath)
+ throws MalformedScriptException
+ {
+ byte[] bytes = source.getBytes(charset);
+ validateResource(new ByteArrayInputStream(bytes), name, classPath);
+ }
+
/**
* Create {@link GroovyCodeSource} from given stream and name. Code base
* 'file:/groovy/script/jaxrs' will be used.
@@ -462,7 +614,7 @@
*/
protected GroovyCodeSource createCodeSource(final InputStream in, final String name)
{
- GroovyCodeSource gcs = SecurityHelper.doPrivilegedAction(new
PrivilegedAction<GroovyCodeSource>() {
+ GroovyCodeSource gcs = AccessController.doPrivileged(new
PrivilegedAction<GroovyCodeSource>() {
public GroovyCodeSource run()
{
return new GroovyCodeSource(in, name, "/groovy/script/jaxrs");
Added:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/MalformedScriptException.java
===================================================================
---
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/MalformedScriptException.java
(rev 0)
+++
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/MalformedScriptException.java 2010-12-23
15:04:43 UTC (rev 3719)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.services.rest.ext.groovy;
+
+/**
+ * Thrown if Groovy script is not comply with requirement to JAX-RS resources.
+ *
+ * @author <a href="mailto:andrey.parfonov@exoplatform.com">Andrey
Parfonov</a>
+ * @version $Id$
+ */
+@SuppressWarnings("serial")
+public class MalformedScriptException extends Exception
+{
+ /**
+ * @param message detail message about wrong with Groovy script.
+ */
+ public MalformedScriptException(String message)
+ {
+ super(message);
+ }
+}
Property changes on:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/MalformedScriptException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native