/** * Makes the URL of this request absolute. * * @param baseURL * the context in which this request occurred */ protected void resolveRelativeUrl(String baseURL) { try { URL baseUrl = new URL(baseURL); url = new URL(baseUrl, getUrl()).toString(); } catch (MalformedURLException e) { LOG.error("Could not resolve relative URL", e); } }
/** * {@inheritDoc} */ @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = (prime * result) + ((this.baseUrl == null) ? 0 : this.baseUrl.hashCode()); result = (prime * result) + ((this.initiatorType == null) ? 0 : this.initiatorType.hashCode()); result = (prime * result) + (int) (this.transferSize ^ (this.transferSize >>> 32)); return result; }
/** * {@inheritDoc} */ @Override public void deserializationComplete(Beacon beacon) { super.resolveRelativeUrl(baseUrl); }
protected void initMocks(AbstractRequest targetElement) { when(pageLoadRequestSpan.getDetails()).thenReturn(pageLoadRequest); when(pageLoadRequest.getOwningSpan()).thenReturn(pageLoadRequestSpan); when(sessionInfo.getSessionId()).thenReturn(SESSION_ID); when(pageLoadRequestSpan.getSessionId()).thenReturn(SESSION_ID); when(pageLoadRequestSpan.getTabId()).thenReturn(TAB_ID); if (targetElement != null) { EUMSpan span = Mockito.mock(EUMSpan.class); when(span.getDetails()).thenReturn(targetElement); when(targetElement.getOwningSpan()).thenReturn(span); when(span.getSessionId()).thenReturn(SESSION_ID); when(span.getTabId()).thenReturn(TAB_ID); when(targetElement.getUrl()).thenReturn(URL); } // assign data when(sessionInfo.getBrowser()).thenReturn(BROWSER); when(sessionInfo.getDevice()).thenReturn(DEVICE); when(sessionInfo.getLanguage()).thenReturn(LANGUAGE); when(pageLoadRequest.getUrl()).thenReturn(PAGELOAD_URL); }
return true; if (!super.equals(obj)) { return false;
/** * {@inheritDoc} */ @Override public void collectTags(Map<String, String> tags) { super.collectTags(tags); tags.put(Tags.HTTP_METHOD.getKey(), "GET"); }
return true; if (!super.equals(obj)) { return false;
/** * {@inheritDoc} */ @Override public void collectTags(Map<String, String> tags) { super.collectTags(tags); tags.put(Tags.HTTP_STATUS.getKey(), String.valueOf(status)); tags.put(Tags.HTTP_METHOD.getKey(), method); }
/** * * Adds the basic data from {@link Series} and {@link Series#EUMBasicRequestSeries} to the * builder. Does not set the time of the point, this has to be done by the caller! * * @param sessionInfo * the sessionInfo belonging to the given request, can be null if unavailable * @param builder * the point builder for the record. * @param request * the request for which teh data point is built */ protected void addBasicRequestData(Builder builder, UserSessionInfo sessionInfo, R request) { if (sessionInfo != null) { builder.tag(Series.EUMBasicRequestSeries.TAG_BROWSER, sessionInfo.getBrowser()); builder.tag(Series.EUMBasicRequestSeries.TAG_DEVICE, sessionInfo.getDevice()); builder.tag(Series.EUMBasicRequestSeries.TAG_LANGUAGE, sessionInfo.getLanguage()); } builder.tag(Series.EUMBasicRequestSeries.TAG_URL, request.getUrl()); }
/** * {@inheritDoc} */ @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = (prime * result) + ((this.baseUrl == null) ? 0 : this.baseUrl.hashCode()); result = (prime * result) + (this.isAsync ? 1231 : 1237); result = (prime * result) + ((this.method == null) ? 0 : this.method.hashCode()); result = (prime * result) + this.status; return result; }
/** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } PageLoadRequest other = (PageLoadRequest) obj; if (this.navigationTimings == null) { if (other.navigationTimings != null) { return false; } } else if (!this.navigationTimings.equals(other.navigationTimings)) { return false; } if (this.resourceCount != other.resourceCount) { // NOPMD return false; } return true; }
/** * {@inheritDoc} */ @Override public void deserializationComplete(Beacon beacon) { super.resolveRelativeUrl(baseUrl); }
/** * {@inheritDoc} */ @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = (prime * result) + ((this.navigationTimings == null) ? 0 : this.navigationTimings.hashCode()); result = (prime * result) + this.resourceCount; return result; }