当前位置: 首页>>代码示例>>Java>>正文


Java Status.NOT_FOUND属性代码示例

本文整理汇总了Java中javax.ws.rs.core.Response.Status.NOT_FOUND属性的典型用法代码示例。如果您正苦于以下问题:Java Status.NOT_FOUND属性的具体用法?Java Status.NOT_FOUND怎么用?Java Status.NOT_FOUND使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.ws.rs.core.Response.Status的用法示例。


在下文中一共展示了Status.NOT_FOUND属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getServiceProvider

public static ServiceProvider getServiceProvider(HttpServletRequest httpServletRequest, final String serviceProviderId)
{
    ServiceProvider serviceProvider;

    synchronized(serviceProviders)
    {
        String identifier = serviceProviderIdentifier(serviceProviderId);
        serviceProvider = serviceProviders.get(identifier);

        //One retry refreshing the service providers
        if (serviceProvider == null)
        {
            getServiceProviders(httpServletRequest);
            serviceProvider = serviceProviders.get(identifier);
        }
    }

    if (serviceProvider != null)
    {
        return serviceProvider;
    }

    throw new WebApplicationException(Status.NOT_FOUND);
}
 
开发者ID:EricssonResearch,项目名称:scott-eu,代码行数:24,代码来源:ServiceProviderCatalogSingleton.java

示例2: locate

public void locate(String microserviceName, String path, String httpMethod, MicroservicePaths microservicePaths) {
  // 在静态路径中查找
  operation = locateStaticPathOperation(path, httpMethod, microservicePaths.getStaticPathOperationMap());
  if (operation != null) {
    // 全部定位完成
    return;
  }

  // 在动态路径中查找
  operation = locateDynamicPathOperation(path, microservicePaths.getDynamicPathOperationList(), httpMethod);
  if (operation != null) {
    return;
  }

  Status status = Status.NOT_FOUND;
  if (resourceFound) {
    status = Status.METHOD_NOT_ALLOWED;
  }
  LOGGER.error("locate path failed, status:{}, http method:{}, path:{}, microserviceName:{}",
      status,
      httpMethod,
      path,
      microserviceName);
  throw new InvocationException(status, status.getReasonPhrase());
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:25,代码来源:OperationLocator.java

示例3: getPlanAsHtml

@GET
@Path("{planId}")
@Produces({ MediaType.TEXT_HTML })
public Response getPlanAsHtml(
    @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("planId") final String planId
    ) throws ServletException, IOException, URISyntaxException
{
    // Start of user code getPlanAsHtml_init
    // End of user code

    final Plan aPlan = PlannerReasonerManager.getPlan(httpServletRequest, serviceProviderId, planId);

    if (aPlan != null) {
        httpServletRequest.setAttribute("aPlan", aPlan);
        // Start of user code getPlanAsHtml_setAttributes
        // End of user code

        RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/se/ericsson/cf/scott/sandbox/plan.jsp");
        rd.forward(httpServletRequest,httpServletResponse);
    }

    throw new WebApplicationException(Status.NOT_FOUND);
}
 
开发者ID:EricssonResearch,项目名称:scott-eu,代码行数:23,代码来源:ServiceProviderService1.java

示例4: getResourceShapeAsHtml

@GET
@Path("{resourceShapePath}")
@Produces({ MediaType.TEXT_HTML })
public Response getResourceShapeAsHtml(
        @PathParam("resourceShapePath") final String resourceShapePath
    ) throws ServletException, IOException, URISyntaxException, OslcCoreApplicationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException
{
    final Class<?> resourceClass = Application.getResourceShapePathToResourceClassMap().get(resourceShapePath);
    ResourceShape aResourceShape = null;
    
    if (resourceClass != null)
    {
        aResourceShape = (ResourceShape) resourceClass.getMethod("createResourceShape").invoke(null);
        httpServletRequest.setAttribute("aResourceShape", aResourceShape);
        
        RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/se/ericsson/cf/scott/sandbox/resourceshape.jsp");
        rd.forward(httpServletRequest,httpServletResponse);
    }
    throw new WebApplicationException(Status.NOT_FOUND);
}
 
开发者ID:EricssonResearch,项目名称:scott-eu,代码行数:20,代码来源:ResourceShapeService.java

示例5: toResponse

@Override
public Response toResponse(Throwable t) {
    if (t instanceof WebApplicationException) {
        return ((WebApplicationException) t).getResponse();
    }

    Status status = Status.INTERNAL_SERVER_ERROR;
    String message = Messages.ERROR_EXECUTING_REST_API_CALL;

    if (t instanceof ContentException) {
        status = Status.BAD_REQUEST;
    } else if (t instanceof NotFoundException) {
        status = Status.NOT_FOUND;
    } else if (t instanceof ConflictException) {
        status = Status.CONFLICT;
    }

    if (t instanceof SLException || t instanceof VirusScannerException) {
        message = t.getMessage();
    }

    LOGGER.error(Messages.ERROR_EXECUTING_REST_API_CALL, t);
    return Response.status(status).entity(message).type(MediaType.TEXT_PLAIN_TYPE).build();
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:24,代码来源:CFExceptionMapper.java

示例6: getPlace

@GET
@Path("places/{placeId}")
@Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON})
public Place getPlace(
            @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("placeId") final String placeId
    ) throws IOException, ServletException, URISyntaxException
{
    // Start of user code getResource_init
    // End of user code

    final Place aPlace = WarehouseControllerManager.getPlace(httpServletRequest, serviceProviderId, placeId);

    if (aPlace != null) {
        // Start of user code getPlace
        // End of user code
        httpServletResponse.addHeader(WarehouseControllerConstants.HDR_OSLC_VERSION, WarehouseControllerConstants.OSLC_VERSION_V2);
        return aPlace;
    }

    throw new WebApplicationException(Status.NOT_FOUND);
}
 
