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


Java RequestHeader类代码示例

本文整理汇总了Java中org.springframework.web.bind.annotation.RequestHeader的典型用法代码示例。如果您正苦于以下问题:Java RequestHeader类的具体用法?Java RequestHeader怎么用?Java RequestHeader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: updateCiStateBulk

import org.springframework.web.bind.annotation.RequestHeader; //导入依赖的package包/类
@RequestMapping(value="/cm/simple/cis/states", method = RequestMethod.PUT)
@ResponseBody
public String updateCiStateBulk(
		@RequestParam(value="ids", required = true) String ids,
		@RequestParam(value="newState", required = true) String newState,
		@RequestParam(value="relationName", required = false) String relName,
		@RequestParam(value="direction", required = false) String direction,
		@RequestParam(value="recursive", required = false) Boolean recursive,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope,
		@RequestHeader(value="X-Cms-User", required = false)  String userId) {
	
	String[] idsStr = ids.split(",");
    Long[] ciIds = new Long[idsStr.length];
    for (int i=0; i<idsStr.length; i++) {
            ciIds[i] = Long.valueOf(idsStr[i]);
    }
	cmManager.updateCiStateBulk(ciIds, newState, relName, direction, recursive != null, userId);
	return "{\"updated\"}";	
}
 
开发者ID:oneops,项目名称:oneops,代码行数:20,代码来源:CmRestController.java

示例2: mailSend

