本文整理匯總了Java中javax.ws.rs.core.Response.Status.Family.SUCCESSFUL屬性的典型用法代碼示例。如果您正苦於以下問題:Java Family.SUCCESSFUL屬性的具體用法?Java Family.SUCCESSFUL怎麽用?Java Family.SUCCESSFUL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.ws.rs.core.Response.Status.Family
的用法示例。
在下文中一共展示了Family.SUCCESSFUL屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findByDescriptionId
/**
* Returns description matches for the specified description id.
*
* @param descriptionId the description id
* @return the matches for description id
* @throws Exception the exception
*/
public MatchResults findByDescriptionId(String descriptionId)
throws Exception {
Logger.getLogger(getClass()).debug(
"Snomed Client - find description matches by description id "
+ descriptionId);
validateNotEmpty(descriptionId, "descriptionId");
final Client client = ClientBuilder.newClient();
final WebTarget target =
client.target(getUrl() + "/descriptions/" + descriptionId);
final Response response = target.request(MediaType.APPLICATION_JSON).get();
final String resultString = response.readEntity(String.class);
if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
// n/a
} else {
throw new Exception(response.toString());
}
// converting to object
return Utility.getGraphForJson(resultString, MatchResults.class);
}
示例2: findByConceptId
/**
* Returns the concept for the specified concept id.
*
* @param conceptId the concept id
* @return the concept for id
* @throws Exception the exception
*/
public Concept findByConceptId(String conceptId) throws Exception {
Logger.getLogger(getClass()).debug(
"Snomed Client - find concept by concept id " + conceptId);
validateNotEmpty(conceptId, "conceptId");
final Client client = ClientBuilder.newClient();
final WebTarget target = client.target(getUrl() + "/concepts/" + conceptId);
final Response response = target.request(MediaType.APPLICATION_JSON).get();
final String resultString = response.readEntity(String.class);
if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
// n/a
} else {
throw new Exception(response.toString());
}
// converting to object
return Utility.getGraphForJson(resultString, Concept.class);
}
示例3: processResponse
private ErrorInfo processResponse( Response response, String outputFilename )
{
if ( response.getStatusInfo().getFamily() == Family.SUCCESSFUL )
{
getLog().debug( String.format( "Status: [%d]", response.getStatus() ) );
InputStream in = response.readEntity( InputStream.class );
try
{
File of = new File( getOutputDir(), outputFilename );
pipeToFile( in, of );
}
catch ( IOException ex )
{
getLog().debug( String.format( "IOException: [%s]", ex.toString() ) );
return new ErrorInfo( String.format( "IOException: [%s]", ex.getMessage() ) );
}
}
else
{
getLog().warn( String.format( "Error code: [%d]", response.getStatus() ) );
getLog().debug( response.getEntity().toString() );
return new ErrorInfo( response.getStatus(), response.getEntity().toString() );
}
return null;
}
示例4: regenerateBins
@Override
public void regenerateBins(Long projectId, String type, String authToken)
throws Exception {
Logger.getLogger(getClass()).debug("Workflow Client - regenerate bins "
+ projectId + ", " + type + ", " + projectId);
validateNotEmpty(projectId, "projectId");
final Client client = ClientBuilder.newClient();
final WebTarget target = client.target(config.getProperty("base.url")
+ "/workflow/bin/regenerate/all?projectId=" + projectId + "&type="
+ type);
final Response response = target.request(MediaType.APPLICATION_XML)
.header("Authorization", authToken).post(Entity.text(""));
if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
// n/a
} else {
throw new Exception(response.toString());
}
}
示例5: updateProject
@Override
public void updateProject(ProjectJpa project, String authToken)
throws Exception {
Logger.getLogger(getClass())
.debug("Project Client - update project " + project);
Client client = ClientBuilder.newClient();
WebTarget target =
client.target(config.getProperty("base.url") + "/project/");
String projectString = ConfigUtility
.getStringForGraph(project == null ? new ProjectJpa() : project);
Response response = target.request(MediaType.APPLICATION_XML)
.header("Authorization", authToken).post(Entity.xml(projectString));
if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
// do nothing, successful
} else {
throw new Exception("Unexpected status - " + response.getStatus());
}
}
示例6: updateConcept
@Override
public void updateConcept(ConceptJpa concept, String authToken)
throws Exception {
Logger.getLogger(getClass())
.debug("Integration Test Client - update concept" + concept);
final Client client = ClientBuilder.newClient();
final WebTarget target =
client.target(config.getProperty("base.url") + "/test/concept/update");
final String conceptString = ConfigUtility
.getStringForGraph(concept == null ? new ConceptJpa() : concept);
final Response response = target.request(MediaType.APPLICATION_XML)
.header("Authorization", authToken).put(Entity.xml(conceptString));
final String resultString = response.readEntity(String.class);
if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
// n/a
} else {
throw new Exception(resultString);
}
}
示例7: exportWorkflowConfig
@Override
public InputStream exportWorkflowConfig(Long projectId, Long workflowId,
String authToken) throws Exception {
Logger.getLogger(getClass()).debug(
"Workflow Client - export workflow - " + projectId + ", " + workflowId);
validateNotEmpty(projectId, "projectId");
validateNotEmpty(workflowId, "workflowId");
Client client = ClientBuilder.newClient();
WebTarget target =
client.target(config.getProperty("base.url") + "/config/export"
+ "?projectId=" + projectId + "&workflowId=" + workflowId);
Response response = target.request(MediaType.APPLICATION_OCTET_STREAM)
.header("Authorization", authToken).post(Entity.text(""));
InputStream in = response.readEntity(InputStream.class);
if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
// n/a
} else {
throw new Exception(response.toString());
}
return in;
}
示例8: clearBins
@Override
public void clearBins(Long projectId, String type, String authToken)
throws Exception {
Logger.getLogger(getClass()).debug("Workflow Client - clear bins "
+ projectId + ", " + type + ", " + projectId);
validateNotEmpty(projectId, "projectId");
final Client client = ClientBuilder.newClient();
final WebTarget target = client.target(config.getProperty("base.url")
+ "/workflow/bin/clear/all?projectId=" + projectId + "&type=" + type);
final Response response = target.request(MediaType.APPLICATION_XML)
.header("Authorization", authToken).post(Entity.text(""));
if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
// n/a
} else {
throw new Exception(response.toString());
}
}
示例9: addPrecedenceList
@Override
public PrecedenceList addPrecedenceList(PrecedenceListJpa precedenceList,
String authToken) throws Exception {
Logger.getLogger(getClass())
.debug("Metadata Client - add precedence list ");
Client client = ClientBuilder.newClient();
WebTarget target =
client.target(config.getProperty("base.url") + "/metadata/precedence");
final String precString = ConfigUtility.getStringForGraph(
precedenceList == null ? new PrecedenceListJpa() : precedenceList);
Response response = target.request(MediaType.APPLICATION_XML)
.header("Authorization", authToken).put(Entity.xml(precString));
String resultString = response.readEntity(String.class);
if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
// n/a
} else {
throw new Exception(response.toString());
}
// converting to object
PrecedenceList result =
ConfigUtility.getGraphForString(resultString, PrecedenceListJpa.class);
return result;
}
示例10: removeConcept
@Override
public void removeConcept(Long id, boolean cascade, String authToken)
throws Exception {
Logger.getLogger(getClass())
.debug("Integration Test Client - remove concept " + id);
validateNotEmpty(id, "id");
final Client client = ClientBuilder.newClient();
final WebTarget target = client.target(config.getProperty("base.url")
+ "/test/concept/remove/" + id + (cascade ? "?cascade=true" : ""));
final Response response = target.request(MediaType.APPLICATION_XML)
.header("Authorization", authToken).delete();
if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
// do nothing, successful
} else {
throw new Exception("Unexpected status - " + response.getStatus());
}
}
示例11: addConceptNote
@Override
public void addConceptNote(Long id, String noteText, String authToken)
throws Exception {
Logger.getLogger(getClass()).debug("Content Client - add concept note for "
+ id + ", " + ", with text " + noteText);
final Client client = ClientBuilder.newClient();
final WebTarget target = client.target(
config.getProperty("base.url") + "/content/concept/" + id + "/note");
final Response response = target.request(MediaType.APPLICATION_XML)
.header("Authorization", authToken).post(Entity.text(noteText));
if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
// do nothing
} else {
throw new Exception(response.toString());
}
}
示例12: addDescriptorNote
@Override
public void addDescriptorNote(Long id, String noteText, String authToken)
throws Exception {
Logger.getLogger(getClass())
.debug("Content Client - add descriptor note for " + id + ", "
+ ", with text " + noteText);
final Client client = ClientBuilder.newClient();
final WebTarget target = client.target(
config.getProperty("base.url") + "/content/descriptor/" + id + "/note");
final Response response = target.request(MediaType.APPLICATION_XML)
.header("Authorization", authToken).post(Entity.text(noteText));
if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
// do nothing
} else {
throw new Exception(response.toString());
}
}
示例13: getCode
@Override
public Code getCode(String terminologyId, String terminology, String version,
Long projectId, String authToken) throws Exception {
Logger.getLogger(getClass())
.debug("Content Client - get code " + terminologyId + ", " + terminology
+ ", " + version + ", " + projectId + ", " + authToken);
validateNotEmpty(terminologyId, "terminologyId");
validateNotEmpty(terminology, "terminology");
validateNotEmpty(version, "version");
final Client client = ClientBuilder.newClient();
final WebTarget target = client.target(config.getProperty("base.url")
+ "/content/code/" + terminology + "/" + version + "/" + terminologyId);
final Response response = target.request(MediaType.APPLICATION_XML)
.header("Authorization", authToken).get();
final String resultString = response.readEntity(String.class);
if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
// n/a
} else {
throw new Exception(response.toString());
}
// converting to object
return ConfigUtility.getGraphForString(resultString, CodeJpa.class);
}
示例14: addRelationship
@Override
public ConceptRelationship addRelationship(
ConceptRelationshipJpa relationship, String authToken) throws Exception {
Logger.getLogger(getClass())
.debug("Integration Test Client - add relationship" + relationship);
final Client client = ClientBuilder.newClient();
final WebTarget target = client.target(
config.getProperty("base.url") + "/test/concept/relationship/add");
final String relString = ConfigUtility.getStringForGraph(
relationship == null ? new ConceptRelationshipJpa() : relationship);
final Response response = target.request(MediaType.APPLICATION_XML)
.header("Authorization", authToken).put(Entity.xml(relString));
final String resultString = response.readEntity(String.class);
if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
// n/a
} else {
throw new Exception("Unexpected status - " + response.getStatus());
}
// converting to object
return ConfigUtility.getGraphForString(resultString,
ConceptRelationshipJpa.class);
}
示例15: addUser
@Override
public User addUser(UserJpa user, String authToken) throws Exception {
Logger.getLogger(getClass()).debug("Security Client - add user " + user);
Client client = ClientBuilder.newClient();
WebTarget target =
client.target(config.getProperty("base.url") + "/security/user/add");
String userString =
(user != null ? ConfigUtility.getStringForGraph(user) : "");
Response response =
target.request(MediaType.APPLICATION_XML)
.header("Authorization", authToken).put(Entity.xml(userString));
String resultString = response.readEntity(String.class);
if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
// n/a
} else {
throw new Exception(response.toString());
}
// converting to object
UserJpa result =
ConfigUtility.getGraphForString(resultString, UserJpa.class);
return result;
}