-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
795 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
bytescope.agent/src/main/java/scouter/toys/bytescope/deco/context/ServletTraceContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,64 @@ | ||
package scouter.toys.bytescope.deco.context; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
/** | ||
* @author Gun Lee (gunlee01@gmail.com) on 2016. 9. 25. | ||
*/ | ||
public class ServletTraceContext { | ||
private HttpServletRequest request; | ||
private HttpServletResponse response; | ||
private String serviceName; | ||
private int servicHash; | ||
private long startTime; | ||
private String orgThreadName; | ||
|
||
public HttpServletRequest getRequest() { | ||
return request; | ||
} | ||
|
||
public void setRequest(HttpServletRequest request) { | ||
this.request = request; | ||
} | ||
|
||
public HttpServletResponse getResponse() { | ||
return response; | ||
} | ||
|
||
public void setResponse(HttpServletResponse response) { | ||
this.response = response; | ||
} | ||
|
||
public String getServiceName() { | ||
return serviceName; | ||
} | ||
|
||
public void setServiceName(String serviceName) { | ||
this.serviceName = serviceName; | ||
} | ||
|
||
public int getServicHash() { | ||
return servicHash; | ||
} | ||
|
||
public void setServicHash(int servicHash) { | ||
this.servicHash = servicHash; | ||
} | ||
|
||
public long getStartTime() { | ||
return startTime; | ||
} | ||
|
||
public void setStartTime(long startTime) { | ||
this.startTime = startTime; | ||
} | ||
|
||
public String getOrgThreadName() { | ||
return orgThreadName; | ||
} | ||
|
||
public void setOrgThreadName(String orgThreadName) { | ||
this.orgThreadName = orgThreadName; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
bytescope.agent/src/main/java/scouter/toys/bytescope/deco/helper/HttpTraceFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright 2015 the original author or authors. | ||
* @https://github.com/scouter-project/scouter | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package scouter.toys.bytescope.deco.helper; | ||
|
||
import scouter.toys.bytescope.deco.context.ServletTraceContext; | ||
import scouterx.org.pmw.tinylog.Logger; | ||
|
||
public class HttpTraceFactory { | ||
private static final String HTTP_TRACE = "scouter.xtra.http.HttpTrace"; | ||
|
||
public static final IHttpTrace dummy = new IHttpTrace() { | ||
public String getParameter(Object req, String key) { | ||
return null; | ||
} | ||
|
||
public String getHeader(Object req, String key) { | ||
return null; | ||
} | ||
|
||
public void start(ServletTraceContext ctx, Object req, Object res) { | ||
} | ||
|
||
public void end() { | ||
} | ||
}; | ||
|
||
public static IHttpTrace create(ClassLoader parent) { | ||
try { | ||
ClassLoader loader = LoaderManager.getHttpLoader(parent); | ||
if (loader == null) { | ||
return dummy; | ||
} | ||
Class c = Class.forName(HTTP_TRACE, true, loader); | ||
return (IHttpTrace) c.newInstance(); | ||
} catch (Throwable e) { | ||
Logger.error(e, "fail to create IHttpTrace"); | ||
return dummy; | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.