Skip to main content
summaryrefslogtreecommitdiffstats
blob: 3cda7cee87c7310b6d3235f146dfa7ac01d2957a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*******************************************************************************
 * Copyright (c) 2013 Boeing.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Boeing - initial API and implementation
 *******************************************************************************/
package org.eclipse.osee.disposition.rest.resources;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
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 javax.ws.rs.core.UriInfo;
import org.eclipse.osee.disposition.rest.util.DispoHtmlWriter;

/**
 * @author Angel Avila
 */
@Path("init")
public class DispoInitResource {

   private final DispoHtmlWriter writer;

   public DispoInitResource(DispoHtmlWriter writer) {
      this.writer = writer;
   }

   /**
    * Get initial Dispo page
    * 
    * @return Html for inital Dispo page
    * @response.representation.200.doc OK, created HTML page
    */
   @GET
   @Produces(MediaType.TEXT_HTML)
   public Response start(@Context UriInfo uriInfo) {
      Response.Status status;
      String html;
      status = Status.OK;
      String host = uriInfo.getAbsolutePath().getHost();
      int port = uriInfo.getAbsolutePath().getPort();
      String url = host + ":" + port;
      html = writer.createMainTable(url);
      return Response.status(status).entity(html).build();
   }

}

Back to the top