Java Code Examples for javax.ws.rs.core.MediaType#TEXT_HTML

The following examples show how to use javax.ws.rs.core.MediaType#TEXT_HTML . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AdminEndpoint.java    From mercury with Apache License 2.0 6 votes vote down vote up
@PUT
@Path("/{name}")
@Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_HTML})
public Object startJob(@PathParam("name") String name) throws AppException, SchedulerException, IOException {
    ScheduledJob job = MainScheduler.getJob(name);
    if (job == null) {
        throw new AppException(404, "Job "+name+" not found");
    }
    if (job.startTime != null) {
        throw new IllegalArgumentException("Job "+name+" already started");
    }
    PostOffice.getInstance().broadcast(SCHEDULER_SERVICE, new Kv(ORIGIN, Platform.getInstance().getOrigin()),
                                        new Kv(TYPE, START), new Kv(JOB_ID, name));
    MainScheduler.startJob(job.name);
    Map<String, Object> result = new HashMap<>();
    result.put("type", "start");
    result.put("message", "Job "+name+" started");
    result.put("time", new Date());
    return result;
}
 
Example 2
Source File: ClientRegistrationService.java    From cxf-fediz with Apache License 2.0 6 votes vote down vote up
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.TEXT_HTML)
@Path("/{id}/reset")
public Client resetClient(@PathParam("id") String id,
                          @FormParam("client_csrfToken") String csrfToken) {
    // CSRF
    checkCSRFToken(csrfToken);
    checkSecurityContext();

    Client c = getRegisteredClient(id);
    if (c == null) {
        throw new InvalidRegistrationException("The client id is invalid");
    }
    if (c.isConfidential()) {
        c.setClientSecret(generateClientSecret());
    }
    clientProvider.setClient(c);
    return c;
}
 
Example 3
Source File: LogInLogOutResources.java    From Bats with Apache License 2.0 6 votes vote down vote up
@GET
@Path(WebServerConstants.FORM_LOGIN_RESOURCE_PATH)
@Produces(MediaType.TEXT_HTML)
public Viewable getLoginPage(@Context HttpServletRequest request, @Context HttpServletResponse response,
                             @Context SecurityContext sc, @Context UriInfo uriInfo,
                             @QueryParam(WebServerConstants.REDIRECT_QUERY_PARM) String redirect) throws Exception {

  if (AuthDynamicFeature.isUserLoggedIn(sc)) {
    // if the user is already login, forward the request to homepage.
    request.getRequestDispatcher(WebServerConstants.WEBSERVER_ROOT_PATH).forward(request, response);
    return null;
  }

  updateSessionRedirectInfo(redirect, request);
  return ViewableWithPermissions.createLoginPage(null);
}
 
Example 4
Source File: PodcastRestService.java    From demo-restWS-spring-jersey-tomcat-mybatis with MIT License 6 votes vote down vote up
/**
 * Updates the attributes of the podcast received via JSON for the given @param id
 * 
 * If the podcast does not exist yet in the database (verified by <strong>id</strong>) then
 * the application will try to create a new podcast resource in the db
 * 
 * @param id
 * @param podcast
 * @return
 */	