开发者ID:EricssonResearch,项目名称:scott-eu,代码行数:21,代码来源:ServiceProviderService1.java

示例7: checkViewItem

private void checkViewItem(ItemId itemId)
{
	ItemSerializerItemBean serializer = itemSerializerService
		.createItemBeanSerializer(new SingleItemWhereClause(itemId), new HashSet<String>(), false, VIEW_ITEM);

	Iterator<Long> iter = serializer.getItemIds().iterator();
	if( !iter.hasNext() )
	{
		throw new WebApplicationException(Status.NOT_FOUND);
	}

	Long itemKey = iter.next();
	if( !serializer.hasPrivilege(itemKey, ItemSecurityConstants.VIEW_ITEM) )
	{
		throw new PrivilegeRequiredException(ItemSecurityConstants.VIEW_ITEM);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:17,代码来源:ItemResourceImpl.java

示例8: getWaypointAsHtml

@GET
@Path("waypoints/{waypointId}")
@Produces({ MediaType.TEXT_HTML })
public Response getWaypointAsHtml(
    @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("waypointId") final String waypointId
    ) throws ServletException, IOException, URISyntaxException
{
    // Start of user code getWaypointAsHtml_init
    // End of user code

    final Waypoint aWaypoint = WarehouseControllerManager.getWaypoint(httpServletRequest, serviceProviderId, waypointId);

    if (aWaypoint != null) {
        httpServletRequest.setAttribute("aWaypoint", aWaypoint);
        // Start of user code getWaypointAsHtml_setAttributes
        // End of user code

        RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/se/ericsson/cf/scott/sandbox/waypoint.jsp");
        rd.forward(httpServletRequest,httpServletResponse);
    }

    throw new WebApplicationException(Status.NOT_FOUND);
}
 
开发者ID:EricssonResearch,项目名称:scott-eu,代码行数:23,代码来源:ServiceProviderService1.java

示例9: getWaypoint

@GET
@Path("waypoints/{waypointId}")
@Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON})
public Waypoint getWaypoint(
            @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("waypointId") final String waypointId
    ) throws IOException, ServletException, URISyntaxException
{
    // Start of user code getResource_init
    // End of user code

    final Waypoint aWaypoint = WarehouseControllerManager.getWaypoint(httpServletRequest, serviceProviderId, waypointId);

    if (aWaypoint != null) {
        // Start of user code getWaypoint
        // End of user code
        httpServletResponse.addHeader(WarehouseControllerConstants.HDR_OSLC_VERSION, WarehouseControllerConstants.OSLC_VERSION_V2);
        return aWaypoint;
    }

    throw new WebApplicationException(Status.NOT_FOUND);
}
 
开发者ID:EricssonResearch,项目名称:scott-eu,代码行数:21,代码来源:ServiceProviderService1.java

示例10: getMission

