當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。