@PUT @Path("{id}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.TEXT_HTML})	
@Transactional
public Response updatePodcastById(@PathParam("id") Long id, Podcast podcast) {
	if(podcast.getId() == null) podcast.setId(id);
	String message; 
	int status; 
	if(podcastWasUpdated(podcast)){
		status = 200; //OK
		message = "Podcast has been updated";
	} else if(podcastCanBeCreated(podcast)){
		podcastDao.createPodcast(podcast);
		status = 201; //Created 
		message = "The podcast you provided has been added to the database";
	} else {
		status = 406; //Not acceptable
		message = "The information you provided is not sufficient to perform either an UPDATE or "
				+ " an INSERTION of the new podcast resource <br/>"
				+ " If you want to UPDATE please make sure you provide an existent <strong>id</strong> <br/>"
				+ " If you want to insert a new podcast please provide at least a <strong>title</strong> and the <strong>feed</strong> for the podcast resource";
	}
	
	return Response.status(status).entity(message).build();		
}
 
Example 5
Source File: INativeAPIv15Resource.java    From paymentgateway with GNU General Public License v3.0 5 votes vote down vote up
@GET
@Path( "/payment/process/{merchantId}/{payId}/{dttm}/{signature}" ) 
@Produces(MediaType.TEXT_HTML)
Response paymentProcess(@PathParam("merchantId") String merchantId, 
		@PathParam("payId") String payId, 
		@PathParam("dttm") String dttm, 
		@PathParam("signature") String signature
		);
 
Example 6
Source File: INativeAPIv16Resource.java    From paymentgateway with GNU General Public License v3.0 5 votes vote down vote up
@GET
@Path( "/payment/process/{merchantId}/{payId}/{dttm}/{signature}" ) 
@Produces(MediaType.TEXT_HTML)
Response paymentProcess(@PathParam("merchantId") String merchantId, 
		@PathParam("payId") String payId, 
		@PathParam("dttm") String dttm, 
		@PathParam("signature") String signature
		);
 
Example 7
Source File: SyncAPI3.java    From SQLite-sync.com with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@GET
@Produces(MediaType.TEXT_HTML)
public String Test(){

    CommonTools commonTools = new CommonTools();
    Boolean isConnectionOK = commonTools.CheckIfDBConnectionIsOK();

    String connectionStatus = "Database connected!";
    if(!isConnectionOK)
        connectionStatus = "Error creating database connection.";

    return "API[" + commonTools.GetVersionOfSQLiteSyncCOM() + "] SQLite-Sync.COM is working correctly! " + connectionStatus;
}
 
Example 8
Source File: CourseResourceFolderWebService.java    From olat with Apache License 2.0 5 votes vote down vote up
@GET
@Path("sharedfolder/{path:.*}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_HTML, MediaType.APPLICATION_OCTET_STREAM })
public Response getSharedFiles(@PathParam("courseId") final Long courseId, @PathParam("path") final List<PathSegment> path, @Context final UriInfo uriInfo,
        @Context final HttpServletRequest httpRequest, @Context final Request request) {
    return getFiles(courseId, path, FolderType.COURSE_FOLDER, uriInfo, httpRequest, request);
}
 
Example 9
Source File: TestIssue55Rest.java    From rest.vertx with Apache License 2.0 5 votes vote down vote up
@DELETE
@Path("/")
@Produces(MediaType.TEXT_HTML)
@AuditLog(title = "delete")
public String query() {
    return "[delete]";
}
 
Example 10
Source File: DocumentAction.java    From emissary with Apache License 2.0 5 votes vote down vote up
@GET
@Path("/Document.action")
@Produces(MediaType.TEXT_HTML)
@Template(name = "/document_form")
public Map<String, Object> documentForm() {
    Map<String, Object> map = new HashMap<>();
    return map;
}
 
Example 11
Source File: CourseResourceFolderWebService.java    From olat with Apache License 2.0 5 votes vote down vote up
@GET
@Path("coursefolder/{path:.*}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_HTML, MediaType.APPLICATION_OCTET_STREAM })
public Response getCourseFiles(@PathParam("courseId") final Long courseId, @PathParam("path") final List<PathSegment> path, @Context final UriInfo uriInfo,
        @Context final HttpServletRequest httpRequest, @Context final Request request) {
    return getFiles(courseId, path, FolderType.COURSE_FOLDER, uriInfo, httpRequest, request);
}
 
Example 12
Source File: ComponentResource.java    From wings with Apache License 2.0 5 votes vote down vote up
@GET
@Produces(MediaType.TEXT_HTML)
public String getHTML() {
  if(this.cc != null) {
    request.setAttribute("controller", this.cc);
    return this.callViewer("ComponentViewer");
  }
  return null;
}
 
Example 13
Source File: DataAnalysisResource.java    From SAPNetworkMonitor with GNU General Public License v3.0 5 votes vote down vote up
@GET
@Path("/")
@Produces(MediaType.TEXT_HTML)
public AnalysisView result(@Session HttpSession session) {
    try {
        String accountId = NiPingAuthFilter.getAccountId(session);
        return new AnalysisView(SUCCESS, taskService.listTasks(accountId));
    } catch (NiPingException e) {
        return new AnalysisView(e, null);
    }
}
 
Example 14
Source File: PodcastRestService.java    From demo-restWS-spring-jersey-jpa2-hibernate with MIT License 5 votes vote down vote up
/**
 * Adds a new resource (podcast) from the given json format (at least title
 * and feed elements are required at the DB level)
 * 
 * @param podcast
 * @return
 */
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.TEXT_HTML })
@Transactional
public Response createPodcast(Podcast podcast) {
	podcastDao.createPodcast(podcast);

	return Response.status(201)
			.entity("A new podcast/resource has been created").build();
}
 
Example 15
Source File: AppHandle.java    From reactor-guice with Apache License 2.0 5 votes vote down vote up
@GET
@Path("/test/html/{id}")
@Produces({MediaType.TEXT_HTML})
public Mono<String> testHtml(@PathParam("id") Long id, ModelMap modelMap) {
    modelMap.addAttribute("id", id);
    return Mono.just("test");
}
 
Example 16
Source File: TestRest.java    From rest.vertx with Apache License 2.0 5 votes vote down vote up
@GET
@Path("/echo")
@Produces(MediaType.TEXT_HTML)
public String echo() {

	System.out.println("HELLO");
	return "Hello world!";
}
 
Example 17
Source File: StarTreeIndexViewer.java    From incubator-pinot with Apache License 2.0 4 votes vote down vote up
@GET
@Path("/")
@Produces(MediaType.TEXT_HTML)
public InputStream getStarTreeHtml() {
  return getClass().getClassLoader().getResourceAsStream("star-tree.html");
}
 
Example 18
Source File: WelcomeResource.java    From SAPNetworkMonitor with GNU General Public License v3.0 4 votes vote down vote up
@GET
@Path("/")
@Produces(MediaType.TEXT_HTML)
public LoginView welcome() {
    return new LoginView(SUCCESS, null);
}
 
Example 19
Source File: LandingPageHandler.java    From incubator-pinot with Apache License 2.0 4 votes vote down vote up
@GET
@Produces(MediaType.TEXT_HTML)
public InputStream getIndexPage() {
  return getClass().getClassLoader().getResourceAsStream("static/index.html");
}
 
Example 20
Source File: ScheduleRepository.java    From crnk-framework with Apache License 2.0 4 votes vote down vote up
@GET
@Path("repositoryActionWithNullResponse")
@Produces(MediaType.TEXT_HTML)
String repositoryActionWithNullResponse();