@GET
@Path("missions/{missionId}")
@Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON})
public Mission getMission(
            @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("missionId") final String missionId
    ) throws IOException, ServletException, URISyntaxException
{
    // Start of user code getResource_init
    // End of user code

    final Mission aMission = WarehouseControllerManager.getMission(httpServletRequest, serviceProviderId, missionId);

    if (aMission != null) {
        // Start of user code getMission
        // End of user code
        httpServletResponse.addHeader(WarehouseControllerConstants.HDR_OSLC_VERSION, WarehouseControllerConstants.OSLC_VERSION_V2);
        return aMission;
    }

    throw new WebApplicationException(Status.NOT_FOUND);
}
 
开发者ID:EricssonResearch,项目名称:scott-eu,代码行数:21,代码来源:ServiceProviderService1.java

示例11: validateCommand

private void validateCommand(String commandName) {
    if (commandMap.get(commandName) == null) {
        String message = "No such command '" + commandName + "'. Supported commmands are '"
                + String.join("', '", commandMap.keySet()) + "'";
        throw new WebApplicationException(message, Status.NOT_FOUND);
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:7,代码来源:LaunchResource.java

示例12: testCopyCtor

@Test
public void testCopyCtor() {
    final MinijaxStatusInfo i = new MinijaxStatusInfo(Status.NOT_FOUND);
    assertEquals(404, i.getStatusCode());
    assertEquals(Status.Family.CLIENT_ERROR, i.getFamily());
    assertEquals("Not Found", i.getReasonPhrase());
}
 
开发者ID:minijax,项目名称:minijax,代码行数:7,代码来源:StatusInfoTest.java

示例13: deregisterServiceProvider

public static void deregisterServiceProvider(final String serviceProviderId)
{
    synchronized(serviceProviders)
    {
        final ServiceProvider deregisteredServiceProvider =
            serviceProviders.remove(serviceProviderIdentifier(serviceProviderId));

        if (deregisteredServiceProvider != null)
        {
            final SortedSet<URI> remainingDomains = new TreeSet<URI>();

            for (final ServiceProvider remainingServiceProvider : serviceProviders.values())
            {
                remainingDomains.addAll(getServiceProviderDomains(remainingServiceProvider));
            }

            final SortedSet<URI> removedServiceProviderDomains = getServiceProviderDomains(deregisteredServiceProvider);

            removedServiceProviderDomains.removeAll(remainingDomains);
            serviceProviderCatalog.removeDomains(removedServiceProviderDomains);
            serviceProviderCatalog.removeServiceProvider(deregisteredServiceProvider);
        }
        else
        {
            throw new WebApplicationException(Status.NOT_FOUND);
        }
    }
}
 
开发者ID:EricssonResearch,项目名称:scott-eu,代码行数:28,代码来源:ServiceProviderCatalogSingleton.java

示例14: ensureFileExists

protected void ensureFileExists(StagingFile staging, String filepath)
{
	if( !fileSystemService.fileExists(staging, filepath) )
	{
		throw new WebApplicationException(Status.NOT_FOUND);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:7,代码来源:FileResourceImpl.java

示例15: createStagingFromItem

/**
 * @param itemUuid The uuid of the item to copy files from
 * @param version The version of the item to copy files from
 * @return
 */
@Override
public Response createStagingFromItem(String itemUuid, int itemVersion)
{
	final StagingFile stagingFile = stagingService.createStagingArea();

	if( Check.isEmpty(itemUuid) || itemVersion == 0 )
	{
		throw new WebApplicationException(
			new IllegalArgumentException("uuid and version must be supplied to the copy endpoint"),
			Status.BAD_REQUEST);
	}

	final Item item = itemService.get(new ItemId(itemUuid, itemVersion));
	if( aclService.filterNonGrantedPrivileges(item, PRIVS_COPY_ITEM_FILES).isEmpty() )
	{
		throw new PrivilegeRequiredException(PRIVS_COPY_ITEM_FILES);
	}

	final ItemFile itemFile = itemFileService.getItemFile(item);
	if( !fileSystemService.fileExists(itemFile) )
	{
		throw new WebApplicationException(Status.NOT_FOUND);
	}
	fileSystemService.copy(itemFile, stagingFile);

	// final RootFolderBean stagingBean = convertStagingFile(stagingFile,
	// false);
	// was: .entity(stagingBean)
	return Response.status(Status.CREATED).location(itemLinkService.getFileDirURI(stagingFile, null)).build();
}
 
开发者ID:equella,项目名称:Equella,代码行数:35,代码来源:FileResourceImpl.java


注:本文中的javax.ws.rs.core.Response.Status.NOT_FOUND属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。