import org.springframework.web.bind.annotation.RequestHeader; //导入依赖的package包/类
@RequestMapping(path = "/eapi/sendgrid/v3/mail/send")
public ResponseEntity mailSend(
        @RequestBody MailSendForm form,
        @RequestHeader(required = false) String authorization
) {
    if (!checkAuthentication(authorization)) {
        return new ResponseEntity<>("", HttpStatus.UNAUTHORIZED);
    }

    String inbox = sendGridTokenVerifier.extractInbox(authorization.substring(7));

    sendGridEmailFactory.getEmailsFromRequest(form, inbox)
            .forEach((unsaved) -> {
                EmailRecord saved = emailRepository.save(unsaved);
                try {
                    emailWebSocketHandler.broadcastNewEmailMessage(saved);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            });

    return new ResponseEntity<>("", HttpStatus.ACCEPTED);
}
 
开发者ID:Stubmarine,项目名称:stubmarine,代码行数:24,代码来源:SendGridController.java

示例3: updateDeployment

import org.springframework.web.bind.annotation.RequestHeader; //导入依赖的package包/类
@RequestMapping(method=RequestMethod.PUT, value="/dj/simple/deployments/{dpmtId}")
@ResponseBody
public CmsDeployment updateDeployment(
		@RequestBody CmsDeployment dpmt, 
		@PathVariable long dpmtId,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope,
		@RequestHeader(value="X-Cms-User", required = false)  String userId) {
	try {
		scopeVerifier.verifyScope(scope, dpmt);
		dpmt.setDeploymentId(dpmtId);
		dpmt.setUpdatedBy(userId);
		return djManager.updateDeployment(dpmt);
	} catch (CmsBaseException e) {
		logger.error("CmsBaseException in updateDeployment", e);
		e.printStackTrace();
		throw e;
	}	
}
 
开发者ID:oneops,项目名称:oneops,代码行数:19,代码来源:DpmtRestController.java

示例4: getRfcById

import org.springframework.web.bind.annotation.RequestHeader; //导入依赖的package包/类
@RequestMapping(value="/dj/simple/cis/{ciId}", method = RequestMethod.GET)
@ResponseBody
@ReadOnlyDataAccess
public CmsRfcCISimple getRfcById(@PathVariable long ciId, 
		@RequestParam(value="releaseId", required = false) Long releaseId,
		@RequestParam(value="attrProps", required = false) String attrProps,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope){

       CmsRfcCI rfc = cmdjManager.getCiById(ciId, "df");

       if (rfc == null) throw new DJException(CmsError.DJ_NO_CI_WITH_GIVEN_ID_ERROR,
               "There is no rfc or ci with this id: " + ciId);

       scopeVerifier.verifyScope(scope, rfc);

       return cmsUtil.custRfcCI2RfcCISimple(rfc, attrProps);
}
 
开发者ID:oneops,项目名称:oneops,代码行数:18,代码来源:CmDjMergeController.java

示例5: post

import org.springframework.web.bind.annotation.RequestHeader; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json;charset=utf-8")
public ResponseEntity<?> post(@RequestHeader(value="Authorization") String authorization, @RequestBody Envelope envelope) throws OrgNotFoundException {
  Org org = orgService.findByApiKey(authorization);
  
  if (envelope != null) {
    List<Event> events = envelope.getData();
    List<String> ids = null;
    if (events != null && !events.isEmpty()) {
      ids = new ArrayList<>();
      for (Event event : events) {
        try {
          String savedId = this.eventService.save(org.getMetadata().get(Vocabulary.TENANT), org.getSourcedId(), event);
          ids.add(savedId);
        } catch (Exception e) {
          logger.error("Unable to save event {}",event);
          continue;
        }
      }
    }
    
    return new ResponseEntity<>(ids, null, HttpStatus.OK);
  }
  
  return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
 
开发者ID:Apereo-Learning-Analytics-Initiative,项目名称:OpenLRW,代码行数:26,代码来源:ApiKeyOnlyCaliperController.java

示例6: executeCustomCommand

import org.springframework.web.bind.annotation.RequestHeader; //导入依赖的package包/类
@RequestMapping(value = "/customcommand", method = RequestMethod.POST)
public ResponseEntity<CustomResponse> executeCustomCommand(@RequestParam("command") String command,
		@RequestHeader(value = "JHeapSessionId") String JHeapSessionId) {
	if (command == null || command.isEmpty()) {
		return new ResponseEntity<CustomResponse>(HttpStatus.BAD_REQUEST);
	}
	CustomResponse analysis = analysisService.executeCustomCommand(command);
	return new ResponseEntity<CustomResponse>(analysis, HttpStatus.OK);
}
 
开发者ID:mgbiedma,项目名称:java-heap-analyzer-api,代码行数:10,代码来源:RestApiController.java

示例7: tagRfc

import org.springframework.web.bind.annotation.RequestHeader; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.PUT, value = "/cm/simple/ci/{ciId}/altNs")
@ResponseBody
public void tagRfc(@PathVariable long ciId,
				   @RequestParam(value = "tag", required = false) String tag,
				   @RequestParam(value = "altNsPath", required = false) String altNsPath,
				   @RequestParam(value = "altNsId", required = false) Long altNsId,
				   @RequestHeader(value = "X-Cms-User", required = false) String userId,
				   @RequestHeader(value = "X-Cms-Scope", required = false) String scope) throws DJException {

	CmsCI ci = cmManager.getCiById(ciId);
	scopeVerifier.verifyScope(scope, ci);
	CmsAltNs cmsAltNs = new CmsAltNs();
	cmsAltNs.setNsPath(altNsPath);
	if (altNsId != null) {
		cmsAltNs.setNsId(altNsId);
	}
	cmsAltNs.setTag(tag);
	cmManager.createAltNs(cmsAltNs, ci);
}
 
开发者ID:oneops,项目名称:oneops,代码行数:20,代码来源:CmRestController.java

示例8: login

import org.springframework.web.bind.annotation.RequestHeader; //导入依赖的package包/类
@RequestMapping(value = "/login" , method=RequestMethod.GET)
@Menu(type = "apps" , subtype = "user" , access = true)
public ModelAndView login(HttpServletRequest request, HttpServletResponse response  , @RequestHeader(value = "referer", required = false) String referer , @Valid String msg) {
	ModelAndView view = request(super.createRequestPageTempletResponse("redirect:/"));
	if(request.getSession(true).getAttribute(UKDataContext.USER_SESSION_NAME) ==null){
		view = request(super.createRequestPageTempletResponse("/login"));
 	if(!StringUtils.isBlank(request.getParameter("referer"))){
 		referer = request.getParameter("referer") ;
 	}
 	if(!StringUtils.isBlank(referer)){
 		view.addObject("referer", referer) ;
 	}
	}
	if(!StringUtils.isBlank(msg)){
		view.addObject("msg", msg) ;
	}
    return view;
}
 
开发者ID:uckefu,项目名称:uckefu,代码行数:19,代码来源:LoginController.java

示例9: createCIRelation

import org.springframework.web.bind.annotation.RequestHeader; //导入依赖的package包/类
@RequestMapping(method=RequestMethod.POST, value="/cm/simple/relations")
@ResponseBody
public CmsCIRelationSimple createCIRelation(
		@RequestParam(value="value", required = false)  String valueType, 
		@RequestBody CmsCIRelationSimple relSimple,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope,
		@RequestHeader(value="X-Cms-User", required = false)  String userId) throws CIValidationException {
	
	scopeVerifier.verifyScope(scope, relSimple);
	
	CmsCIRelation rel = cmsUtil.custCIRelationSimple2CIRelation(relSimple, valueType);
	rel.setCreatedBy(userId);
	try {
		CmsCIRelation newRel = cmManager.createRelation(rel);
		return cmsUtil.custCIRelation2CIRelationSimple(newRel, valueType,false);
	} catch (DataIntegrityViolationException dive) {
		if (dive instanceof DuplicateKeyException) {
			throw new CIValidationException(CmsError.CMS_DUPCI_NAME_ERROR, dive.getMessage());
		} else {
			throw new CmsException(CmsError.CMS_EXCEPTION, dive.getMessage());
		}
	}
}
 
开发者ID:oneops,项目名称:oneops,代码行数:24,代码来源:CmRestController.java

示例10: apiV1NotesGet

import org.springframework.web.bind.annotation.RequestHeader; //导入依赖的package包/类
public ResponseEntity<List<OverviewNote>> apiV1NotesGet(
		@ApiParam(value = "Unique Identifier of the User requesting his notes.", required = true) @RequestHeader(value = "userId", required = true) Long userId,
		@ApiParam(value = "Page of notes that's beeing returned.", defaultValue = "0") @RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
		@ApiParam(value = "Amount of notes per page.", defaultValue = "10") @RequestParam(value = "items", required = false, defaultValue = "5") Integer items,
		@ApiParam(value = "If true, only archived notes are returned.", defaultValue = "false") @RequestParam(value = "showArchived", required = false, defaultValue = "false") Boolean showArchived)
		throws DtoValidationFailedException {
	
	assertPagination(page, items);
	List<OverviewNote> notes = new ArrayList<>();
	
	if (showArchived) {
		notes = service.findArchivedNotesByUserIdPaginated(userId, new PageRequest(page, items));
	} else {
		notes = service.findNotesByUserIdPaginated(userId, new PageRequest(page, items));
	}
	return new ResponseEntity<List<OverviewNote>>(notes,HttpStatus.OK);
}
 
开发者ID:daflockinger,项目名称:poppynotes,代码行数:18,代码来源:NotesApiController.java

示例11: getCIBy3

import org.springframework.web.bind.annotation.RequestHeader; //导入依赖的package包/类
@RequestMapping(value="/cm/cis", method = RequestMethod.GET)
@ResponseBody
@ReadOnlyDataAccess
public List<CmsCI> getCIBy3(
		@RequestParam("ns") String nsPath,  
		@RequestParam("clazz") String clazzName, 
		@RequestParam("ciname") String ciName,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope){
	
	List<CmsCI> ciList = cmManager.getCiBy3(nsPath,clazzName, ciName);
	
	if (scope != null) {
		for (CmsCI ci : ciList) {
			scopeVerifier.verifyScope(scope, ci);
		}
	}
	return ciList;
}
 
开发者ID:oneops,项目名称:oneops,代码行数:19,代码来源:CmRestController.java

示例12: getCISimpleById

import org.springframework.web.bind.annotation.RequestHeader; //导入依赖的package包/类
@RequestMapping(value="/cm/simple/cis/{ciId}", method = RequestMethod.GET)
@ResponseBody
@ReadOnlyDataAccess
public CmsCISimple getCISimpleById(@PathVariable long ciId, 
		@RequestParam(value="value", required = false) String valueType,
		@RequestParam(value="getEncrypted", required = false) String getEncrypted,
		@RequestParam(value="attrProps", required = false) String attrProps,
		@RequestParam(value="includeAltNs", required = false)  String includeAltNs,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope) {
	
	CmsCI ci = cmManager.getCiById(ciId);

	if (ci == null) throw new CmsException(CmsError.CMS_NO_CI_WITH_GIVEN_ID_ERROR,
                                       "There is no ci with this id");

	scopeVerifier.verifyScope(scope, ci);

	return cmsUtil.custCI2CISimple(ci, valueType, attrProps, getEncrypted != null, includeAltNs);
}
 
开发者ID:oneops,项目名称:oneops,代码行数:20,代码来源:CmRestController.java

示例13: getPipeline

import org.springframework.web.bind.annotation.RequestHeader; //导入依赖的package包/类
@ApiOperation(value = "", notes = "Retrieve pipeline details for an organization", response = Pipeline.class, authorizations = {
    @Authorization(value = "jenkins_auth")
}, tags={ "blueOcean", })
@ApiResponses(value = { 
    @ApiResponse(code = 200, message = "Successfully retrieved pipeline details", response = Pipeline.class),
    @ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = Void.class),
    @ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = Void.class),
    @ApiResponse(code = 404, message = "Pipeline cannot be found on Jenkins instance", response = Void.class) })
