forked from Archives/Athou_commafeed
fix deployment
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -54,7 +54,7 @@
|
||||
<artifactId>tomee-maven-plugin</artifactId>
|
||||
<version>1.6.0-SNAPSHOT</version>
|
||||
<configuration>
|
||||
<tomeeVersion>1.6.0-SNAPSHOT</tomeeVersion>
|
||||
<tomeeVersion>1.5.2-SNAPSHOT</tomeeVersion>
|
||||
<tomeeClassifier>plus</tomeeClassifier>
|
||||
<tomeeHttpPort>8082</tomeeHttpPort>
|
||||
<args>-Xmx1024m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled</args>
|
||||
|
||||
@@ -1,9 +1,26 @@
|
||||
package com.commafeed.frontend.rest;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.ApplicationPath;
|
||||
import javax.ws.rs.core.Application;
|
||||
|
||||
import com.commafeed.frontend.rest.resources.EntriesREST;
|
||||
import com.commafeed.frontend.rest.resources.SettingsREST;
|
||||
import com.commafeed.frontend.rest.resources.SubscriptionsREST;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
@ApplicationPath("/rest")
|
||||
public class RESTApplication extends Application {
|
||||
|
||||
@Override
|
||||
public Set<Class<?>> getClasses() {
|
||||
Set<Class<?>> set = Sets.newHashSet();
|
||||
set.add(JSONMessageBodyReaderWriter.class);
|
||||
|
||||
set.add(SubscriptionsREST.class);
|
||||
set.add(EntriesREST.class);
|
||||
set.add(SettingsREST.class);
|
||||
return set;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.Status;
|
||||
|
||||
import org.apache.wicket.ThreadContext;
|
||||
@@ -102,7 +103,9 @@ public abstract class AbstractREST {
|
||||
public Object checkSecurity(InvocationContext context) throws Exception {
|
||||
User user = getUser();
|
||||
if (user == null) {
|
||||
throw new WebApplicationException(Status.UNAUTHORIZED);
|
||||
throw new WebApplicationException(Response
|
||||
.status(Status.UNAUTHORIZED)
|
||||
.entity("You need to be authenticated to do this.").build());
|
||||
}
|
||||
|
||||
boolean allowed = false;
|
||||
@@ -118,7 +121,8 @@ public abstract class AbstractREST {
|
||||
SecurityCheck.class));
|
||||
}
|
||||
if (!allowed) {
|
||||
throw new WebApplicationException(Status.FORBIDDEN);
|
||||
throw new WebApplicationException(Response.status(Status.FORBIDDEN)
|
||||
.entity("You are not authorized to do this.").build());
|
||||
}
|
||||
|
||||
return context.proceed();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
http://java.sun.com/xml/ns/javaee http://docs.jboss.org/cdi/beans_1_0.xsd
|
||||
http://jboss.org/schema/weld/beans http://jboss.org/schema/weld/beans_1_1.xsd">
|
||||
http://java.sun.com/xml/ns/javaee http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/beans_1_0.xsd">
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user