javax.ws.rs.core.MediaType#TEXT_HTML源码实例Demo

下面列出了javax.ws.rs.core.MediaType#TEXT_HTML 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * 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();		
}
 
源代码2 项目: Bats   文件: LogInLogOutResources.java
@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);
}
 
源代码3 项目: cxf-fediz   文件: ClientRegistrationService.java
@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;
}
 
源代码4 项目: mercury   文件: AdminEndpoint.java
@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;
}
 
源代码5 项目: emissary   文件: DocumentAction.java
@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;
}
 
源代码6 项目: rest.vertx   文件: TestRest.java
@GET
@Path("/echo")
@Produces(MediaType.TEXT_HTML)
public String echo() {

	System.out.println("HELLO");
	return "Hello world!";
}
 
源代码7 项目: reactor-guice   文件: AppHandle.java
@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");
}
 
/**
 * 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();
}
 
源代码9 项目: SAPNetworkMonitor   文件: DataAnalysisResource.java
@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);
    }
}
 
源代码10 项目: wings   文件: ComponentResource.java
@GET
@Produces(MediaType.TEXT_HTML)
public String getHTML() {
  if(this.cc != null) {
    request.setAttribute("controller", this.cc);
    return this.callViewer("ComponentViewer");
  }
  return null;
}
 
源代码11 项目: olat   文件: CourseResourceFolderWebService.java
@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);
}
 
源代码12 项目: paymentgateway   文件: INativeAPIv15Resource.java
@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
		);
 
源代码13 项目: rest.vertx   文件: TestIssue55Rest.java
@DELETE
@Path("/")
@Produces(MediaType.TEXT_HTML)
@AuditLog(title = "delete")
public String query() {
    return "[delete]";
}
 
源代码14 项目: olat   文件: CourseResourceFolderWebService.java
@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);
}
 
源代码15 项目: SQLite-sync.com   文件: SyncAPI3.java
@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;
}
 
源代码16 项目: paymentgateway   文件: INativeAPIv16Resource.java
@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
		);
 
源代码17 项目: crnk-framework   文件: ScheduleRepository.java
@GET
@Path("repositoryActionWithNullResponse")
@Produces(MediaType.TEXT_HTML)
String repositoryActionWithNullResponse();
 
源代码18 项目: incubator-pinot   文件: LandingPageHandler.java
@GET
@Produces(MediaType.TEXT_HTML)
public InputStream getIndexPage() {
  return getClass().getClassLoader().getResourceAsStream("static/index.html");
}
 
源代码19 项目: incubator-pinot   文件: StarTreeIndexViewer.java
@GET
@Path("/")
@Produces(MediaType.TEXT_HTML)
public InputStream getStarTreeHtml() {
  return getClass().getClassLoader().getResourceAsStream("star-tree.html");
}
 
源代码20 项目: SAPNetworkMonitor   文件: WelcomeResource.java
@GET
@Path("/")
@Produces(MediaType.TEXT_HTML)
public LoginView welcome() {
    return new LoginView(SUCCESS, null);
}