@RequestMapping(value = "/blue/rest/organizations/{organization}/pipelines/{pipeline}",
    produces = { "application/json" }, 
    method = RequestMethod.GET)
ResponseEntity<Pipeline> getPipeline(@ApiParam(value = "Name of the organization",required=true ) @PathVariable("organization") String organization,@ApiParam(value = "Name of the pipeline",required=true ) @PathVariable("pipeline") String pipeline, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
 
开发者ID:cliffano,项目名称:swaggy-jenkins,代码行数:13,代码来源:BlueApi.java

示例14: updateRfcRelation

import org.springframework.web.bind.annotation.RequestHeader; //导入依赖的package包/类
@RequestMapping(method=RequestMethod.PUT, value="/dj/simple/rfc/relations/{rfcId}")
@ResponseBody
public CmsRfcRelationSimple updateRfcRelation(
		@PathVariable long rfcId, 
		@RequestBody CmsRfcRelationSimple relSimple,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope,
		@RequestHeader(value="X-Cms-User", required = false)  String userId) throws DJException {
	
	scopeVerifier.verifyScope(scope, relSimple);

	relSimple.setRfcId(rfcId);
	CmsRfcRelation rel = cmsUtil.custRfcRelSimple2RfcRel(relSimple);
	rel.setUpdatedBy(userId);
	return cmsUtil.custRfcRel2RfcRelSimple(djManager.updateRfcRelation(rel));
}
 
开发者ID:oneops,项目名称:oneops,代码行数:16,代码来源:DjRestController.java

示例15: getJobLastBuild

import org.springframework.web.bind.annotation.RequestHeader; //导入依赖的package包/类
public ResponseEntity<FreeStyleBuild> getJobLastBuild(@ApiParam(value = "Name of the job",required=true ) @PathVariable("name") String name,
    @RequestHeader(value = "Accept", required = false) String accept) throws Exception {
    // do some magic!

    if (accept != null && accept.contains("application/json")) {
        return new ResponseEntity<FreeStyleBuild>(objectMapper.readValue("{  \"queueId\" : 5,  \"displayName\" : \"displayName\",  \"keepLog\" : true,  \"description\" : \"description\",  \"fullDisplayName\" : \"fullDisplayName\",  \"estimatedDuration\" : 5,  \"url\" : \"url\",  \"building\" : true,  \"changeSet\" : {    \"kind\" : \"kind\",    \"_class\" : \"_class\"  },  \"duration\" : 1,  \"result\" : \"result\",  \"number\" : 6,  \"executor\" : \"executor\",  \"builtOn\" : \"builtOn\",  \"_class\" : \"_class\",  \"id\" : \"id\",  \"actions\" : [ {    \"causes\" : [ {      \"_class\" : \"_class\",      \"shortDescription\" : \"shortDescription\",      \"userName\" : \"userName\",      \"userId\" : \"userId\"    }, {      \"_class\" : \"_class\",      \"shortDescription\" : \"shortDescription\",      \"userName\" : \"userName\",      \"userId\" : \"userId\"    } ],    \"_class\" : \"_class\"  }, {    \"causes\" : [ {      \"_class\" : \"_class\",      \"shortDescription\" : \"shortDescription\",      \"userName\" : \"userName\",      \"userId\" : \"userId\"    }, {      \"_class\" : \"_class\",      \"shortDescription\" : \"shortDescription\",      \"userName\" : \"userName\",      \"userId\" : \"userId\"    } ],    \"_class\" : \"_class\"  } ],  \"timestamp\" : 2}", FreeStyleBuild.class), HttpStatus.OK);
    }

    return new ResponseEntity<FreeStyleBuild>(HttpStatus.OK);
}
 
开发者ID:cliffano,项目名称:swaggy-jenkins,代码行数:11,代码来源:JobApiController.java


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