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


Java ResponseBuilderImpl.build方法代码示例

本文整理汇总了Java中com.sun.jersey.core.spi.factory.ResponseBuilderImpl.build方法的典型用法代码示例。如果您正苦于以下问题:Java ResponseBuilderImpl.build方法的具体用法?Java ResponseBuilderImpl.build怎么用?Java ResponseBuilderImpl.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.jersey.core.spi.factory.ResponseBuilderImpl的用法示例。


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

示例1: generateAgreementFromTemplate

import com.sun.jersey.core.spi.factory.ResponseBuilderImpl; //导入方法依赖的package包/类
@GET
@Path("commands/fromtemplate")
@Produces(MediaType.APPLICATION_XML)
public Response generateAgreementFromTemplate(@QueryParam("templateId") String templateId) throws JAXBException {
    ITemplate template = templateDAO.getByUuid(templateId);

    Template wsagTemplate;
    try {
        wsagTemplate = templateParser.getWsagObject(template.getText());
    } catch (ParserException e) {
        throw new SlaGeneratorException(e.getMessage(), e);
    }
    Agreement wsagAgreement = new AgreementGenerator(wsagTemplate).generate();
    logger.debug(JaxbUtils.toString(wsagAgreement));
    
    ResponseBuilderImpl builder = new ResponseBuilderImpl();
    builder.status(HttpStatus.OK.value());
    builder.entity(wsagAgreement);
    return builder.build();
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:21,代码来源:SeacloudsRest.java

示例2: buildResponsePOST

import com.sun.jersey.core.spi.factory.ResponseBuilderImpl; //导入方法依赖的package包/类
protected Response buildResponsePOST(HttpStatus status, MessageResponse message, String location) {
	ResponseBuilderImpl builder = new ResponseBuilderImpl();
	builder.header("location", location);
	builder.status(status.value());
	builder.entity(message);
	return builder.build();		
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:8,代码来源:AbstractSLARest.java

示例3: authenticatedUser

import com.sun.jersey.core.spi.factory.ResponseBuilderImpl; //导入方法依赖的package包/类
public AccountModel authenticatedUser(AccountModel oAccount)
{
 try
 {
	//create a new session and begin the transaction
    Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
	Transaction hibernateTransaction = hibernateSession.beginTransaction();
	
	//create the query in HQL language
	String strQuery = String.format("FROM AccountModel WHERE (username = '%s' AND password = '%s')", oAccount.getUsername() , oAccount.getPassword());
	Query  hibernateQuery = hibernateSession.createQuery(strQuery);
	
	oAccount = null;
	
	//retrieve the unique result, if there is a result at all
	oAccount = (AccountModel) hibernateQuery.uniqueResult();
	
	if(oAccount == null)
	{
   		throw new WebApplicationException(Response.Status.UNAUTHORIZED);
	}
	
	//commit and terminate the session
	hibernateTransaction.commit();
	hibernateSession.close();
	
	//return the <AuthenticationModel> of the authenticated user, or null if authentication failed
	return oAccount;
}
catch (HibernateException exception)
{
	System.out.println(exception.getCause());

	ResponseBuilderImpl builder = new ResponseBuilderImpl();
	builder.status(Response.Status.BAD_REQUEST);
	builder.entity(String.format("%s",exception.getCause()));
	Response response = builder.build();
	throw new WebApplicationException(response);
}
}
 
开发者ID:s-case,项目名称:web-service-annotation-tool,代码行数:41,代码来源:SQLITEController.java

示例4: postInputMessage

import com.sun.jersey.core.spi.factory.ResponseBuilderImpl; //导入方法依赖的package包/类
public InputMessageModel postInputMessage(InputMessageModel oInputMessage)
{
 try
 {
	//create a new session and begin the transaction
	Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
	Transaction hibernateTransaction = hibernateSession.beginTransaction();
	
	//insert the new <ResourceName> to database 
	int InputMessageId = (Integer) hibernateSession.save(oInputMessage);
	
	//commit and terminate the session
	hibernateTransaction.commit();
	hibernateSession.close();
	
	//return the <accountModelName> with updated <accountModelName>Id
	oInputMessage.setInputMessageId(InputMessageId);
	return oInputMessage;
 }
	catch (HibernateException exception)
	{
		System.out.println(exception.getCause());

		ResponseBuilderImpl builder = new ResponseBuilderImpl();
		builder.status(Response.Status.BAD_REQUEST);
		builder.entity(String.format("%s",exception.getCause()));
		Response response = builder.build();
		throw new WebApplicationException(response);
	}
}
 
开发者ID:s-case,项目名称:web-service-annotation-tool,代码行数:31,代码来源:SQLITEController.java

示例5: getAccount

import com.sun.jersey.core.spi.factory.ResponseBuilderImpl; //导入方法依赖的package包/类
public AccountModel getAccount(AccountModel oAccount)
{
 try
 {
		//create a new session and begin the transaction
	Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
	Transaction hibernateTransaction = hibernateSession.beginTransaction();
	
	//find the  <ResourceName> in the database 
	oAccount = (AccountModel) hibernateSession.get(AccountModel.class, oAccount.getAccountId());

	if(oAccount == null)
	{
   		throw new WebApplicationException(Response.Status.NOT_FOUND);
	}
	
	//commit and terminate the session
	hibernateTransaction.commit();
	hibernateSession.close();
	
	return oAccount;
 }		
catch (HibernateException exception)
{
	System.out.println(exception.getCause());

	ResponseBuilderImpl builder = new ResponseBuilderImpl();
	builder.status(Response.Status.BAD_REQUEST);
	builder.entity(String.format("%s",exception.getCause()));
	Response response = builder.build();
	throw new WebApplicationException(response);
}
}
 
开发者ID:s-case,项目名称:web-service-annotation-tool,代码行数:34,代码来源:SQLITEController.java

示例6: putAccount

import com.sun.jersey.core.spi.factory.ResponseBuilderImpl; //导入方法依赖的package包/类
public AccountModel putAccount(AccountModel oAccount)
{
 try
 {
	//create a new session and begin the transaction
	Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
	Transaction hibernateTransaction = hibernateSession.beginTransaction();
	
	//update the  <ResourceName> to database 
	hibernateSession.update(oAccount);
	
	//commit and terminate the session
	hibernateTransaction.commit();
	hibernateSession.close();
	
	return oAccount;
 }		
catch (HibernateException exception)
{
	System.out.println(exception.getCause());

	ResponseBuilderImpl builder = new ResponseBuilderImpl();
	builder.status(Response.Status.BAD_REQUEST);
	builder.entity(String.format("%s",exception.getCause()));
	Response response = builder.build();
	throw new WebApplicationException(response);
}
}
 
开发者ID:s-case,项目名称:web-service-annotation-tool,代码行数:29,代码来源:SQLITEController.java

示例7: deleteAccount

import com.sun.jersey.core.spi.factory.ResponseBuilderImpl; //导入方法依赖的package包/类
public AccountModel deleteAccount(AccountModel oAccount)
{
 try
 {
 		//create a new session and begin the transaction
	Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
	Transaction hibernateTransaction = hibernateSession.beginTransaction();

	//find the  <ResourceName> in the database 
       oAccount = (AccountModel) hibernateSession.get(AccountModel.class, oAccount.getAccountId());
       
	if(oAccount == null)
	{
   		throw new WebApplicationException(Response.Status.NOT_FOUND);
	}
       
       oAccount.deleteAllCollections(hibernateSession);
	
	hibernateSession.delete(oAccount);
	
	//commit and terminate the session
	hibernateTransaction.commit();
	hibernateSession.close();
	return oAccount;
 }		
catch (HibernateException exception)
{
	System.out.println(exception.getCause());

	ResponseBuilderImpl builder = new ResponseBuilderImpl();
	builder.status(Response.Status.BAD_REQUEST);
	builder.entity(String.format("%s",exception.getCause()));
	Response response = builder.build();
	throw new WebApplicationException(response);
}
}
 
开发者ID:s-case,项目名称:web-service-annotation-tool,代码行数:37,代码来源:SQLITEController.java

示例8: postRESTService

import com.sun.jersey.core.spi.factory.ResponseBuilderImpl; //导入方法依赖的package包/类
public RESTServiceModel postRESTService(RESTServiceModel oRESTService)
{
	try
	{
		//create a new session and begin the transaction
		Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
		Transaction hibernateTransaction = hibernateSession.beginTransaction();
	
		//insert the new <ResourceName> to database
		int RESTServiceId = (Integer) hibernateSession.save(oRESTService);

		//commit and terminate the session
		hibernateTransaction.commit();
		hibernateSession.close();

	
		//return the <accountModelName> with updated <accountModelName>Id
		oRESTService.setRESTServiceId(RESTServiceId);
		return oRESTService;
	}
	catch (HibernateException exception)
	{
		System.out.println(exception.getCause());

		ResponseBuilderImpl builder = new ResponseBuilderImpl();
		builder.status(Response.Status.BAD_REQUEST);
		builder.entity(String.format("%s",exception.getCause()));
		Response response = builder.build();
		throw new WebApplicationException(response);
	}
}
 
开发者ID:s-case,项目名称:web-service-annotation-tool,代码行数:32,代码来源:SQLITEController.java

示例9: deleteSOAPOperation

import com.sun.jersey.core.spi.factory.ResponseBuilderImpl; //导入方法依赖的package包/类
public SOAPOperationModel deleteSOAPOperation(SOAPOperationModel oSOAPOperation)
{
 try
 {
 		//create a new session and begin the transaction
	Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
	Transaction hibernateTransaction = hibernateSession.beginTransaction();

	//find the  <ResourceName> in the database
       //retrieve the whole resource

       oSOAPOperation = (SOAPOperationModel) hibernateSession.get(SOAPOperationModel.class, oSOAPOperation.getSOAPOperationId());
	
	if(oSOAPOperation == null)
	{
   		throw new WebApplicationException(Response.Status.NOT_FOUND);
	}
       
       oSOAPOperation.deleteAllCollections(hibernateSession);

       hibernateSession.delete(oSOAPOperation);
	
	//commit and terminate the session
	hibernateTransaction.commit();
	hibernateSession.close();
       return oSOAPOperation;
 }
	catch (HibernateException exception)
	{
		System.out.println(exception.getCause());

		ResponseBuilderImpl builder = new ResponseBuilderImpl();
		builder.status(Response.Status.BAD_REQUEST);
		builder.entity(String.format("%s",exception.getCause()));
		Response response = builder.build();
		throw new WebApplicationException(response);
	}
}
 
开发者ID:s-case,项目名称:web-service-annotation-tool,代码行数:39,代码来源:SQLITEController.java

示例10: deleteRESTParameter

import com.sun.jersey.core.spi.factory.ResponseBuilderImpl; //导入方法依赖的package包/类
public RESTParameterModel deleteRESTParameter(RESTParameterModel oRESTParameter)
{
 try
 {
 		//create a new session and begin the transaction
	Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
	Transaction hibernateTransaction = hibernateSession.beginTransaction();

	//find the  <ResourceName> in the database 
       oRESTParameter = (RESTParameterModel) hibernateSession.get(RESTParameterModel.class, oRESTParameter.getRESTParameterId());

	if(oRESTParameter == null)
	{
   		throw new WebApplicationException(Response.Status.NOT_FOUND);
	}
       
       oRESTParameter.deleteAllCollections(hibernateSession);
	hibernateSession.delete(oRESTParameter);
	
	//commit and terminate the session
	hibernateTransaction.commit();
	hibernateSession.close();
	return oRESTParameter;
 }		
catch (HibernateException exception)
{
	System.out.println(exception.getCause());

	ResponseBuilderImpl builder = new ResponseBuilderImpl();
	builder.status(Response.Status.BAD_REQUEST);
	builder.entity(String.format("%s",exception.getCause()));
	Response response = builder.build();
	throw new WebApplicationException(response);
}
}
 
开发者ID:s-case,项目名称:web-service-annotation-tool,代码行数:36,代码来源:SQLITEController.java

示例11: getInputMessage

import com.sun.jersey.core.spi.factory.ResponseBuilderImpl; //导入方法依赖的package包/类
public InputMessageModel getInputMessage(InputMessageModel oInputMessage)
{
 try
 {
		//create a new session and begin the transaction
	Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
	Transaction hibernateTransaction = hibernateSession.beginTransaction();
	
	//find the  <ResourceName> in the database 
	oInputMessage = (InputMessageModel) hibernateSession.get(InputMessageModel.class, oInputMessage.getInputMessageId());

	if(oInputMessage == null)
	{
   		throw new WebApplicationException(Response.Status.NOT_FOUND);
	}
	
	//commit and terminate the session
	hibernateTransaction.commit();
	hibernateSession.close();
	
	return oInputMessage;
 }
	catch (HibernateException exception)
	{
		System.out.println(exception.getCause());

		ResponseBuilderImpl builder = new ResponseBuilderImpl();
		builder.status(Response.Status.BAD_REQUEST);
		builder.entity(String.format("%s",exception.getCause()));
		Response response = builder.build();
		throw new WebApplicationException(response);
	}
}
 
开发者ID:s-case,项目名称:web-service-annotation-tool,代码行数:34,代码来源:SQLITEController.java

示例12: postInputParameter

import com.sun.jersey.core.spi.factory.ResponseBuilderImpl; //导入方法依赖的package包/类
public InputParameterModel postInputParameter(InputParameterModel oInputParameter)
{
 try
 {
	//create a new session and begin the transaction
	Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
	Transaction hibernateTransaction = hibernateSession.beginTransaction();
	
	//insert the new <ResourceName> to database 
	int InputParameterId = (Integer) hibernateSession.save(oInputParameter);
	
	//commit and terminate the session
	hibernateTransaction.commit();
	hibernateSession.close();
	
	//return the <accountModelName> with updated <accountModelName>Id
	oInputParameter.setInputParameterId(InputParameterId);
	return oInputParameter;
 }
	catch (HibernateException exception)
	{
		System.out.println(exception.getCause());

		ResponseBuilderImpl builder = new ResponseBuilderImpl();
		builder.status(Response.Status.BAD_REQUEST);
		builder.entity(String.format("%s",exception.getCause()));
		Response response = builder.build();
		throw new WebApplicationException(response);
	}
}
 
开发者ID:s-case,项目名称:web-service-annotation-tool,代码行数:31,代码来源:SQLITEController.java

示例13: getResource

import com.sun.jersey.core.spi.factory.ResponseBuilderImpl; //导入方法依赖的package包/类
public ResourceModel getResource(ResourceModel oResource)
{
 try
 {
		//create a new session and begin the transaction
	Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
	Transaction hibernateTransaction = hibernateSession.beginTransaction();
	
	//find the  <ResourceName> in the database 
	oResource = (ResourceModel) hibernateSession.get(ResourceModel.class, oResource.getResourceId());

	if(oResource == null)
	{
   		throw new WebApplicationException(Response.Status.NOT_FOUND);
	}
	
	//commit and terminate the session
	hibernateTransaction.commit();
	hibernateSession.close();
	
	return oResource;
 }		
catch (HibernateException exception)
{
	System.out.println(exception.getCause());

	ResponseBuilderImpl builder = new ResponseBuilderImpl();
	builder.status(Response.Status.BAD_REQUEST);
	builder.entity(String.format("%s",exception.getCause()));
	Response response = builder.build();
	throw new WebApplicationException(response);
}
}
 
开发者ID:s-case,项目名称:web-service-annotation-tool,代码行数:34,代码来源:SQLITEController.java

示例14: getRESTMethodRESTParameterList

import com.sun.jersey.core.spi.factory.ResponseBuilderImpl; //导入方法依赖的package包/类
public RESTMethodModel getRESTMethodRESTParameterList(RESTMethodModel oRESTMethod)
{
 try
 {
	 //create a new session and begin the transaction
	 Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
	 Transaction hibernateTransaction = hibernateSession.beginTransaction();

	 //find the  <ResourceName> in the database
	 oRESTMethod = (RESTMethodModel) hibernateSession.get(RESTMethodModel.class, oRESTMethod.getRESTMethodId());

	 //commit and terminate the session
	 hibernateTransaction.commit();
	 hibernateSession.close();

	 return oRESTMethod;
 }
	catch (HibernateException exception)
	{
		System.out.println(exception.getCause());

		ResponseBuilderImpl builder = new ResponseBuilderImpl();
		builder.status(Response.Status.BAD_REQUEST);
		builder.entity(String.format("%s",exception.getCause()));
		Response response = builder.build();
		throw new WebApplicationException(response);
	}
}
 
开发者ID:s-case,项目名称:web-service-annotation-tool,代码行数:29,代码来源:SQLITEController.java

示例15: postSOAPOperation

import com.sun.jersey.core.spi.factory.ResponseBuilderImpl; //导入方法依赖的package包/类
public SOAPOperationModel postSOAPOperation(SOAPOperationModel oSOAPOperation)
{
 try
 {
	//create a new session and begin the transaction
	Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
	Transaction hibernateTransaction = hibernateSession.beginTransaction();
	
	//insert the new <ResourceName> to database 
	int SOAPOperationId = (Integer) hibernateSession.save(oSOAPOperation);
	
	//commit and terminate the session
	hibernateTransaction.commit();
	hibernateSession.close();
	
	//return the <accountModelName> with updated <accountModelName>Id
	oSOAPOperation.setSOAPOperationId(SOAPOperationId);
	return oSOAPOperation;
 }
	catch (HibernateException exception)
	{
		System.out.println(exception.getCause());

		ResponseBuilderImpl builder = new ResponseBuilderImpl();
		builder.status(Response.Status.BAD_REQUEST);
		builder.entity(String.format("%s",exception.getCause()));
		Response response = builder.build();
		throw new WebApplicationException(response);
	}
}
 
开发者ID:s-case,项目名称:web-service-annotation-tool,代码行数:31,代码来源:SQLITEController.java


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