Skip to content

Commit

Permalink
update to profiler 1.0.1, dropwizard 2
Browse files Browse the repository at this point in the history
  • Loading branch information
emanueldima authored and andmor- committed Apr 20, 2020
1 parent 5595f72 commit 859f444
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 52 deletions.
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Cloning this repository is required. The default settings require it to have the

(this may depend on your local computing environment).

4. Goto [http://localhost:8080](http://localhost:8080) in your browser to get access to the switchboard.
4. Go to [http://localhost:8080](http://localhost:8080) in your browser to get access to the switchboard.

# Build and run for development

Expand All @@ -42,6 +42,6 @@ Cloning this repository is required. The default settings require it to have the

```make run-webui-dev-server```

5. Goto [http://localhost:8081](http://localhost:8081) in your browser to get access to the switchboard.
5. Go to [http://localhost:8081](http://localhost:8081) in your browser to get access to the switchboard.
Any change in the frontend code will trigger an automatic recompilation and browser refresh.
Changing the backend java code requires a restart of the backend.
57 changes: 15 additions & 42 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<version>0.0.0-SNAPSHOT</version>

<properties>
<dropwizard.version>1.3.20</dropwizard.version>
<dropwizard.version>2.0.8</dropwizard.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand All @@ -33,11 +33,12 @@
<artifactId>dropwizard-assets</artifactId>
<version>${dropwizard.version}</version>
</dependency>

<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-testing</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>2.30.1</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -55,58 +56,30 @@
<version>1.2.3</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.2-jre</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>

<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<!-- this version is compatible with jersey-server 2.25 included by dropwizard -->
<version>2.25</version>
</dependency>

<dependency>
<groupId>net.sf.trove4j</groupId>
<artifactId>trove4j</artifactId>
<version>3.0.3</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>eu.clarin.switchboard</groupId>
<artifactId>profiler</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</dependency>

<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.2</version>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>

<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class HttpErrorHandler extends org.eclipse.jetty.server.handler.ErrorHand
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(HttpErrorHandler.class);

public static final String REDIRECT_ROUTE = "/index.html";
private String rootPath;
private final String rootPath;

public HttpErrorHandler(String appContextPath, String urlPattern) {
String rootPattern = urlPattern.endsWith("/*") ? urlPattern.substring(0, urlPattern.length() - 1) : urlPattern;
Expand All @@ -33,7 +33,7 @@ public HttpErrorHandler(String appContextPath, String urlPattern) {


@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException {
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
// On 404 page we need to show index.html and let JS router do the work, otherwise show error page
if (response.getStatus() == HttpServletResponse.SC_NOT_FOUND &&
!request.getRequestURI().startsWith(rootPath)) {
Expand All @@ -43,7 +43,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques
}
}

void forward(String target, Request request, HttpServletResponse response) throws IOException {
void forward(String target, Request request, HttpServletResponse response) throws IOException, ServletException {
RequestDispatcher dispatcher = request.getRequestDispatcher(target);
if (dispatcher == null) {
LOGGER.error("Can not find internal redirect route '" + target + "' while handling error. Will show system error page");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ public class DataResource {

MediaLibrary mediaLibrary;

@Context
HttpServletRequest request;

public DataResource(MediaLibrary mediaLibrary) {
this.mediaLibrary = mediaLibrary;
}
Expand Down Expand Up @@ -63,7 +60,8 @@ public Response getFile(@PathParam("id") String idString) {
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public Response postFile(@FormDataParam("file") InputStream inputStream,
public Response postFile(@Context HttpServletRequest request,
@FormDataParam("file") InputStream inputStream,
@FormDataParam("file") final FormDataContentDisposition contentDispositionHeader,
@FormDataParam("link") String link) throws CommonException, ProfilingException {
FileInfo fileInfo;
Expand Down

0 comments on commit 859f444

Please sign in to comment.