Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
ef2332ef
Commit
ef2332ef
authored
Jun 05, 2015
by
Shwetha GS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setting response mime type charset to utf8
parent
5fce46d4
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
31 deletions
+38
-31
GraphBackedDiscoveryService.java
...metadata/discovery/graph/GraphBackedDiscoveryService.java
+2
-2
EntityResource.java
.../apache/hadoop/metadata/web/resources/EntityResource.java
+11
-10
HiveLineageResource.java
...he/hadoop/metadata/web/resources/HiveLineageResource.java
+6
-6
MetadataDiscoveryResource.java
...oop/metadata/web/resources/MetadataDiscoveryResource.java
+9
-4
RexsterGraphResource.java
...e/hadoop/metadata/web/resources/RexsterGraphResource.java
+5
-5
TypesResource.java
...g/apache/hadoop/metadata/web/resources/TypesResource.java
+4
-4
Servlets.java
...in/java/org/apache/hadoop/metadata/web/util/Servlets.java
+1
-0
No files found.
repository/src/main/java/org/apache/hadoop/metadata/discovery/graph/GraphBackedDiscoveryService.java
View file @
ef2332ef
...
...
@@ -133,12 +133,12 @@ public class GraphBackedDiscoveryService implements DiscoveryService {
if
(
either
.
isRight
())
{
Expressions
.
Expression
expression
=
either
.
right
().
get
();
return
evaluate
(
expression
);
}
else
{
throw
new
DiscoveryException
(
"Invalid expression : "
+
dslQuery
+
". "
+
either
.
left
());
}
}
catch
(
Exception
e
)
{
// unable to catch ExpressionException
throw
new
DiscoveryException
(
"Invalid expression : "
+
dslQuery
,
e
);
}
throw
new
DiscoveryException
(
"Invalid expression : "
+
dslQuery
);
}
public
GremlinQueryResult
evaluate
(
Expressions
.
Expression
expression
)
{
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/EntityResource.java
View file @
ef2332ef
...
...
@@ -85,8 +85,8 @@ public class EntityResource {
* Submits an entity definition (instance) corresponding to a given type.
*/
@POST
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Consumes
(
Servlets
.
JSON_MEDIA_TYPE
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
submit
(
@Context
HttpServletRequest
request
)
{
try
{
final
String
entity
=
Servlets
.
getRequestPayload
(
request
);
...
...
@@ -127,7 +127,7 @@ public class EntityResource {
*/
@GET
@Path
(
"{guid}"
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
getEntityDefinition
(
@PathParam
(
"guid"
)
String
guid
)
{
try
{
LOG
.
debug
(
"Fetching entity definition for guid={} "
,
guid
);
...
...
@@ -164,7 +164,7 @@ public class EntityResource {
* @param entityType name of a type which is unique
*/
@GET
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
getEntityListByType
(
@QueryParam
(
"type"
)
String
entityType
)
{
try
{
Preconditions
.
checkNotNull
(
entityType
,
"Entity type cannot be null"
);
...
...
@@ -203,7 +203,8 @@ public class EntityResource {
*/
@PUT
@Path
(
"{guid}"
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Consumes
(
Servlets
.
JSON_MEDIA_TYPE
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
update
(
@PathParam
(
"guid"
)
String
guid
,
@QueryParam
(
"property"
)
String
property
,
@QueryParam
(
"value"
)
String
value
)
{
...
...
@@ -233,7 +234,7 @@ public class EntityResource {
*/
@GET
@Path
(
"{guid}/traits"
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
getTraitNames
(
@PathParam
(
"guid"
)
String
guid
)
{
try
{
LOG
.
debug
(
"Fetching trait names for entity={}"
,
guid
);
...
...
@@ -264,8 +265,8 @@ public class EntityResource {
*/
@POST
@Path
(
"{guid}/traits"
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Consumes
(
Servlets
.
JSON_MEDIA_TYPE
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
addTrait
(
@Context
HttpServletRequest
request
,
@PathParam
(
"guid"
)
String
guid
)
{
try
{
...
...
@@ -300,8 +301,8 @@ public class EntityResource {
*/
@DELETE
@Path
(
"{guid}/traits/{traitName}"
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Consumes
(
Servlets
.
JSON_MEDIA_TYPE
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
deleteTrait
(
@Context
HttpServletRequest
request
,
@PathParam
(
"guid"
)
String
guid
,
@PathParam
(
TRAIT_NAME
)
String
traitName
)
{
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/HiveLineageResource.java
View file @
ef2332ef
...
...
@@ -64,8 +64,8 @@ public class HiveLineageResource {
*/
@GET
@Path
(
"table/{tableName}/inputs/graph"
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Consumes
(
Servlets
.
JSON_MEDIA_TYPE
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
inputsGraph
(
@Context
HttpServletRequest
request
,
@PathParam
(
"tableName"
)
String
tableName
)
{
LOG
.
info
(
"Fetching lineage inputs graph for tableName={}"
,
tableName
);
...
...
@@ -98,8 +98,8 @@ public class HiveLineageResource {
*/
@GET
@Path
(
"table/{tableName}/outputs/graph"
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Consumes
(
Servlets
.
JSON_MEDIA_TYPE
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
outputsGraph
(
@Context
HttpServletRequest
request
,
@PathParam
(
"tableName"
)
String
tableName
)
{
LOG
.
info
(
"Fetching lineage outputs graph for tableName={}"
,
tableName
);
...
...
@@ -132,8 +132,8 @@ public class HiveLineageResource {
*/
@GET
@Path
(
"table/{tableName}/schema"
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Consumes
(
Servlets
.
JSON_MEDIA_TYPE
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
schema
(
@Context
HttpServletRequest
request
,
@PathParam
(
"tableName"
)
String
tableName
)
{
LOG
.
info
(
"Fetching schema for tableName={}"
,
tableName
);
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/MetadataDiscoveryResource.java
View file @
ef2332ef
...
...
@@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
import
javax.inject.Inject
;
import
javax.inject.Singleton
;
import
javax.ws.rs.Consumes
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.Path
;
import
javax.ws.rs.Produces
;
...
...
@@ -75,7 +76,8 @@ public class MetadataDiscoveryResource {
*/
@GET
@Path
(
"search"
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Consumes
(
Servlets
.
JSON_MEDIA_TYPE
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
search
(
@QueryParam
(
"query"
)
String
query
)
{
JSONObject
response
;
try
{
// fall back to dsl
...
...
@@ -125,7 +127,8 @@ public class MetadataDiscoveryResource {
*/
@GET
@Path
(
"search/dsl"
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Consumes
(
Servlets
.
JSON_MEDIA_TYPE
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
searchUsingQueryDSL
(
@QueryParam
(
"query"
)
String
dslQuery
)
{
try
{
ParamChecker
.
notEmpty
(
dslQuery
,
"dslQuery cannot be null"
);
...
...
@@ -156,7 +159,8 @@ public class MetadataDiscoveryResource {
*/
@GET
@Path
(
"search/gremlin"
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Consumes
(
Servlets
.
JSON_MEDIA_TYPE
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
searchUsingGremlinQuery
(
@QueryParam
(
"query"
)
String
gremlinQuery
)
{
try
{
ParamChecker
.
notEmpty
(
gremlinQuery
,
"gremlinQuery cannot be null or empty"
);
...
...
@@ -196,7 +200,8 @@ public class MetadataDiscoveryResource {
*/
@GET
@Path
(
"search/fulltext"
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Consumes
(
Servlets
.
JSON_MEDIA_TYPE
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
searchUsingFullText
(
@QueryParam
(
"query"
)
String
query
)
{
try
{
ParamChecker
.
notEmpty
(
query
,
"query cannot be null or empty"
);
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/RexsterGraphResource.java
View file @
ef2332ef
...
...
@@ -115,7 +115,7 @@ public class RexsterGraphResource {
*/
@GET
@Path
(
"/vertices/{id}"
)
@Produces
({
MediaType
.
APPLICATION_JSON
})
@Produces
({
Servlets
.
JSON_MEDIA_TYPE
})
public
Response
getVertex
(
@PathParam
(
"id"
)
final
String
vertexId
)
{
LOG
.
info
(
"Get vertex for vertexId= {}"
,
vertexId
);
validateInputs
(
"Invalid argument: vertex id passed is null or empty."
,
vertexId
);
...
...
@@ -152,7 +152,7 @@ public class RexsterGraphResource {
*/
@GET
@Path
(
"/vertices/properties/{id}"
)
@Produces
({
MediaType
.
APPLICATION_JSON
})
@Produces
({
Servlets
.
JSON_MEDIA_TYPE
})
public
Response
getVertexProperties
(
@PathParam
(
"id"
)
final
String
vertexId
,
@DefaultValue
(
"false"
)
@QueryParam
(
"relationships"
)
final
String
relationships
)
{
...
...
@@ -192,7 +192,7 @@ public class RexsterGraphResource {
*/
@GET
@Path
(
"/vertices"
)
@Produces
({
MediaType
.
APPLICATION_JSON
})
@Produces
({
Servlets
.
JSON_MEDIA_TYPE
})
public
Response
getVertices
(
@QueryParam
(
"key"
)
final
String
key
,
@QueryParam
(
"value"
)
final
String
value
)
{
LOG
.
info
(
"Get vertices for property key= {}, value= {}"
,
key
,
value
);
...
...
@@ -216,7 +216,7 @@ public class RexsterGraphResource {
*/
@GET
@Path
(
"vertices/{id}/{direction}"
)
@Produces
({
MediaType
.
APPLICATION_JSON
})
@Produces
({
Servlets
.
JSON_MEDIA_TYPE
})
public
Response
getVertexEdges
(
@PathParam
(
"id"
)
String
vertexId
,
@PathParam
(
"direction"
)
String
direction
)
{
LOG
.
info
(
"Get vertex edges for vertexId= {}, direction= {}"
,
vertexId
,
direction
);
...
...
@@ -288,7 +288,7 @@ public class RexsterGraphResource {
*/
@GET
@Path
(
"/edges/{id}"
)
@Produces
({
MediaType
.
APPLICATION_JSON
})
@Produces
({
Servlets
.
JSON_MEDIA_TYPE
})
public
Response
getEdge
(
@PathParam
(
"id"
)
final
String
edgeId
)
{
LOG
.
info
(
"Get vertex for edgeId= {}"
,
edgeId
);
validateInputs
(
"Invalid argument: edge id passed is null or empty."
,
edgeId
);
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/TypesResource.java
View file @
ef2332ef
...
...
@@ -78,8 +78,8 @@ public class TypesResource {
* domain. Could represent things like Hive Database, Hive Table, etc.
*/
@POST
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Consumes
(
Servlets
.
JSON_MEDIA_TYPE
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
submit
(
@Context
HttpServletRequest
request
)
{
try
{
final
String
typeDefinition
=
Servlets
.
getRequestPayload
(
request
);
...
...
@@ -119,7 +119,7 @@ public class TypesResource {
*/
@GET
@Path
(
"{typeName}"
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
getDefinition
(
@Context
HttpServletRequest
request
,
@PathParam
(
"typeName"
)
String
typeName
)
{
try
{
...
...
@@ -155,7 +155,7 @@ public class TypesResource {
* @return entity names response payload as json
*/
@GET
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
Response
getTypesByFilter
(
@Context
HttpServletRequest
request
,
@DefaultValue
(
TYPE_ALL
)
@QueryParam
(
"type"
)
String
type
)
{
try
{
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/util/Servlets.java
View file @
ef2332ef
...
...
@@ -48,6 +48,7 @@ public final class Servlets {
/* singleton */
}
public
static
final
String
JSON_MEDIA_TYPE
=
MediaType
.
APPLICATION_JSON
+
"; charset=UTF-8"
;
/**
* Returns the user of the given request.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment